From 33c77c93dfcb0d4dab97fa29694bf88d145cb511 Mon Sep 17 00:00:00 2001 From: Ivan Vaskevych Date: Mon, 2 Dec 2024 20:40:26 +0100 Subject: [PATCH 1/9] Fixes the non-working query parameter when it's a Enum --- .../src/main/resources/typescript/api/api.mustache | 5 +++++ 1 file changed, 5 insertions(+) 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 732d87b7515b..5aae3f57cb39 100644 --- a/modules/openapi-generator/src/main/resources/typescript/api/api.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/api/api.mustache @@ -69,6 +69,10 @@ export class {{classname}}RequestFactory extends BaseAPIRequestFactory { {{#isPrimitiveType}} requestContext.setQueryParam("{{baseName}}", ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}", "{{dataFormat}}")); {{/isPrimitiveType}} + {{#isEnumRef}} + requestContext.setQueryParam("{{baseName}}", ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}", "{{dataFormat}}")); + {{/isEnumRef}} + {{^isEnumRef}} {{^isPrimitiveType}} {{#isExplode}} const serializedParams = ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}", "{{dataFormat}}"); @@ -87,6 +91,7 @@ export class {{classname}}RequestFactory extends BaseAPIRequestFactory { requestContext.setQueryParam("{{baseName}}", ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}", "{{dataFormat}}")); {{/isExplode}} {{/isPrimitiveType}} + {{/isEnumRef}} } {{/queryParams}} {{#headerParams}} From 57716126913899e668e0c711977c1e0e3bdcc0b1 Mon Sep 17 00:00:00 2001 From: Ivan Vaskevych Date: Mon, 2 Dec 2024 23:23:41 +0100 Subject: [PATCH 2/9] Update modules/openapi-generator/src/main/resources/typescript/api/api.mustache Co-authored-by: Alexey Makhrov --- .../src/main/resources/typescript/api/api.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 5aae3f57cb39..e6247d51db1e 100644 --- a/modules/openapi-generator/src/main/resources/typescript/api/api.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/api/api.mustache @@ -69,11 +69,11 @@ export class {{classname}}RequestFactory extends BaseAPIRequestFactory { {{#isPrimitiveType}} requestContext.setQueryParam("{{baseName}}", ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}", "{{dataFormat}}")); {{/isPrimitiveType}} + {{^isPrimitiveType}} {{#isEnumRef}} requestContext.setQueryParam("{{baseName}}", ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}", "{{dataFormat}}")); {{/isEnumRef}} {{^isEnumRef}} - {{^isPrimitiveType}} {{#isExplode}} const serializedParams = ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}", "{{dataFormat}}"); {{#isArray}} From cb0d69059726c88bba7a3bcb1023607422982f25 Mon Sep 17 00:00:00 2001 From: Ivan Vaskevych Date: Mon, 2 Dec 2024 23:28:15 +0100 Subject: [PATCH 3/9] Fixes the tags order --- .../src/main/resources/typescript/api/api.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 e6247d51db1e..e27a5c02bbdd 100644 --- a/modules/openapi-generator/src/main/resources/typescript/api/api.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/api/api.mustache @@ -90,8 +90,8 @@ export class {{classname}}RequestFactory extends BaseAPIRequestFactory { {{^isExplode}} requestContext.setQueryParam("{{baseName}}", ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}", "{{dataFormat}}")); {{/isExplode}} - {{/isPrimitiveType}} {{/isEnumRef}} + {{/isPrimitiveType}} } {{/queryParams}} {{#headerParams}} From ef495d628439e595a52882fe2342c2c8030408fd Mon Sep 17 00:00:00 2001 From: Ivan Vaskevych Date: Sat, 7 Dec 2024 11:12:15 +0100 Subject: [PATCH 4/9] Adds Echo API client tests for typescript: step 1 --- bin/configs/typescript-echo-api.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 bin/configs/typescript-echo-api.yaml diff --git a/bin/configs/typescript-echo-api.yaml b/bin/configs/typescript-echo-api.yaml new file mode 100644 index 000000000000..bc064e691552 --- /dev/null +++ b/bin/configs/typescript-echo-api.yaml @@ -0,0 +1,9 @@ +generatorName: typescript +outputDir: samples/client/echo_api/typescript/build +inputSpec: modules/openapi-generator/src/test/resources/3_0/echo_api.yaml +templateDir: modules/openapi-generator/src/main/resources/typescript +additionalProperties: + artifactId: echo-api-typescript + hideGenerationTimestamp: "true" + npmVersion: 1.0.0 + npmName: '@openapitools/typescript-echo-api' From 68052852a16000496c37e0d4216b23139cac520f Mon Sep 17 00:00:00 2001 From: Ivan Vaskevych Date: Wed, 11 Dec 2024 16:31:40 +0100 Subject: [PATCH 5/9] Adds Echo API client tests for typescript: step 2 --- .../echo_api/typescript/build/.gitattributes | 8 + .../echo_api/typescript/build/.gitignore | 1 + .../build/.openapi-generator-ignore | 23 + .../typescript/build/.openapi-generator/FILES | 47 + .../build/.openapi-generator/VERSION | 1 + .../echo_api/typescript/build/AuthApi.md | 103 ++ .../echo_api/typescript/build/BodyApi.md | 581 +++++++++ .../echo_api/typescript/build/FormApi.md | 194 +++ .../echo_api/typescript/build/HeaderApi.md | 75 ++ .../echo_api/typescript/build/PathApi.md | 72 ++ .../echo_api/typescript/build/QueryApi.md | 606 ++++++++++ .../echo_api/typescript/build/README.md | 80 ++ .../echo_api/typescript/build/apis/AuthApi.ts | 139 +++ .../echo_api/typescript/build/apis/BodyApi.ts | 703 +++++++++++ .../echo_api/typescript/build/apis/FormApi.ts | 309 +++++ .../typescript/build/apis/HeaderApi.ts | 100 ++ .../echo_api/typescript/build/apis/PathApi.ts | 107 ++ .../typescript/build/apis/QueryApi.ts | 676 +++++++++++ .../echo_api/typescript/build/apis/baseapi.ts | 37 + .../typescript/build/apis/exception.ts | 15 + .../echo_api/typescript/build/auth/auth.ts | 114 ++ .../typescript/build/configuration.ts | 82 ++ .../echo_api/typescript/build/git_push.sh | 51 + .../echo_api/typescript/build/http/http.ts | 259 ++++ .../typescript/build/http/isomorphic-fetch.ts | 32 + .../client/echo_api/typescript/build/index.ts | 12 + .../echo_api/typescript/build/middleware.ts | 66 ++ .../echo_api/typescript/build/models/Bird.ts | 43 + .../typescript/build/models/Category.ts | 43 + .../typescript/build/models/DataQuery.ts | 63 + .../typescript/build/models/DefaultValue.ts | 96 ++ .../build/models/NumberPropertiesOnly.ts | 50 + .../build/models/ObjectSerializer.ts | 344 ++++++ .../echo_api/typescript/build/models/Pet.ts | 83 ++ .../echo_api/typescript/build/models/Query.ts | 53 + .../typescript/build/models/StringEnumRef.ts | 19 + .../echo_api/typescript/build/models/Tag.ts | 43 + .../TestFormObjectMultipartRequestMarker.ts | 36 + ...lodeTrueObjectAllOfQueryObjectParameter.ts | 57 + ...lodeTrueArrayStringQueryObjectParameter.ts | 36 + .../echo_api/typescript/build/models/all.ts | 12 + .../echo_api/typescript/build/package.json | 42 + .../echo_api/typescript/build/rxjsStub.ts | 27 + .../echo_api/typescript/build/servers.ts | 54 + .../echo_api/typescript/build/tsconfig.json | 36 + .../typescript/build/types/ObjectParamAPI.ts | 948 +++++++++++++++ .../typescript/build/types/ObservableAPI.ts | 1047 +++++++++++++++++ .../typescript/build/types/PromiseAPI.ts | 701 +++++++++++ .../client/echo_api/typescript/build/util.ts | 37 + 49 files changed, 8363 insertions(+) create mode 100644 samples/client/echo_api/typescript/build/.gitattributes create mode 100644 samples/client/echo_api/typescript/build/.gitignore create mode 100644 samples/client/echo_api/typescript/build/.openapi-generator-ignore create mode 100644 samples/client/echo_api/typescript/build/.openapi-generator/FILES create mode 100644 samples/client/echo_api/typescript/build/.openapi-generator/VERSION create mode 100644 samples/client/echo_api/typescript/build/AuthApi.md create mode 100644 samples/client/echo_api/typescript/build/BodyApi.md create mode 100644 samples/client/echo_api/typescript/build/FormApi.md create mode 100644 samples/client/echo_api/typescript/build/HeaderApi.md create mode 100644 samples/client/echo_api/typescript/build/PathApi.md create mode 100644 samples/client/echo_api/typescript/build/QueryApi.md create mode 100644 samples/client/echo_api/typescript/build/README.md create mode 100644 samples/client/echo_api/typescript/build/apis/AuthApi.ts create mode 100644 samples/client/echo_api/typescript/build/apis/BodyApi.ts create mode 100644 samples/client/echo_api/typescript/build/apis/FormApi.ts create mode 100644 samples/client/echo_api/typescript/build/apis/HeaderApi.ts create mode 100644 samples/client/echo_api/typescript/build/apis/PathApi.ts create mode 100644 samples/client/echo_api/typescript/build/apis/QueryApi.ts create mode 100644 samples/client/echo_api/typescript/build/apis/baseapi.ts create mode 100644 samples/client/echo_api/typescript/build/apis/exception.ts create mode 100644 samples/client/echo_api/typescript/build/auth/auth.ts create mode 100644 samples/client/echo_api/typescript/build/configuration.ts create mode 100644 samples/client/echo_api/typescript/build/git_push.sh create mode 100644 samples/client/echo_api/typescript/build/http/http.ts create mode 100644 samples/client/echo_api/typescript/build/http/isomorphic-fetch.ts create mode 100644 samples/client/echo_api/typescript/build/index.ts create mode 100644 samples/client/echo_api/typescript/build/middleware.ts create mode 100644 samples/client/echo_api/typescript/build/models/Bird.ts create mode 100644 samples/client/echo_api/typescript/build/models/Category.ts create mode 100644 samples/client/echo_api/typescript/build/models/DataQuery.ts create mode 100644 samples/client/echo_api/typescript/build/models/DefaultValue.ts create mode 100644 samples/client/echo_api/typescript/build/models/NumberPropertiesOnly.ts create mode 100644 samples/client/echo_api/typescript/build/models/ObjectSerializer.ts create mode 100644 samples/client/echo_api/typescript/build/models/Pet.ts create mode 100644 samples/client/echo_api/typescript/build/models/Query.ts create mode 100644 samples/client/echo_api/typescript/build/models/StringEnumRef.ts create mode 100644 samples/client/echo_api/typescript/build/models/Tag.ts create mode 100644 samples/client/echo_api/typescript/build/models/TestFormObjectMultipartRequestMarker.ts create mode 100644 samples/client/echo_api/typescript/build/models/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.ts create mode 100644 samples/client/echo_api/typescript/build/models/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.ts create mode 100644 samples/client/echo_api/typescript/build/models/all.ts create mode 100644 samples/client/echo_api/typescript/build/package.json create mode 100644 samples/client/echo_api/typescript/build/rxjsStub.ts create mode 100644 samples/client/echo_api/typescript/build/servers.ts create mode 100644 samples/client/echo_api/typescript/build/tsconfig.json create mode 100644 samples/client/echo_api/typescript/build/types/ObjectParamAPI.ts create mode 100644 samples/client/echo_api/typescript/build/types/ObservableAPI.ts create mode 100644 samples/client/echo_api/typescript/build/types/PromiseAPI.ts create mode 100644 samples/client/echo_api/typescript/build/util.ts diff --git a/samples/client/echo_api/typescript/build/.gitattributes b/samples/client/echo_api/typescript/build/.gitattributes new file mode 100644 index 000000000000..7bf5a17b22f1 --- /dev/null +++ b/samples/client/echo_api/typescript/build/.gitattributes @@ -0,0 +1,8 @@ +**/* linguist-generated +*.md linguist-documentation + +.gitattributes text +.gitattributes export-ignore + +.gitignore text +.gitignore export-ignore diff --git a/samples/client/echo_api/typescript/build/.gitignore b/samples/client/echo_api/typescript/build/.gitignore new file mode 100644 index 000000000000..1521c8b7652b --- /dev/null +++ b/samples/client/echo_api/typescript/build/.gitignore @@ -0,0 +1 @@ +dist diff --git a/samples/client/echo_api/typescript/build/.openapi-generator-ignore b/samples/client/echo_api/typescript/build/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/echo_api/typescript/build/.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/client/echo_api/typescript/build/.openapi-generator/FILES b/samples/client/echo_api/typescript/build/.openapi-generator/FILES new file mode 100644 index 000000000000..566ce8b4c574 --- /dev/null +++ b/samples/client/echo_api/typescript/build/.openapi-generator/FILES @@ -0,0 +1,47 @@ +.gitattributes +.gitignore +.openapi-generator-ignore +AuthApi.md +BodyApi.md +FormApi.md +HeaderApi.md +PathApi.md +QueryApi.md +README.md +apis/AuthApi.ts +apis/BodyApi.ts +apis/FormApi.ts +apis/HeaderApi.ts +apis/PathApi.ts +apis/QueryApi.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/Bird.ts +models/Category.ts +models/DataQuery.ts +models/DefaultValue.ts +models/NumberPropertiesOnly.ts +models/ObjectSerializer.ts +models/Pet.ts +models/Query.ts +models/StringEnumRef.ts +models/Tag.ts +models/TestFormObjectMultipartRequestMarker.ts +models/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.ts +models/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.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/client/echo_api/typescript/build/.openapi-generator/VERSION b/samples/client/echo_api/typescript/build/.openapi-generator/VERSION new file mode 100644 index 000000000000..884119126398 --- /dev/null +++ b/samples/client/echo_api/typescript/build/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.11.0-SNAPSHOT diff --git a/samples/client/echo_api/typescript/build/AuthApi.md b/samples/client/echo_api/typescript/build/AuthApi.md new file mode 100644 index 000000000000..349a5adaa7e8 --- /dev/null +++ b/samples/client/echo_api/typescript/build/AuthApi.md @@ -0,0 +1,103 @@ +# .AuthApi + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testAuthHttpBasic**](AuthApi.md#testAuthHttpBasic) | **POST** /auth/http/basic | To test HTTP basic authentication +[**testAuthHttpBearer**](AuthApi.md#testAuthHttpBearer) | **POST** /auth/http/bearer | To test HTTP bearer authentication + + +# **testAuthHttpBasic** +> string testAuthHttpBasic() + +To test HTTP basic authentication + +### Example + + +```typescript +import { createConfiguration, AuthApi } from ''; + +const configuration = createConfiguration(); +const apiInstance = new AuthApi(configuration); + +const request = {}; + +const data = await apiInstance.testAuthHttpBasic(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters +This endpoint does not need any parameter. + + +### Return type + +**string** + +### Authorization + +[http_auth](README.md#http_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + + +### 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) + +# **testAuthHttpBearer** +> string testAuthHttpBearer() + +To test HTTP bearer authentication + +### Example + + +```typescript +import { createConfiguration, AuthApi } from ''; + +const configuration = createConfiguration(); +const apiInstance = new AuthApi(configuration); + +const request = {}; + +const data = await apiInstance.testAuthHttpBearer(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters +This endpoint does not need any parameter. + + +### Return type + +**string** + +### Authorization + +[http_bearer_auth](README.md#http_bearer_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + + +### 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/client/echo_api/typescript/build/BodyApi.md b/samples/client/echo_api/typescript/build/BodyApi.md new file mode 100644 index 000000000000..182218637c70 --- /dev/null +++ b/samples/client/echo_api/typescript/build/BodyApi.md @@ -0,0 +1,581 @@ +# .BodyApi + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testBinaryGif**](BodyApi.md#testBinaryGif) | **POST** /binary/gif | Test binary (gif) response body +[**testBodyApplicationOctetstreamBinary**](BodyApi.md#testBodyApplicationOctetstreamBinary) | **POST** /body/application/octetstream/binary | Test body parameter(s) +[**testBodyMultipartFormdataArrayOfBinary**](BodyApi.md#testBodyMultipartFormdataArrayOfBinary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime +[**testBodyMultipartFormdataSingleBinary**](BodyApi.md#testBodyMultipartFormdataSingleBinary) | **POST** /body/application/octetstream/single_binary | Test single binary in multipart mime +[**testEchoBodyAllOfPet**](BodyApi.md#testEchoBodyAllOfPet) | **POST** /echo/body/allOf/Pet | Test body parameter(s) +[**testEchoBodyFreeFormObjectResponseString**](BodyApi.md#testEchoBodyFreeFormObjectResponseString) | **POST** /echo/body/FreeFormObject/response_string | Test free form object +[**testEchoBodyPet**](BodyApi.md#testEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s) +[**testEchoBodyPetResponseString**](BodyApi.md#testEchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body +[**testEchoBodyStringEnum**](BodyApi.md#testEchoBodyStringEnum) | **POST** /echo/body/string_enum | Test string enum response body +[**testEchoBodyTagResponseString**](BodyApi.md#testEchoBodyTagResponseString) | **POST** /echo/body/Tag/response_string | Test empty json (request body) + + +# **testBinaryGif** +> HttpFile testBinaryGif() + +Test binary (gif) response body + +### Example + + +```typescript +import { createConfiguration, BodyApi } from ''; + +const configuration = createConfiguration(); +const apiInstance = new BodyApi(configuration); + +const request = {}; + +const data = await apiInstance.testBinaryGif(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters +This endpoint does not need any parameter. + + +### Return type + +**HttpFile** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: image/gif + + +### 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) + +# **testBodyApplicationOctetstreamBinary** +> string testBodyApplicationOctetstreamBinary() + +Test body parameter(s) + +### Example + + +```typescript +import { createConfiguration, BodyApi } from ''; +import type { BodyApiTestBodyApplicationOctetstreamBinaryRequest } from ''; + +const configuration = createConfiguration(); +const apiInstance = new BodyApi(configuration); + +const request: BodyApiTestBodyApplicationOctetstreamBinaryRequest = { + + body: { data: Buffer.from(fs.readFileSync('/path/to/file', 'utf-8')), name: '/path/to/file' }, +}; + +const data = await apiInstance.testBodyApplicationOctetstreamBinary(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **HttpFile**| | + + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/octet-stream + - **Accept**: text/plain + + +### 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) + +# **testBodyMultipartFormdataArrayOfBinary** +> string testBodyMultipartFormdataArrayOfBinary() + +Test array of binary in multipart mime + +### Example + + +```typescript +import { createConfiguration, BodyApi } from ''; +import type { BodyApiTestBodyMultipartFormdataArrayOfBinaryRequest } from ''; + +const configuration = createConfiguration(); +const apiInstance = new BodyApi(configuration); + +const request: BodyApiTestBodyMultipartFormdataArrayOfBinaryRequest = { + + files: [ + { data: Buffer.from(fs.readFileSync('/path/to/file', 'utf-8')), name: '/path/to/file' }, + ], +}; + +const data = await apiInstance.testBodyMultipartFormdataArrayOfBinary(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **files** | **Array<HttpFile>** | | defaults to undefined + + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: text/plain + + +### 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) + +# **testBodyMultipartFormdataSingleBinary** +> string testBodyMultipartFormdataSingleBinary() + +Test single binary in multipart mime + +### Example + + +```typescript +import { createConfiguration, BodyApi } from ''; +import type { BodyApiTestBodyMultipartFormdataSingleBinaryRequest } from ''; + +const configuration = createConfiguration(); +const apiInstance = new BodyApi(configuration); + +const request: BodyApiTestBodyMultipartFormdataSingleBinaryRequest = { + + myFile: { data: Buffer.from(fs.readFileSync('/path/to/file', 'utf-8')), name: '/path/to/file' }, +}; + +const data = await apiInstance.testBodyMultipartFormdataSingleBinary(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **myFile** | [**HttpFile**] | | (optional) defaults to undefined + + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: text/plain + + +### 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) + +# **testEchoBodyAllOfPet** +> Pet testEchoBodyAllOfPet() + +Test body parameter(s) + +### Example + + +```typescript +import { createConfiguration, BodyApi } from ''; +import type { BodyApiTestEchoBodyAllOfPetRequest } from ''; + +const configuration = createConfiguration(); +const apiInstance = new BodyApi(configuration); + +const request: BodyApiTestEchoBodyAllOfPetRequest = { + // Pet object that needs to be added to the store (optional) + pet: null, +}; + +const data = await apiInstance.testEchoBodyAllOfPet(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | **Pet**| Pet object that needs to be added to the store | + + +### Return type + +**Pet** + +### 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) + +# **testEchoBodyFreeFormObjectResponseString** +> string testEchoBodyFreeFormObjectResponseString() + +Test free form object + +### Example + + +```typescript +import { createConfiguration, BodyApi } from ''; +import type { BodyApiTestEchoBodyFreeFormObjectResponseStringRequest } from ''; + +const configuration = createConfiguration(); +const apiInstance = new BodyApi(configuration); + +const request: BodyApiTestEchoBodyFreeFormObjectResponseStringRequest = { + // Free form object (optional) + body: {}, +}; + +const data = await apiInstance.testEchoBodyFreeFormObjectResponseString(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **any**| Free form object | + + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: text/plain + + +### 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) + +# **testEchoBodyPet** +> Pet testEchoBodyPet() + +Test body parameter(s) + +### Example + + +```typescript +import { createConfiguration, BodyApi } from ''; +import type { BodyApiTestEchoBodyPetRequest } from ''; + +const configuration = createConfiguration(); +const apiInstance = new BodyApi(configuration); + +const request: BodyApiTestEchoBodyPetRequest = { + // Pet object that needs to be added to the store (optional) + pet: { + id: 10, + name: "doggie", + category: { + id: 1, + name: "Dogs", + }, + photoUrls: [ + "photoUrls_example", + ], + tags: [ + { + id: 1, + name: "name_example", + }, + ], + status: "available", + }, +}; + +const data = await apiInstance.testEchoBodyPet(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | **Pet**| Pet object that needs to be added to the store | + + +### Return type + +**Pet** + +### 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) + +# **testEchoBodyPetResponseString** +> string testEchoBodyPetResponseString() + +Test empty response body + +### Example + + +```typescript +import { createConfiguration, BodyApi } from ''; +import type { BodyApiTestEchoBodyPetResponseStringRequest } from ''; + +const configuration = createConfiguration(); +const apiInstance = new BodyApi(configuration); + +const request: BodyApiTestEchoBodyPetResponseStringRequest = { + // Pet object that needs to be added to the store (optional) + pet: { + id: 10, + name: "doggie", + category: { + id: 1, + name: "Dogs", + }, + photoUrls: [ + "photoUrls_example", + ], + tags: [ + { + id: 1, + name: "name_example", + }, + ], + status: "available", + }, +}; + +const data = await apiInstance.testEchoBodyPetResponseString(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | **Pet**| Pet object that needs to be added to the store | + + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: text/plain + + +### 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) + +# **testEchoBodyStringEnum** +> StringEnumRef testEchoBodyStringEnum() + +Test string enum response body + +### Example + + +```typescript +import { createConfiguration, BodyApi } from ''; +import type { BodyApiTestEchoBodyStringEnumRequest } from ''; + +const configuration = createConfiguration(); +const apiInstance = new BodyApi(configuration); + +const request: BodyApiTestEchoBodyStringEnumRequest = { + // String enum (optional) + body: "success", +}; + +const data = await apiInstance.testEchoBodyStringEnum(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **string**| String enum | + + +### Return type + +**StringEnumRef** + +### 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) + +# **testEchoBodyTagResponseString** +> string testEchoBodyTagResponseString() + +Test empty json (request body) + +### Example + + +```typescript +import { createConfiguration, BodyApi } from ''; +import type { BodyApiTestEchoBodyTagResponseStringRequest } from ''; + +const configuration = createConfiguration(); +const apiInstance = new BodyApi(configuration); + +const request: BodyApiTestEchoBodyTagResponseStringRequest = { + // Tag object (optional) + tag: { + id: 1, + name: "name_example", + }, +}; + +const data = await apiInstance.testEchoBodyTagResponseString(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tag** | **Tag**| Tag object | + + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: text/plain + + +### 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/client/echo_api/typescript/build/FormApi.md b/samples/client/echo_api/typescript/build/FormApi.md new file mode 100644 index 000000000000..f29d546be6e5 --- /dev/null +++ b/samples/client/echo_api/typescript/build/FormApi.md @@ -0,0 +1,194 @@ +# .FormApi + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testFormIntegerBooleanString**](FormApi.md#testFormIntegerBooleanString) | **POST** /form/integer/boolean/string | Test form parameter(s) +[**testFormObjectMultipart**](FormApi.md#testFormObjectMultipart) | **POST** /form/object/multipart | Test form parameter(s) for multipart schema +[**testFormOneof**](FormApi.md#testFormOneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema + + +# **testFormIntegerBooleanString** +> string testFormIntegerBooleanString() + +Test form parameter(s) + +### Example + + +```typescript +import { createConfiguration, FormApi } from ''; +import type { FormApiTestFormIntegerBooleanStringRequest } from ''; + +const configuration = createConfiguration(); +const apiInstance = new FormApi(configuration); + +const request: FormApiTestFormIntegerBooleanStringRequest = { + + integerForm: 1, + + booleanForm: true, + + stringForm: "stringForm_example", +}; + +const data = await apiInstance.testFormIntegerBooleanString(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **integerForm** | [**number**] | | (optional) defaults to undefined + **booleanForm** | [**boolean**] | | (optional) defaults to undefined + **stringForm** | [**string**] | | (optional) defaults to undefined + + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: text/plain + + +### 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) + +# **testFormObjectMultipart** +> string testFormObjectMultipart() + +Test form parameter(s) for multipart schema + +### Example + + +```typescript +import { createConfiguration, FormApi } from ''; +import type { FormApiTestFormObjectMultipartRequest } from ''; + +const configuration = createConfiguration(); +const apiInstance = new FormApi(configuration); + +const request: FormApiTestFormObjectMultipartRequest = { + + marker: { + name: "name_example", + }, +}; + +const data = await apiInstance.testFormObjectMultipart(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **marker** | **TestFormObjectMultipartRequestMarker** | | defaults to undefined + + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: text/plain + + +### 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) + +# **testFormOneof** +> string testFormOneof() + +Test form parameter(s) for oneOf schema + +### Example + + +```typescript +import { createConfiguration, FormApi } from ''; +import type { FormApiTestFormOneofRequest } from ''; + +const configuration = createConfiguration(); +const apiInstance = new FormApi(configuration); + +const request: FormApiTestFormOneofRequest = { + + form1: "form1_example", + + form2: 1, + + form3: "form3_example", + + form4: true, + + id: 1, + + name: "name_example", +}; + +const data = await apiInstance.testFormOneof(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **form1** | [**string**] | | (optional) defaults to undefined + **form2** | [**number**] | | (optional) defaults to undefined + **form3** | [**string**] | | (optional) defaults to undefined + **form4** | [**boolean**] | | (optional) defaults to undefined + **id** | [**number**] | | (optional) defaults to undefined + **name** | [**string**] | | (optional) defaults to undefined + + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: text/plain + + +### 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/client/echo_api/typescript/build/HeaderApi.md b/samples/client/echo_api/typescript/build/HeaderApi.md new file mode 100644 index 000000000000..01a5d81dee44 --- /dev/null +++ b/samples/client/echo_api/typescript/build/HeaderApi.md @@ -0,0 +1,75 @@ +# .HeaderApi + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testHeaderIntegerBooleanStringEnums**](HeaderApi.md#testHeaderIntegerBooleanStringEnums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s) + + +# **testHeaderIntegerBooleanStringEnums** +> string testHeaderIntegerBooleanStringEnums() + +Test header parameter(s) + +### Example + + +```typescript +import { createConfiguration, HeaderApi } from ''; +import type { HeaderApiTestHeaderIntegerBooleanStringEnumsRequest } from ''; + +const configuration = createConfiguration(); +const apiInstance = new HeaderApi(configuration); + +const request: HeaderApiTestHeaderIntegerBooleanStringEnumsRequest = { + + integerHeader: 1, + + booleanHeader: true, + + stringHeader: "string_header_example", + + enumNonrefStringHeader: "success", + + enumRefStringHeader: "success", +}; + +const data = await apiInstance.testHeaderIntegerBooleanStringEnums(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **integerHeader** | [**number**] | | (optional) defaults to undefined + **booleanHeader** | [**boolean**] | | (optional) defaults to undefined + **stringHeader** | [**string**] | | (optional) defaults to undefined + **enumNonrefStringHeader** | [**'success' | 'failure' | 'unclassified'**]**Array<'success' | 'failure' | 'unclassified'>** | | (optional) defaults to undefined + **enumRefStringHeader** | **StringEnumRef** | | (optional) defaults to undefined + + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + + +### 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/client/echo_api/typescript/build/PathApi.md b/samples/client/echo_api/typescript/build/PathApi.md new file mode 100644 index 000000000000..10ed995105b4 --- /dev/null +++ b/samples/client/echo_api/typescript/build/PathApi.md @@ -0,0 +1,72 @@ +# .PathApi + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath**](PathApi.md#testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s) + + +# **testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath** +> string testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath() + +Test path parameter(s) + +### Example + + +```typescript +import { createConfiguration, PathApi } from ''; +import type { PathApiTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequest } from ''; + +const configuration = createConfiguration(); +const apiInstance = new PathApi(configuration); + +const request: PathApiTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequest = { + + pathString: "path_string_example", + + pathInteger: 1, + + enumNonrefStringPath: "success", + + enumRefStringPath: "success", +}; + +const data = await apiInstance.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pathString** | [**string**] | | defaults to undefined + **pathInteger** | [**number**] | | defaults to undefined + **enumNonrefStringPath** | [**'success' | 'failure' | 'unclassified'**]**Array<'success' | 'failure' | 'unclassified'>** | | defaults to undefined + **enumRefStringPath** | **StringEnumRef** | | defaults to undefined + + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + + +### 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/client/echo_api/typescript/build/QueryApi.md b/samples/client/echo_api/typescript/build/QueryApi.md new file mode 100644 index 000000000000..cbc94d10a437 --- /dev/null +++ b/samples/client/echo_api/typescript/build/QueryApi.md @@ -0,0 +1,606 @@ +# .QueryApi + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testEnumRefString**](QueryApi.md#testEnumRefString) | **GET** /query/enum_ref_string | Test query parameter(s) +[**testQueryDatetimeDateString**](QueryApi.md#testQueryDatetimeDateString) | **GET** /query/datetime/date/string | Test query parameter(s) +[**testQueryIntegerBooleanString**](QueryApi.md#testQueryIntegerBooleanString) | **GET** /query/integer/boolean/string | Test query parameter(s) +[**testQueryStyleDeepObjectExplodeTrueObject**](QueryApi.md#testQueryStyleDeepObjectExplodeTrueObject) | **GET** /query/style_deepObject/explode_true/object | Test query parameter(s) +[**testQueryStyleDeepObjectExplodeTrueObjectAllOf**](QueryApi.md#testQueryStyleDeepObjectExplodeTrueObjectAllOf) | **GET** /query/style_deepObject/explode_true/object/allOf | Test query parameter(s) +[**testQueryStyleFormExplodeFalseArrayInteger**](QueryApi.md#testQueryStyleFormExplodeFalseArrayInteger) | **GET** /query/style_form/explode_false/array_integer | Test query parameter(s) +[**testQueryStyleFormExplodeFalseArrayString**](QueryApi.md#testQueryStyleFormExplodeFalseArrayString) | **GET** /query/style_form/explode_false/array_string | Test query parameter(s) +[**testQueryStyleFormExplodeTrueArrayString**](QueryApi.md#testQueryStyleFormExplodeTrueArrayString) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s) +[**testQueryStyleFormExplodeTrueObject**](QueryApi.md#testQueryStyleFormExplodeTrueObject) | **GET** /query/style_form/explode_true/object | Test query parameter(s) +[**testQueryStyleFormExplodeTrueObjectAllOf**](QueryApi.md#testQueryStyleFormExplodeTrueObjectAllOf) | **GET** /query/style_form/explode_true/object/allOf | Test query parameter(s) + + +# **testEnumRefString** +> string testEnumRefString() + +Test query parameter(s) + +### Example + + +```typescript +import { createConfiguration, QueryApi } from ''; +import type { QueryApiTestEnumRefStringRequest } from ''; + +const configuration = createConfiguration(); +const apiInstance = new QueryApi(configuration); + +const request: QueryApiTestEnumRefStringRequest = { + + enumNonrefStringQuery: "success", + + enumRefStringQuery: "success", +}; + +const data = await apiInstance.testEnumRefString(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enumNonrefStringQuery** | [**'success' | 'failure' | 'unclassified'**]**Array<'success' | 'failure' | 'unclassified'>** | | (optional) defaults to undefined + **enumRefStringQuery** | **StringEnumRef** | | (optional) defaults to undefined + + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + + +### 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) + +# **testQueryDatetimeDateString** +> string testQueryDatetimeDateString() + +Test query parameter(s) + +### Example + + +```typescript +import { createConfiguration, QueryApi } from ''; +import type { QueryApiTestQueryDatetimeDateStringRequest } from ''; + +const configuration = createConfiguration(); +const apiInstance = new QueryApi(configuration); + +const request: QueryApiTestQueryDatetimeDateStringRequest = { + + datetimeQuery: new Date('1970-01-01T00:00:00.00Z'), + + dateQuery: new Date('1970-01-01').toISOString().split('T')[0];, + + stringQuery: "string_query_example", +}; + +const data = await apiInstance.testQueryDatetimeDateString(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **datetimeQuery** | [**Date**] | | (optional) defaults to undefined + **dateQuery** | [**string**] | | (optional) defaults to undefined + **stringQuery** | [**string**] | | (optional) defaults to undefined + + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + + +### 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) + +# **testQueryIntegerBooleanString** +> string testQueryIntegerBooleanString() + +Test query parameter(s) + +### Example + + +```typescript +import { createConfiguration, QueryApi } from ''; +import type { QueryApiTestQueryIntegerBooleanStringRequest } from ''; + +const configuration = createConfiguration(); +const apiInstance = new QueryApi(configuration); + +const request: QueryApiTestQueryIntegerBooleanStringRequest = { + + integerQuery: 1, + + booleanQuery: true, + + stringQuery: "string_query_example", +}; + +const data = await apiInstance.testQueryIntegerBooleanString(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **integerQuery** | [**number**] | | (optional) defaults to undefined + **booleanQuery** | [**boolean**] | | (optional) defaults to undefined + **stringQuery** | [**string**] | | (optional) defaults to undefined + + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + + +### 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) + +# **testQueryStyleDeepObjectExplodeTrueObject** +> string testQueryStyleDeepObjectExplodeTrueObject() + +Test query parameter(s) + +### Example + + +```typescript +import { createConfiguration, QueryApi } from ''; +import type { QueryApiTestQueryStyleDeepObjectExplodeTrueObjectRequest } from ''; + +const configuration = createConfiguration(); +const apiInstance = new QueryApi(configuration); + +const request: QueryApiTestQueryStyleDeepObjectExplodeTrueObjectRequest = { + + queryObject: { + id: 10, + name: "doggie", + category: { + id: 1, + name: "Dogs", + }, + photoUrls: [ + "photoUrls_example", + ], + tags: [ + { + id: 1, + name: "name_example", + }, + ], + status: "available", + }, +}; + +const data = await apiInstance.testQueryStyleDeepObjectExplodeTrueObject(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **queryObject** | **Pet** | | (optional) defaults to undefined + + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + + +### 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) + +# **testQueryStyleDeepObjectExplodeTrueObjectAllOf** +> string testQueryStyleDeepObjectExplodeTrueObjectAllOf() + +Test query parameter(s) + +### Example + + +```typescript +import { createConfiguration, QueryApi } from ''; +import type { QueryApiTestQueryStyleDeepObjectExplodeTrueObjectAllOfRequest } from ''; + +const configuration = createConfiguration(); +const apiInstance = new QueryApi(configuration); + +const request: QueryApiTestQueryStyleDeepObjectExplodeTrueObjectAllOfRequest = { + + queryObject: null, +}; + +const data = await apiInstance.testQueryStyleDeepObjectExplodeTrueObjectAllOf(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **queryObject** | **TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter** | | (optional) defaults to undefined + + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + + +### 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) + +# **testQueryStyleFormExplodeFalseArrayInteger** +> string testQueryStyleFormExplodeFalseArrayInteger() + +Test query parameter(s) + +### Example + + +```typescript +import { createConfiguration, QueryApi } from ''; +import type { QueryApiTestQueryStyleFormExplodeFalseArrayIntegerRequest } from ''; + +const configuration = createConfiguration(); +const apiInstance = new QueryApi(configuration); + +const request: QueryApiTestQueryStyleFormExplodeFalseArrayIntegerRequest = { + + queryObject: [ + 1, + ], +}; + +const data = await apiInstance.testQueryStyleFormExplodeFalseArrayInteger(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **queryObject** | **Array<number>** | | (optional) defaults to undefined + + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + + +### 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) + +# **testQueryStyleFormExplodeFalseArrayString** +> string testQueryStyleFormExplodeFalseArrayString() + +Test query parameter(s) + +### Example + + +```typescript +import { createConfiguration, QueryApi } from ''; +import type { QueryApiTestQueryStyleFormExplodeFalseArrayStringRequest } from ''; + +const configuration = createConfiguration(); +const apiInstance = new QueryApi(configuration); + +const request: QueryApiTestQueryStyleFormExplodeFalseArrayStringRequest = { + + queryObject: [ + "query_object_example", + ], +}; + +const data = await apiInstance.testQueryStyleFormExplodeFalseArrayString(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **queryObject** | **Array<string>** | | (optional) defaults to undefined + + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + + +### 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) + +# **testQueryStyleFormExplodeTrueArrayString** +> string testQueryStyleFormExplodeTrueArrayString() + +Test query parameter(s) + +### Example + + +```typescript +import { createConfiguration, QueryApi } from ''; +import type { QueryApiTestQueryStyleFormExplodeTrueArrayStringRequest } from ''; + +const configuration = createConfiguration(); +const apiInstance = new QueryApi(configuration); + +const request: QueryApiTestQueryStyleFormExplodeTrueArrayStringRequest = { + + queryObject: { + values: [ + "values_example", + ], + }, +}; + +const data = await apiInstance.testQueryStyleFormExplodeTrueArrayString(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **queryObject** | **TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter** | | (optional) defaults to undefined + + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + + +### 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) + +# **testQueryStyleFormExplodeTrueObject** +> string testQueryStyleFormExplodeTrueObject() + +Test query parameter(s) + +### Example + + +```typescript +import { createConfiguration, QueryApi } from ''; +import type { QueryApiTestQueryStyleFormExplodeTrueObjectRequest } from ''; + +const configuration = createConfiguration(); +const apiInstance = new QueryApi(configuration); + +const request: QueryApiTestQueryStyleFormExplodeTrueObjectRequest = { + + queryObject: { + id: 10, + name: "doggie", + category: { + id: 1, + name: "Dogs", + }, + photoUrls: [ + "photoUrls_example", + ], + tags: [ + { + id: 1, + name: "name_example", + }, + ], + status: "available", + }, +}; + +const data = await apiInstance.testQueryStyleFormExplodeTrueObject(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **queryObject** | **Pet** | | (optional) defaults to undefined + + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + + +### 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) + +# **testQueryStyleFormExplodeTrueObjectAllOf** +> string testQueryStyleFormExplodeTrueObjectAllOf() + +Test query parameter(s) + +### Example + + +```typescript +import { createConfiguration, QueryApi } from ''; +import type { QueryApiTestQueryStyleFormExplodeTrueObjectAllOfRequest } from ''; + +const configuration = createConfiguration(); +const apiInstance = new QueryApi(configuration); + +const request: QueryApiTestQueryStyleFormExplodeTrueObjectAllOfRequest = { + + queryObject: null, +}; + +const data = await apiInstance.testQueryStyleFormExplodeTrueObjectAllOf(request); +console.log('API called successfully. Returned data:', data); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **queryObject** | **DataQuery** | | (optional) defaults to undefined + + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + + +### 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/client/echo_api/typescript/build/README.md b/samples/client/echo_api/typescript/build/README.md new file mode 100644 index 000000000000..a23263b9b6b4 --- /dev/null +++ b/samples/client/echo_api/typescript/build/README.md @@ -0,0 +1,80 @@ +## @openapitools/typescript-echo-api@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 @openapitools/typescript-echo-api@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/client/echo_api/typescript/build/apis/AuthApi.ts b/samples/client/echo_api/typescript/build/apis/AuthApi.ts new file mode 100644 index 000000000000..0dcbd3ef7dd7 --- /dev/null +++ b/samples/client/echo_api/typescript/build/apis/AuthApi.ts @@ -0,0 +1,139 @@ +// 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 {ObjectSerializer} from '../models/ObjectSerializer'; +import {ApiException} from './exception'; +import {canConsumeForm, isCodeInRange} from '../util'; +import {SecurityAuthentication} from '../auth/auth'; + + + +/** + * no description + */ +export class AuthApiRequestFactory extends BaseAPIRequestFactory { + + /** + * To test HTTP basic authentication + * To test HTTP basic authentication + */ + public async testAuthHttpBasic(_options?: Configuration): Promise { + let _config = _options || this.configuration; + + // Path Params + const localVarPath = '/auth/http/basic'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["http_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; + } + + /** + * To test HTTP bearer authentication + * To test HTTP bearer authentication + */ + public async testAuthHttpBearer(_options?: Configuration): Promise { + let _config = _options || this.configuration; + + // Path Params + const localVarPath = '/auth/http/bearer'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["http_bearer_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 AuthApiResponseProcessor { + + /** + * 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 testAuthHttpBasic + * @throws ApiException if the response code was not in [200, 299] + */ + public async testAuthHttpBasicWithHttpInfo(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 testAuthHttpBearer + * @throws ApiException if the response code was not in [200, 299] + */ + public async testAuthHttpBearerWithHttpInfo(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); + } + +} diff --git a/samples/client/echo_api/typescript/build/apis/BodyApi.ts b/samples/client/echo_api/typescript/build/apis/BodyApi.ts new file mode 100644 index 000000000000..25bc040a5fbf --- /dev/null +++ b/samples/client/echo_api/typescript/build/apis/BodyApi.ts @@ -0,0 +1,703 @@ +// 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 {ObjectSerializer} from '../models/ObjectSerializer'; +import {ApiException} from './exception'; +import {canConsumeForm, isCodeInRange} from '../util'; +import {SecurityAuthentication} from '../auth/auth'; + + +import { Pet } from '../models/Pet'; +import { StringEnumRef } from '../models/StringEnumRef'; +import { Tag } from '../models/Tag'; + +/** + * no description + */ +export class BodyApiRequestFactory extends BaseAPIRequestFactory { + + /** + * Test binary (gif) response body + * Test binary (gif) response body + */ + public async testBinaryGif(_options?: Configuration): Promise { + let _config = _options || this.configuration; + + // Path Params + const localVarPath = '/binary/gif'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + 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 body parameter(s) + * Test body parameter(s) + * @param body + */ + public async testBodyApplicationOctetstreamBinary(body?: HttpFile, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + // Path Params + const localVarPath = '/body/application/octetstream/binary'; + + // 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/octet-stream" + ]); + 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; + } + + /** + * Test array of binary in multipart mime + * Test array of binary in multipart mime + * @param files + */ + public async testBodyMultipartFormdataArrayOfBinary(files: Array, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'files' is not null or undefined + if (files === null || files === undefined) { + throw new RequiredError("BodyApi", "testBodyMultipartFormdataArrayOfBinary", "files"); + } + + + // Path Params + const localVarPath = '/body/application/octetstream/array_of_binary'; + + // 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 (files) { + // TODO: replace .append with .set + localVarFormParams.append('files', files.join(COLLECTION_FORMATS["csv"])); + } + + requestContext.setBody(localVarFormParams); + + if(!useForm) { + const contentType = ObjectSerializer.getPreferredMediaType([ + "multipart/form-data" + ]); + 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; + } + + /** + * Test single binary in multipart mime + * Test single binary in multipart mime + * @param myFile + */ + public async testBodyMultipartFormdataSingleBinary(myFile?: HttpFile, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + // Path Params + const localVarPath = '/body/application/octetstream/single_binary'; + + // 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 (myFile !== undefined) { + // TODO: replace .append with .set + if (localVarFormParams instanceof FormData) { + localVarFormParams.append('my-file', myFile, myFile.name); + } + } + + requestContext.setBody(localVarFormParams); + + if(!useForm) { + const contentType = ObjectSerializer.getPreferredMediaType([ + "multipart/form-data" + ]); + 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; + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param pet Pet object that needs to be added to the store + */ + public async testEchoBodyAllOfPet(pet?: Pet, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + // Path Params + const localVarPath = '/echo/body/allOf/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" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(pet, "Pet", ""), + 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 free form object + * Test free form object + * @param body Free form object + */ + public async testEchoBodyFreeFormObjectResponseString(body?: any, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + // Path Params + const localVarPath = '/echo/body/FreeFormObject/response_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, "any", ""), + 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 body parameter(s) + * Test body parameter(s) + * @param pet Pet object that needs to be added to the store + */ + public async testEchoBodyPet(pet?: Pet, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + // Path Params + const localVarPath = '/echo/body/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" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(pet, "Pet", ""), + 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 empty response body + * Test empty response body + * @param pet Pet object that needs to be added to the store + */ + public async testEchoBodyPetResponseString(pet?: Pet, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + // Path Params + const localVarPath = '/echo/body/Pet/response_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(pet, "Pet", ""), + 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 string enum response body + * Test string enum response body + * @param body String enum + */ + public async testEchoBodyStringEnum(body?: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + // Path Params + const localVarPath = '/echo/body/string_enum'; + + // 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 empty json (request body) + * Test empty json (request body) + * @param tag Tag object + */ + public async testEchoBodyTagResponseString(tag?: Tag, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + // Path Params + const localVarPath = '/echo/body/Tag/response_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(tag, "Tag", ""), + 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 BodyApiResponseProcessor { + + /** + * 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 testBinaryGif + * @throws ApiException if the response code was not in [200, 299] + */ + public async testBinaryGifWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: HttpFile = await response.getBodyAsFile() as any as HttpFile; + 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: HttpFile = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "HttpFile", "binary" + ) as HttpFile; + 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 testBodyApplicationOctetstreamBinary + * @throws ApiException if the response code was not in [200, 299] + */ + public async testBodyApplicationOctetstreamBinaryWithHttpInfo(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 testBodyMultipartFormdataArrayOfBinary + * @throws ApiException if the response code was not in [200, 299] + */ + public async testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(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 testBodyMultipartFormdataSingleBinary + * @throws ApiException if the response code was not in [200, 299] + */ + public async testBodyMultipartFormdataSingleBinaryWithHttpInfo(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 testEchoBodyAllOfPet + * @throws ApiException if the response code was not in [200, 299] + */ + public async testEchoBodyAllOfPetWithHttpInfo(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); + } + + // 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 testEchoBodyFreeFormObjectResponseString + * @throws ApiException if the response code was not in [200, 299] + */ + public async testEchoBodyFreeFormObjectResponseStringWithHttpInfo(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 testEchoBodyPet + * @throws ApiException if the response code was not in [200, 299] + */ + public async testEchoBodyPetWithHttpInfo(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); + } + + // 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 testEchoBodyPetResponseString + * @throws ApiException if the response code was not in [200, 299] + */ + public async testEchoBodyPetResponseStringWithHttpInfo(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 testEchoBodyStringEnum + * @throws ApiException if the response code was not in [200, 299] + */ + public async testEchoBodyStringEnumWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: StringEnumRef = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "StringEnumRef", "" + ) as StringEnumRef; + 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: StringEnumRef = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "StringEnumRef", "" + ) as StringEnumRef; + 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 testEchoBodyTagResponseString + * @throws ApiException if the response code was not in [200, 299] + */ + public async testEchoBodyTagResponseStringWithHttpInfo(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); + } + +} diff --git a/samples/client/echo_api/typescript/build/apis/FormApi.ts b/samples/client/echo_api/typescript/build/apis/FormApi.ts new file mode 100644 index 000000000000..ccf60e881a32 --- /dev/null +++ b/samples/client/echo_api/typescript/build/apis/FormApi.ts @@ -0,0 +1,309 @@ +// 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 {ObjectSerializer} from '../models/ObjectSerializer'; +import {ApiException} from './exception'; +import {canConsumeForm, isCodeInRange} from '../util'; +import {SecurityAuthentication} from '../auth/auth'; + + +import { TestFormObjectMultipartRequestMarker } from '../models/TestFormObjectMultipartRequestMarker'; + +/** + * no description + */ +export class FormApiRequestFactory extends BaseAPIRequestFactory { + + /** + * Test form parameter(s) + * Test form parameter(s) + * @param integerForm + * @param booleanForm + * @param stringForm + */ + public async testFormIntegerBooleanString(integerForm?: number, booleanForm?: boolean, stringForm?: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + + + // Path Params + const localVarPath = '/form/integer/boolean/string'; + + // 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 (integerForm !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('integer_form', integerForm as any); + } + if (booleanForm !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('boolean_form', booleanForm as any); + } + if (stringForm !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('string_form', stringForm 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; + } + + /** + * Test form parameter(s) for multipart schema + * Test form parameter(s) for multipart schema + * @param marker + */ + public async testFormObjectMultipart(marker: TestFormObjectMultipartRequestMarker, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'marker' is not null or undefined + if (marker === null || marker === undefined) { + throw new RequiredError("FormApi", "testFormObjectMultipart", "marker"); + } + + + // Path Params + const localVarPath = '/form/object/multipart'; + + // 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 (marker !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('marker', marker as any); + } + + requestContext.setBody(localVarFormParams); + + if(!useForm) { + const contentType = ObjectSerializer.getPreferredMediaType([ + "multipart/form-data" + ]); + 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; + } + + /** + * Test form parameter(s) for oneOf schema + * Test form parameter(s) for oneOf schema + * @param form1 + * @param form2 + * @param form3 + * @param form4 + * @param id + * @param name + */ + public async testFormOneof(form1?: string, form2?: number, form3?: string, form4?: boolean, id?: number, name?: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + + + + + + // Path Params + const localVarPath = '/form/oneof'; + + // 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 (form1 !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('form1', form1 as any); + } + if (form2 !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('form2', form2 as any); + } + if (form3 !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('form3', form3 as any); + } + if (form4 !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('form4', form4 as any); + } + if (id !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('id', id as any); + } + if (name !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('name', name 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; + } + +} + +export class FormApiResponseProcessor { + + /** + * 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 testFormIntegerBooleanString + * @throws ApiException if the response code was not in [200, 299] + */ + public async testFormIntegerBooleanStringWithHttpInfo(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 testFormObjectMultipart + * @throws ApiException if the response code was not in [200, 299] + */ + public async testFormObjectMultipartWithHttpInfo(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 testFormOneof + * @throws ApiException if the response code was not in [200, 299] + */ + public async testFormOneofWithHttpInfo(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); + } + +} diff --git a/samples/client/echo_api/typescript/build/apis/HeaderApi.ts b/samples/client/echo_api/typescript/build/apis/HeaderApi.ts new file mode 100644 index 000000000000..d17c58da1425 --- /dev/null +++ b/samples/client/echo_api/typescript/build/apis/HeaderApi.ts @@ -0,0 +1,100 @@ +// 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 {ObjectSerializer} from '../models/ObjectSerializer'; +import {ApiException} from './exception'; +import {canConsumeForm, isCodeInRange} from '../util'; +import {SecurityAuthentication} from '../auth/auth'; + + +import { StringEnumRef } from '../models/StringEnumRef'; + +/** + * no description + */ +export class HeaderApiRequestFactory extends BaseAPIRequestFactory { + + /** + * Test header parameter(s) + * Test header parameter(s) + * @param integerHeader + * @param booleanHeader + * @param stringHeader + * @param enumNonrefStringHeader + * @param enumRefStringHeader + */ + public async testHeaderIntegerBooleanStringEnums(integerHeader?: number, booleanHeader?: boolean, stringHeader?: string, enumNonrefStringHeader?: 'success' | 'failure' | 'unclassified', enumRefStringHeader?: StringEnumRef, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + + + + + // Path Params + const localVarPath = '/header/integer/boolean/string/enums'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Header Params + requestContext.setHeaderParam("integer_header", ObjectSerializer.serialize(integerHeader, "number", "")); + + // Header Params + requestContext.setHeaderParam("boolean_header", ObjectSerializer.serialize(booleanHeader, "boolean", "")); + + // Header Params + requestContext.setHeaderParam("string_header", ObjectSerializer.serialize(stringHeader, "string", "")); + + // Header Params + requestContext.setHeaderParam("enum_nonref_string_header", ObjectSerializer.serialize(enumNonrefStringHeader, "'success' | 'failure' | 'unclassified'", "")); + + // Header Params + requestContext.setHeaderParam("enum_ref_string_header", ObjectSerializer.serialize(enumRefStringHeader, "StringEnumRef", "")); + + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + +} + +export class HeaderApiResponseProcessor { + + /** + * 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 testHeaderIntegerBooleanStringEnums + * @throws ApiException if the response code was not in [200, 299] + */ + public async testHeaderIntegerBooleanStringEnumsWithHttpInfo(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); + } + +} diff --git a/samples/client/echo_api/typescript/build/apis/PathApi.ts b/samples/client/echo_api/typescript/build/apis/PathApi.ts new file mode 100644 index 000000000000..c03204d8c827 --- /dev/null +++ b/samples/client/echo_api/typescript/build/apis/PathApi.ts @@ -0,0 +1,107 @@ +// 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 {ObjectSerializer} from '../models/ObjectSerializer'; +import {ApiException} from './exception'; +import {canConsumeForm, isCodeInRange} from '../util'; +import {SecurityAuthentication} from '../auth/auth'; + + +import { StringEnumRef } from '../models/StringEnumRef'; + +/** + * no description + */ +export class PathApiRequestFactory extends BaseAPIRequestFactory { + + /** + * Test path parameter(s) + * Test path parameter(s) + * @param pathString + * @param pathInteger + * @param enumNonrefStringPath + * @param enumRefStringPath + */ + public async testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString: string, pathInteger: number, enumNonrefStringPath: 'success' | 'failure' | 'unclassified', enumRefStringPath: StringEnumRef, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'pathString' is not null or undefined + if (pathString === null || pathString === undefined) { + throw new RequiredError("PathApi", "testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath", "pathString"); + } + + + // verify required parameter 'pathInteger' is not null or undefined + if (pathInteger === null || pathInteger === undefined) { + throw new RequiredError("PathApi", "testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath", "pathInteger"); + } + + + // verify required parameter 'enumNonrefStringPath' is not null or undefined + if (enumNonrefStringPath === null || enumNonrefStringPath === undefined) { + throw new RequiredError("PathApi", "testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath", "enumNonrefStringPath"); + } + + + // verify required parameter 'enumRefStringPath' is not null or undefined + if (enumRefStringPath === null || enumRefStringPath === undefined) { + throw new RequiredError("PathApi", "testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath", "enumRefStringPath"); + } + + + // Path Params + const localVarPath = '/path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}' + .replace('{' + 'path_string' + '}', encodeURIComponent(String(pathString))) + .replace('{' + 'path_integer' + '}', encodeURIComponent(String(pathInteger))) + .replace('{' + 'enum_nonref_string_path' + '}', encodeURIComponent(String(enumNonrefStringPath))) + .replace('{' + 'enum_ref_string_path' + '}', encodeURIComponent(String(enumRefStringPath))); + + // 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 PathApiResponseProcessor { + + /** + * 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 testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath + * @throws ApiException if the response code was not in [200, 299] + */ + public async testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(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); + } + +} diff --git a/samples/client/echo_api/typescript/build/apis/QueryApi.ts b/samples/client/echo_api/typescript/build/apis/QueryApi.ts new file mode 100644 index 000000000000..4d928b17d1fa --- /dev/null +++ b/samples/client/echo_api/typescript/build/apis/QueryApi.ts @@ -0,0 +1,676 @@ +// 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 {ObjectSerializer} from '../models/ObjectSerializer'; +import {ApiException} from './exception'; +import {canConsumeForm, isCodeInRange} from '../util'; +import {SecurityAuthentication} from '../auth/auth'; + + +import { DataQuery } from '../models/DataQuery'; +import { Pet } from '../models/Pet'; +import { StringEnumRef } from '../models/StringEnumRef'; +import { TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter } from '../models/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter'; +import { TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter } from '../models/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter'; + +/** + * no description + */ +export class QueryApiRequestFactory extends BaseAPIRequestFactory { + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param enumNonrefStringQuery + * @param enumRefStringQuery + */ + public async testEnumRefString(enumNonrefStringQuery?: 'success' | 'failure' | 'unclassified', enumRefStringQuery?: StringEnumRef, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + + // Path Params + const localVarPath = '/query/enum_ref_string'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (enumNonrefStringQuery !== undefined) { + requestContext.setQueryParam("enum_nonref_string_query", ObjectSerializer.serialize(enumNonrefStringQuery, "'success' | 'failure' | 'unclassified'", "")); + } + + // Query Params + if (enumRefStringQuery !== undefined) { + requestContext.setQueryParam("enum_ref_string_query", ObjectSerializer.serialize(enumRefStringQuery, "StringEnumRef", "")); + } + + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param datetimeQuery + * @param dateQuery + * @param stringQuery + */ + public async testQueryDatetimeDateString(datetimeQuery?: Date, dateQuery?: string, stringQuery?: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + + + // Path Params + const localVarPath = '/query/datetime/date/string'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (datetimeQuery !== undefined) { + requestContext.setQueryParam("datetime_query", ObjectSerializer.serialize(datetimeQuery, "Date", "date-time")); + } + + // Query Params + if (dateQuery !== undefined) { + requestContext.setQueryParam("date_query", ObjectSerializer.serialize(dateQuery, "string", "date")); + } + + // Query Params + if (stringQuery !== undefined) { + requestContext.setQueryParam("string_query", ObjectSerializer.serialize(stringQuery, "string", "")); + } + + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param integerQuery + * @param booleanQuery + * @param stringQuery + */ + public async testQueryIntegerBooleanString(integerQuery?: number, booleanQuery?: boolean, stringQuery?: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + + + // Path Params + const localVarPath = '/query/integer/boolean/string'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (integerQuery !== undefined) { + requestContext.setQueryParam("integer_query", ObjectSerializer.serialize(integerQuery, "number", "")); + } + + // Query Params + if (booleanQuery !== undefined) { + requestContext.setQueryParam("boolean_query", ObjectSerializer.serialize(booleanQuery, "boolean", "")); + } + + // Query Params + if (stringQuery !== undefined) { + requestContext.setQueryParam("string_query", ObjectSerializer.serialize(stringQuery, "string", "")); + } + + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject + */ + public async testQueryStyleDeepObjectExplodeTrueObject(queryObject?: Pet, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + // Path Params + const localVarPath = '/query/style_deepObject/explode_true/object'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (queryObject !== undefined) { + const serializedParams = ObjectSerializer.serialize(queryObject, "Pet", ""); + for (const key of Object.keys(serializedParams)) { + requestContext.setQueryParam(key, serializedParams[key]); + } + } + + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject + */ + public async testQueryStyleDeepObjectExplodeTrueObjectAllOf(queryObject?: TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + // Path Params + const localVarPath = '/query/style_deepObject/explode_true/object/allOf'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (queryObject !== undefined) { + const serializedParams = ObjectSerializer.serialize(queryObject, "TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter", ""); + for (const key of Object.keys(serializedParams)) { + requestContext.setQueryParam(key, serializedParams[key]); + } + } + + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject + */ + public async testQueryStyleFormExplodeFalseArrayInteger(queryObject?: Array, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + // Path Params + const localVarPath = '/query/style_form/explode_false/array_integer'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (queryObject !== undefined) { + requestContext.setQueryParam("query_object", ObjectSerializer.serialize(queryObject, "Array", "")); + } + + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject + */ + public async testQueryStyleFormExplodeFalseArrayString(queryObject?: Array, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + // Path Params + const localVarPath = '/query/style_form/explode_false/array_string'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (queryObject !== undefined) { + requestContext.setQueryParam("query_object", ObjectSerializer.serialize(queryObject, "Array", "")); + } + + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject + */ + public async testQueryStyleFormExplodeTrueArrayString(queryObject?: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + // Path Params + const localVarPath = '/query/style_form/explode_true/array_string'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (queryObject !== undefined) { + const serializedParams = ObjectSerializer.serialize(queryObject, "TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter", ""); + for (const key of Object.keys(serializedParams)) { + requestContext.setQueryParam(key, serializedParams[key]); + } + } + + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject + */ + public async testQueryStyleFormExplodeTrueObject(queryObject?: Pet, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + // Path Params + const localVarPath = '/query/style_form/explode_true/object'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (queryObject !== undefined) { + const serializedParams = ObjectSerializer.serialize(queryObject, "Pet", ""); + for (const key of Object.keys(serializedParams)) { + requestContext.setQueryParam(key, serializedParams[key]); + } + } + + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject + */ + public async testQueryStyleFormExplodeTrueObjectAllOf(queryObject?: DataQuery, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + // Path Params + const localVarPath = '/query/style_form/explode_true/object/allOf'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (queryObject !== undefined) { + const serializedParams = ObjectSerializer.serialize(queryObject, "DataQuery", ""); + for (const key of Object.keys(serializedParams)) { + requestContext.setQueryParam(key, serializedParams[key]); + } + } + + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + +} + +export class QueryApiResponseProcessor { + + /** + * 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 testEnumRefString + * @throws ApiException if the response code was not in [200, 299] + */ + public async testEnumRefStringWithHttpInfo(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 testQueryDatetimeDateString + * @throws ApiException if the response code was not in [200, 299] + */ + public async testQueryDatetimeDateStringWithHttpInfo(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 testQueryIntegerBooleanString + * @throws ApiException if the response code was not in [200, 299] + */ + public async testQueryIntegerBooleanStringWithHttpInfo(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 testQueryStyleDeepObjectExplodeTrueObject + * @throws ApiException if the response code was not in [200, 299] + */ + public async testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(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 testQueryStyleDeepObjectExplodeTrueObjectAllOf + * @throws ApiException if the response code was not in [200, 299] + */ + public async testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(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 testQueryStyleFormExplodeFalseArrayInteger + * @throws ApiException if the response code was not in [200, 299] + */ + public async testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(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 testQueryStyleFormExplodeFalseArrayString + * @throws ApiException if the response code was not in [200, 299] + */ + public async testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(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 testQueryStyleFormExplodeTrueArrayString + * @throws ApiException if the response code was not in [200, 299] + */ + public async testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(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 testQueryStyleFormExplodeTrueObject + * @throws ApiException if the response code was not in [200, 299] + */ + public async testQueryStyleFormExplodeTrueObjectWithHttpInfo(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 testQueryStyleFormExplodeTrueObjectAllOf + * @throws ApiException if the response code was not in [200, 299] + */ + public async testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(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); + } + +} diff --git a/samples/client/echo_api/typescript/build/apis/baseapi.ts b/samples/client/echo_api/typescript/build/apis/baseapi.ts new file mode 100644 index 000000000000..4c47d7cb15a0 --- /dev/null +++ b/samples/client/echo_api/typescript/build/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 { + override 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/client/echo_api/typescript/build/apis/exception.ts b/samples/client/echo_api/typescript/build/apis/exception.ts new file mode 100644 index 000000000000..9365d33a8f7e --- /dev/null +++ b/samples/client/echo_api/typescript/build/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/client/echo_api/typescript/build/auth/auth.ts b/samples/client/echo_api/typescript/build/auth/auth.ts new file mode 100644 index 000000000000..fc340a792cea --- /dev/null +++ b/samples/client/echo_api/typescript/build/auth/auth.ts @@ -0,0 +1,114 @@ +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 http authentication to the request context. + */ +export class HttpAuthAuthentication 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_auth"; + } + + 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 HttpBearerAuthAuthentication 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 "http_bearer_auth"; + } + + public async applySecurityAuthentication(context: RequestContext) { + context.setHeaderParam("Authorization", "Bearer " + await this.tokenProvider.getToken()); + } +} + + +export type AuthMethods = { + "default"?: SecurityAuthentication, + "http_auth"?: SecurityAuthentication, + "http_bearer_auth"?: SecurityAuthentication +} + +export type ApiKeyConfiguration = string; +export type HttpBasicConfiguration = { "username": string, "password": string }; +export type HttpBearerConfiguration = { tokenProvider: TokenProvider }; +export type OAuth2Configuration = { accessToken: string }; +export type HttpSignatureConfiguration = unknown; // TODO: Implement + +export type AuthMethodsConfiguration = { + "default"?: SecurityAuthentication, + "http_auth"?: HttpBasicConfiguration, + "http_bearer_auth"?: HttpBearerConfiguration +} + +/** + * 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["http_auth"]) { + authMethods["http_auth"] = new HttpAuthAuthentication( + config["http_auth"]["username"], + config["http_auth"]["password"] + ); + } + + if (config["http_bearer_auth"]) { + authMethods["http_bearer_auth"] = new HttpBearerAuthAuthentication( + config["http_bearer_auth"]["tokenProvider"] + ); + } + + return authMethods; +} \ No newline at end of file diff --git a/samples/client/echo_api/typescript/build/configuration.ts b/samples/client/echo_api/typescript/build/configuration.ts new file mode 100644 index 000000000000..7acb56e66477 --- /dev/null +++ b/samples/client/echo_api/typescript/build/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/client/echo_api/typescript/build/git_push.sh b/samples/client/echo_api/typescript/build/git_push.sh new file mode 100644 index 000000000000..b253029754ed --- /dev/null +++ b/samples/client/echo_api/typescript/build/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/client/echo_api/typescript/build/http/http.ts b/samples/client/echo_api/typescript/build/http/http.ts new file mode 100644 index 000000000000..fd40471a98f4 --- /dev/null +++ b/samples/client/echo_api/typescript/build/http/http.ts @@ -0,0 +1,259 @@ +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 = Blob & { readonly 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; + +type Headers = Record; + +function ensureAbsoluteUrl(url: string) { + if (url.startsWith("http://") || url.startsWith("https://")) { + return url; + } + return window.location.origin + url; +} + +/** + * Represents an HTTP request context + */ +export class RequestContext { + private headers: Headers = {}; + private body: RequestBody = undefined; + private url: URL; + + /** + * 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(): Headers { + 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; + } +} + +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: Blob = await this.dataSource; + // @ts-ignore + if (data.text) { + // @ts-ignore + return data.text(); + } + + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.addEventListener("load", () => resolve(reader.result as string)); + reader.addEventListener("error", () => reject(reader.error)); + reader.readAsText(data); + }); + } +} + +export class ResponseContext { + public constructor( + public httpStatusCode: number, + public headers: Headers, + 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): Headers { + const result: Headers = {}; + if (!this.headers[headerName]) { + return result; + } + + const parameters = this.headers[headerName]!.split(";"); + for (const parameter of parameters) { + let [key, value] = parameter.split("=", 2); + if (!key) { + continue; + } + 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"] || ""; + const contentType = this.headers["content-type"] || ""; + try { + return new File([data], fileName, { type: contentType }); + } catch (error) { + /** Fallback for when the File constructor is not available */ + return Object.assign(data, { + name: fileName, + type: contentType + }); + } + } + + /** + * 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( + httpStatusCode: number, + headers: Headers, + body: ResponseBody, + public data: T, + ) { + super(httpStatusCode, headers, body); + } +} diff --git a/samples/client/echo_api/typescript/build/http/isomorphic-fetch.ts b/samples/client/echo_api/typescript/build/http/isomorphic-fetch.ts new file mode 100644 index 000000000000..3af85f3d902c --- /dev/null +++ b/samples/client/echo_api/typescript/build/http/isomorphic-fetch.ts @@ -0,0 +1,32 @@ +import {HttpLibrary, RequestContext, ResponseContext} from './http'; +import { from, Observable } from '../rxjsStub'; +import "whatwg-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(), + credentials: "same-origin" + }).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.blob() + }; + return new ResponseContext(resp.status, headers, body); + }); + + return from>(resultPromise); + + } +} diff --git a/samples/client/echo_api/typescript/build/index.ts b/samples/client/echo_api/typescript/build/index.ts new file mode 100644 index 000000000000..ed8282fb46cc --- /dev/null +++ b/samples/client/echo_api/typescript/build/index.ts @@ -0,0 +1,12 @@ +export * from "./http/http"; +export * from "./auth/auth"; +export * from "./models/all"; +export { createConfiguration } from "./configuration" +export type { Configuration } from "./configuration" +export * from "./apis/exception"; +export * from "./servers"; +export { RequiredError } from "./apis/baseapi"; + +export type { PromiseMiddleware as Middleware } from './middleware'; +export { PromiseAuthApi as AuthApi, PromiseBodyApi as BodyApi, PromiseFormApi as FormApi, PromiseHeaderApi as HeaderApi, PromisePathApi as PathApi, PromiseQueryApi as QueryApi } from './types/PromiseAPI'; + diff --git a/samples/client/echo_api/typescript/build/middleware.ts b/samples/client/echo_api/typescript/build/middleware.ts new file mode 100644 index 000000000000..524f93f016b2 --- /dev/null +++ b/samples/client/echo_api/typescript/build/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/client/echo_api/typescript/build/models/Bird.ts b/samples/client/echo_api/typescript/build/models/Bird.ts new file mode 100644 index 000000000000..c08fd50f9ea2 --- /dev/null +++ b/samples/client/echo_api/typescript/build/models/Bird.ts @@ -0,0 +1,43 @@ +/** + * Echo Server API + * Echo Server API + * + * OpenAPI spec version: 0.1.0 + * Contact: team@openapitools.org + * + * 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 Bird { + 'size'?: string; + 'color'?: 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": "size", + "baseName": "size", + "type": "string", + "format": "" + }, + { + "name": "color", + "baseName": "color", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return Bird.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/client/echo_api/typescript/build/models/Category.ts b/samples/client/echo_api/typescript/build/models/Category.ts new file mode 100644 index 000000000000..739eab7c4cc1 --- /dev/null +++ b/samples/client/echo_api/typescript/build/models/Category.ts @@ -0,0 +1,43 @@ +/** + * Echo Server API + * Echo Server API + * + * OpenAPI spec version: 0.1.0 + * Contact: team@openapitools.org + * + * 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/client/echo_api/typescript/build/models/DataQuery.ts b/samples/client/echo_api/typescript/build/models/DataQuery.ts new file mode 100644 index 000000000000..6b52d951fb72 --- /dev/null +++ b/samples/client/echo_api/typescript/build/models/DataQuery.ts @@ -0,0 +1,63 @@ +/** + * Echo Server API + * Echo Server API + * + * OpenAPI spec version: 0.1.0 + * Contact: team@openapitools.org + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Query } from '../models/Query'; +import { HttpFile } from '../http/http'; + +export class DataQuery extends Query { + /** + * test suffix + */ + 'suffix'?: string; + /** + * Some text containing white spaces + */ + 'text'?: string; + /** + * A date + */ + 'date'?: Date; + + static override readonly discriminator: string | undefined = undefined; + + static override readonly mapping: {[index: string]: string} | undefined = undefined; + + static override readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "suffix", + "baseName": "suffix", + "type": "string", + "format": "" + }, + { + "name": "text", + "baseName": "text", + "type": "string", + "format": "" + }, + { + "name": "date", + "baseName": "date", + "type": "Date", + "format": "date-time" + } ]; + + static override getAttributeTypeMap() { + return super.getAttributeTypeMap().concat(DataQuery.attributeTypeMap); + } + + public constructor() { + super(); + } +} + + diff --git a/samples/client/echo_api/typescript/build/models/DefaultValue.ts b/samples/client/echo_api/typescript/build/models/DefaultValue.ts new file mode 100644 index 000000000000..05cc0d9ad412 --- /dev/null +++ b/samples/client/echo_api/typescript/build/models/DefaultValue.ts @@ -0,0 +1,96 @@ +/** + * Echo Server API + * Echo Server API + * + * OpenAPI spec version: 0.1.0 + * Contact: team@openapitools.org + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { StringEnumRef } from '../models/StringEnumRef'; +import { HttpFile } from '../http/http'; + +/** +* to test the default value of properties +*/ +export class DefaultValue { + 'arrayStringEnumRefDefault'?: Array; + 'arrayStringEnumDefault'?: Array; + 'arrayStringDefault'?: Array; + 'arrayIntegerDefault'?: Array; + 'arrayString'?: Array; + 'arrayStringNullable'?: Array | null; + 'arrayStringExtensionNullable'?: Array | null; + 'stringNullable'?: 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": "arrayStringEnumRefDefault", + "baseName": "array_string_enum_ref_default", + "type": "Array", + "format": "" + }, + { + "name": "arrayStringEnumDefault", + "baseName": "array_string_enum_default", + "type": "Array", + "format": "" + }, + { + "name": "arrayStringDefault", + "baseName": "array_string_default", + "type": "Array", + "format": "" + }, + { + "name": "arrayIntegerDefault", + "baseName": "array_integer_default", + "type": "Array", + "format": "" + }, + { + "name": "arrayString", + "baseName": "array_string", + "type": "Array", + "format": "" + }, + { + "name": "arrayStringNullable", + "baseName": "array_string_nullable", + "type": "Array", + "format": "" + }, + { + "name": "arrayStringExtensionNullable", + "baseName": "array_string_extension_nullable", + "type": "Array", + "format": "" + }, + { + "name": "stringNullable", + "baseName": "string_nullable", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return DefaultValue.attributeTypeMap; + } + + public constructor() { + } +} + +export enum DefaultValueArrayStringEnumDefaultEnum { + Success = 'success', + Failure = 'failure', + Unclassified = 'unclassified' +} + diff --git a/samples/client/echo_api/typescript/build/models/NumberPropertiesOnly.ts b/samples/client/echo_api/typescript/build/models/NumberPropertiesOnly.ts new file mode 100644 index 000000000000..8787f9c7f6ba --- /dev/null +++ b/samples/client/echo_api/typescript/build/models/NumberPropertiesOnly.ts @@ -0,0 +1,50 @@ +/** + * Echo Server API + * Echo Server API + * + * OpenAPI spec version: 0.1.0 + * Contact: team@openapitools.org + * + * 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 NumberPropertiesOnly { + 'number'?: number; + '_float'?: number; + '_double'?: 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": "number", + "baseName": "number", + "type": "number", + "format": "" + }, + { + "name": "_float", + "baseName": "float", + "type": "number", + "format": "float" + }, + { + "name": "_double", + "baseName": "double", + "type": "number", + "format": "double" + } ]; + + static getAttributeTypeMap() { + return NumberPropertiesOnly.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/client/echo_api/typescript/build/models/ObjectSerializer.ts b/samples/client/echo_api/typescript/build/models/ObjectSerializer.ts new file mode 100644 index 000000000000..0e7fed816336 --- /dev/null +++ b/samples/client/echo_api/typescript/build/models/ObjectSerializer.ts @@ -0,0 +1,344 @@ +export * from '../models/Bird'; +export * from '../models/Category'; +export * from '../models/DataQuery'; +export * from '../models/DefaultValue'; +export * from '../models/NumberPropertiesOnly'; +export * from '../models/Pet'; +export * from '../models/Query'; +export * from '../models/StringEnumRef'; +export * from '../models/Tag'; +export * from '../models/TestFormObjectMultipartRequestMarker'; +export * from '../models/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter'; +export * from '../models/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter'; + +import { Bird } from '../models/Bird'; +import { Category } from '../models/Category'; +import { DataQuery } from '../models/DataQuery'; +import { DefaultValue , DefaultValueArrayStringEnumDefaultEnum } from '../models/DefaultValue'; +import { NumberPropertiesOnly } from '../models/NumberPropertiesOnly'; +import { Pet , PetStatusEnum } from '../models/Pet'; +import { Query , QueryOutcomesEnum } from '../models/Query'; +import { StringEnumRef } from '../models/StringEnumRef'; +import { Tag } from '../models/Tag'; +import { TestFormObjectMultipartRequestMarker } from '../models/TestFormObjectMultipartRequestMarker'; +import { TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter } from '../models/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter'; +import { TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter } from '../models/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter'; + +/* tslint:disable:no-unused-variable */ +let primitives = [ + "string", + "boolean", + "double", + "integer", + "long", + "float", + "number", + "any" + ]; + +let enumsMap: Set = new Set([ + "DefaultValueArrayStringEnumDefaultEnum", + "PetStatusEnum", + "QueryOutcomesEnum", + "StringEnumRef", +]); + +let typeMap: {[index: string]: any} = { + "Bird": Bird, + "Category": Category, + "DataQuery": DataQuery, + "DefaultValue": DefaultValue, + "NumberPropertiesOnly": NumberPropertiesOnly, + "Pet": Pet, + "Query": Query, + "Tag": Tag, + "TestFormObjectMultipartRequestMarker": TestFormObjectMultipartRequestMarker, + "TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter": TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter, + "TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter": TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter, +} + +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, +]; + +const nullableSuffix = " | null"; +const optionalSuffix = " | undefined"; +const arrayPrefix = "Array<"; +const arraySuffix = ">"; +const mapPrefix = "{ [key: string]: "; +const mapSuffix = "; }"; + +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): any { + if (data == undefined) { + return data; + } else if (primitives.indexOf(type.toLowerCase()) !== -1) { + return data; + } else if (type.endsWith(nullableSuffix)) { + let subType: string = type.slice(0, -nullableSuffix.length); // Type | null => Type + return ObjectSerializer.serialize(data, subType, format); + } else if (type.endsWith(optionalSuffix)) { + let subType: string = type.slice(0, -optionalSuffix.length); // Type | undefined => Type + return ObjectSerializer.serialize(data, subType, format); + } else if (type.startsWith(arrayPrefix)) { + let subType: string = type.slice(arrayPrefix.length, -arraySuffix.length); // Array => Type + let transformedData: any[] = []; + for (let date of data) { + transformedData.push(ObjectSerializer.serialize(date, subType, format)); + } + return transformedData; + } else if (type.startsWith(mapPrefix)) { + let subType: string = type.slice(mapPrefix.length, -mapSuffix.length); // { [key: string]: Type; } => Type + let transformedData: { [key: string]: any } = {}; + for (let key in data) { + transformedData[key] = ObjectSerializer.serialize( + data[key], + 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): any { + // 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.endsWith(nullableSuffix)) { + let subType: string = type.slice(0, -nullableSuffix.length); // Type | null => Type + return ObjectSerializer.deserialize(data, subType, format); + } else if (type.endsWith(optionalSuffix)) { + let subType: string = type.slice(0, -optionalSuffix.length); // Type | undefined => Type + return ObjectSerializer.deserialize(data, subType, format); + } else if (type.startsWith(arrayPrefix)) { + let subType: string = type.slice(arrayPrefix.length, -arraySuffix.length); // Array => Type + let transformedData: any[] = []; + for (let date of data) { + transformedData.push(ObjectSerializer.deserialize(date, subType, format)); + } + return transformedData; + } else if (type.startsWith(mapPrefix)) { + let subType: string = type.slice(mapPrefix.length, -mapSuffix.length); // { [key: string]: Type; } => Type + let transformedData: { [key: string]: any } = {}; + for (let key in data) { + transformedData[key] = ObjectSerializer.deserialize( + data[key], + 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(ObjectSerializer.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/client/echo_api/typescript/build/models/Pet.ts b/samples/client/echo_api/typescript/build/models/Pet.ts new file mode 100644 index 000000000000..276d033ed06f --- /dev/null +++ b/samples/client/echo_api/typescript/build/models/Pet.ts @@ -0,0 +1,83 @@ +/** + * Echo Server API + * Echo Server API + * + * OpenAPI spec version: 0.1.0 + * Contact: team@openapitools.org + * + * 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; + 'name': string; + 'category'?: Category; + 'photoUrls': Array; + '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": "name", + "baseName": "name", + "type": "string", + "format": "" + }, + { + "name": "category", + "baseName": "category", + "type": "Category", + "format": "" + }, + { + "name": "photoUrls", + "baseName": "photoUrls", + "type": "Array", + "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/client/echo_api/typescript/build/models/Query.ts b/samples/client/echo_api/typescript/build/models/Query.ts new file mode 100644 index 000000000000..a69887a4288a --- /dev/null +++ b/samples/client/echo_api/typescript/build/models/Query.ts @@ -0,0 +1,53 @@ +/** + * Echo Server API + * Echo Server API + * + * OpenAPI spec version: 0.1.0 + * Contact: team@openapitools.org + * + * 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 Query { + /** + * Query + */ + 'id'?: number; + 'outcomes'?: 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": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "outcomes", + "baseName": "outcomes", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return Query.attributeTypeMap; + } + + public constructor() { + } +} + +export enum QueryOutcomesEnum { + Success = 'SUCCESS', + Failure = 'FAILURE', + Skipped = 'SKIPPED' +} + diff --git a/samples/client/echo_api/typescript/build/models/StringEnumRef.ts b/samples/client/echo_api/typescript/build/models/StringEnumRef.ts new file mode 100644 index 000000000000..b208b9c892cb --- /dev/null +++ b/samples/client/echo_api/typescript/build/models/StringEnumRef.ts @@ -0,0 +1,19 @@ +/** + * Echo Server API + * Echo Server API + * + * OpenAPI spec version: 0.1.0 + * Contact: team@openapitools.org + * + * 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 StringEnumRef { + Success = 'success', + Failure = 'failure', + Unclassified = 'unclassified' +} diff --git a/samples/client/echo_api/typescript/build/models/Tag.ts b/samples/client/echo_api/typescript/build/models/Tag.ts new file mode 100644 index 000000000000..cb9adebd7f8b --- /dev/null +++ b/samples/client/echo_api/typescript/build/models/Tag.ts @@ -0,0 +1,43 @@ +/** + * Echo Server API + * Echo Server API + * + * OpenAPI spec version: 0.1.0 + * Contact: team@openapitools.org + * + * 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/client/echo_api/typescript/build/models/TestFormObjectMultipartRequestMarker.ts b/samples/client/echo_api/typescript/build/models/TestFormObjectMultipartRequestMarker.ts new file mode 100644 index 000000000000..14e19e7ccec1 --- /dev/null +++ b/samples/client/echo_api/typescript/build/models/TestFormObjectMultipartRequestMarker.ts @@ -0,0 +1,36 @@ +/** + * Echo Server API + * Echo Server API + * + * OpenAPI spec version: 0.1.0 + * Contact: team@openapitools.org + * + * 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 TestFormObjectMultipartRequestMarker { + '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 TestFormObjectMultipartRequestMarker.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/client/echo_api/typescript/build/models/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.ts b/samples/client/echo_api/typescript/build/models/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.ts new file mode 100644 index 000000000000..b0201ab7eb84 --- /dev/null +++ b/samples/client/echo_api/typescript/build/models/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.ts @@ -0,0 +1,57 @@ +/** + * Echo Server API + * Echo Server API + * + * OpenAPI spec version: 0.1.0 + * Contact: team@openapitools.org + * + * 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 TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter { + 'size'?: string; + 'color'?: string; + '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": "size", + "baseName": "size", + "type": "string", + "format": "" + }, + { + "name": "color", + "baseName": "color", + "type": "string", + "format": "" + }, + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "name", + "baseName": "name", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/client/echo_api/typescript/build/models/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.ts b/samples/client/echo_api/typescript/build/models/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.ts new file mode 100644 index 000000000000..0474367333cd --- /dev/null +++ b/samples/client/echo_api/typescript/build/models/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.ts @@ -0,0 +1,36 @@ +/** + * Echo Server API + * Echo Server API + * + * OpenAPI spec version: 0.1.0 + * Contact: team@openapitools.org + * + * 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 TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter { + 'values'?: 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": "values", + "baseName": "values", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/client/echo_api/typescript/build/models/all.ts b/samples/client/echo_api/typescript/build/models/all.ts new file mode 100644 index 000000000000..6c43a5186e11 --- /dev/null +++ b/samples/client/echo_api/typescript/build/models/all.ts @@ -0,0 +1,12 @@ +export * from '../models/Bird' +export * from '../models/Category' +export * from '../models/DataQuery' +export * from '../models/DefaultValue' +export * from '../models/NumberPropertiesOnly' +export * from '../models/Pet' +export * from '../models/Query' +export * from '../models/StringEnumRef' +export * from '../models/Tag' +export * from '../models/TestFormObjectMultipartRequestMarker' +export * from '../models/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter' +export * from '../models/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter' diff --git a/samples/client/echo_api/typescript/build/package.json b/samples/client/echo_api/typescript/build/package.json new file mode 100644 index 000000000000..5644934d7914 --- /dev/null +++ b/samples/client/echo_api/typescript/build/package.json @@ -0,0 +1,42 @@ +{ + "name": "@openapitools/typescript-echo-api", + "version": "1.0.0", + "description": "OpenAPI client for @openapitools/typescript-echo-api", + "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": { + "whatwg-fetch": "^3.0.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/client/echo_api/typescript/build/rxjsStub.ts b/samples/client/echo_api/typescript/build/rxjsStub.ts new file mode 100644 index 000000000000..4c73715a2486 --- /dev/null +++ b/samples/client/echo_api/typescript/build/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/client/echo_api/typescript/build/servers.ts b/samples/client/echo_api/typescript/build/servers.ts new file mode 100644 index 000000000000..b52dff31fba1 --- /dev/null +++ b/samples/client/echo_api/typescript/build/servers.ts @@ -0,0 +1,54 @@ +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, value] of Object.entries(this.variableConfiguration)) { + replacedUrl = replacedUrl.replaceAll(`{${key}}`, value); + } + 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<{ }>("http://localhost:3000", { }) + +export const servers = [server1]; diff --git a/samples/client/echo_api/typescript/build/tsconfig.json b/samples/client/echo_api/typescript/build/tsconfig.json new file mode 100644 index 000000000000..b5f1ee70e9cb --- /dev/null +++ b/samples/client/echo_api/typescript/build/tsconfig.json @@ -0,0 +1,36 @@ +{ + "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. */ + "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + + "removeComments": true, + "sourceMap": true, + "outDir": "./dist", + "noLib": false, + "lib": [ + "es6" + ,"ES2017.Object" + ,"ES2021.String" + ,"dom" + ], + }, + "exclude": [ + "dist", + "node_modules" + ], + "filesGlob": [ + "./**/*.ts", + ] +} diff --git a/samples/client/echo_api/typescript/build/types/ObjectParamAPI.ts b/samples/client/echo_api/typescript/build/types/ObjectParamAPI.ts new file mode 100644 index 000000000000..1d76035410ae --- /dev/null +++ b/samples/client/echo_api/typescript/build/types/ObjectParamAPI.ts @@ -0,0 +1,948 @@ +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; +import { Configuration} from '../configuration' + +import { Bird } from '../models/Bird'; +import { Category } from '../models/Category'; +import { DataQuery } from '../models/DataQuery'; +import { DefaultValue } from '../models/DefaultValue'; +import { NumberPropertiesOnly } from '../models/NumberPropertiesOnly'; +import { Pet } from '../models/Pet'; +import { Query } from '../models/Query'; +import { StringEnumRef } from '../models/StringEnumRef'; +import { Tag } from '../models/Tag'; +import { TestFormObjectMultipartRequestMarker } from '../models/TestFormObjectMultipartRequestMarker'; +import { TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter } from '../models/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter'; +import { TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter } from '../models/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter'; + +import { ObservableAuthApi } from "./ObservableAPI"; +import { AuthApiRequestFactory, AuthApiResponseProcessor} from "../apis/AuthApi"; + +export interface AuthApiTestAuthHttpBasicRequest { +} + +export interface AuthApiTestAuthHttpBearerRequest { +} + +export class ObjectAuthApi { + private api: ObservableAuthApi + + public constructor(configuration: Configuration, requestFactory?: AuthApiRequestFactory, responseProcessor?: AuthApiResponseProcessor) { + this.api = new ObservableAuthApi(configuration, requestFactory, responseProcessor); + } + + /** + * To test HTTP basic authentication + * To test HTTP basic authentication + * @param param the request object + */ + public testAuthHttpBasicWithHttpInfo(param: AuthApiTestAuthHttpBasicRequest = {}, options?: Configuration): Promise> { + return this.api.testAuthHttpBasicWithHttpInfo( options).toPromise(); + } + + /** + * To test HTTP basic authentication + * To test HTTP basic authentication + * @param param the request object + */ + public testAuthHttpBasic(param: AuthApiTestAuthHttpBasicRequest = {}, options?: Configuration): Promise { + return this.api.testAuthHttpBasic( options).toPromise(); + } + + /** + * To test HTTP bearer authentication + * To test HTTP bearer authentication + * @param param the request object + */ + public testAuthHttpBearerWithHttpInfo(param: AuthApiTestAuthHttpBearerRequest = {}, options?: Configuration): Promise> { + return this.api.testAuthHttpBearerWithHttpInfo( options).toPromise(); + } + + /** + * To test HTTP bearer authentication + * To test HTTP bearer authentication + * @param param the request object + */ + public testAuthHttpBearer(param: AuthApiTestAuthHttpBearerRequest = {}, options?: Configuration): Promise { + return this.api.testAuthHttpBearer( options).toPromise(); + } + +} + +import { ObservableBodyApi } from "./ObservableAPI"; +import { BodyApiRequestFactory, BodyApiResponseProcessor} from "../apis/BodyApi"; + +export interface BodyApiTestBinaryGifRequest { +} + +export interface BodyApiTestBodyApplicationOctetstreamBinaryRequest { + /** + * + * @type HttpFile + * @memberof BodyApitestBodyApplicationOctetstreamBinary + */ + body?: HttpFile +} + +export interface BodyApiTestBodyMultipartFormdataArrayOfBinaryRequest { + /** + * + * Defaults to: undefined + * @type Array<HttpFile> + * @memberof BodyApitestBodyMultipartFormdataArrayOfBinary + */ + files: Array +} + +export interface BodyApiTestBodyMultipartFormdataSingleBinaryRequest { + /** + * + * Defaults to: undefined + * @type HttpFile + * @memberof BodyApitestBodyMultipartFormdataSingleBinary + */ + myFile?: HttpFile +} + +export interface BodyApiTestEchoBodyAllOfPetRequest { + /** + * Pet object that needs to be added to the store + * @type Pet + * @memberof BodyApitestEchoBodyAllOfPet + */ + pet?: Pet +} + +export interface BodyApiTestEchoBodyFreeFormObjectResponseStringRequest { + /** + * Free form object + * @type any + * @memberof BodyApitestEchoBodyFreeFormObjectResponseString + */ + body?: any +} + +export interface BodyApiTestEchoBodyPetRequest { + /** + * Pet object that needs to be added to the store + * @type Pet + * @memberof BodyApitestEchoBodyPet + */ + pet?: Pet +} + +export interface BodyApiTestEchoBodyPetResponseStringRequest { + /** + * Pet object that needs to be added to the store + * @type Pet + * @memberof BodyApitestEchoBodyPetResponseString + */ + pet?: Pet +} + +export interface BodyApiTestEchoBodyStringEnumRequest { + /** + * String enum + * @type string + * @memberof BodyApitestEchoBodyStringEnum + */ + body?: string +} + +export interface BodyApiTestEchoBodyTagResponseStringRequest { + /** + * Tag object + * @type Tag + * @memberof BodyApitestEchoBodyTagResponseString + */ + tag?: Tag +} + +export class ObjectBodyApi { + private api: ObservableBodyApi + + public constructor(configuration: Configuration, requestFactory?: BodyApiRequestFactory, responseProcessor?: BodyApiResponseProcessor) { + this.api = new ObservableBodyApi(configuration, requestFactory, responseProcessor); + } + + /** + * Test binary (gif) response body + * Test binary (gif) response body + * @param param the request object + */ + public testBinaryGifWithHttpInfo(param: BodyApiTestBinaryGifRequest = {}, options?: Configuration): Promise> { + return this.api.testBinaryGifWithHttpInfo( options).toPromise(); + } + + /** + * Test binary (gif) response body + * Test binary (gif) response body + * @param param the request object + */ + public testBinaryGif(param: BodyApiTestBinaryGifRequest = {}, options?: Configuration): Promise { + return this.api.testBinaryGif( options).toPromise(); + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param param the request object + */ + public testBodyApplicationOctetstreamBinaryWithHttpInfo(param: BodyApiTestBodyApplicationOctetstreamBinaryRequest = {}, options?: Configuration): Promise> { + return this.api.testBodyApplicationOctetstreamBinaryWithHttpInfo(param.body, options).toPromise(); + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param param the request object + */ + public testBodyApplicationOctetstreamBinary(param: BodyApiTestBodyApplicationOctetstreamBinaryRequest = {}, options?: Configuration): Promise { + return this.api.testBodyApplicationOctetstreamBinary(param.body, options).toPromise(); + } + + /** + * Test array of binary in multipart mime + * Test array of binary in multipart mime + * @param param the request object + */ + public testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(param: BodyApiTestBodyMultipartFormdataArrayOfBinaryRequest, options?: Configuration): Promise> { + return this.api.testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(param.files, options).toPromise(); + } + + /** + * Test array of binary in multipart mime + * Test array of binary in multipart mime + * @param param the request object + */ + public testBodyMultipartFormdataArrayOfBinary(param: BodyApiTestBodyMultipartFormdataArrayOfBinaryRequest, options?: Configuration): Promise { + return this.api.testBodyMultipartFormdataArrayOfBinary(param.files, options).toPromise(); + } + + /** + * Test single binary in multipart mime + * Test single binary in multipart mime + * @param param the request object + */ + public testBodyMultipartFormdataSingleBinaryWithHttpInfo(param: BodyApiTestBodyMultipartFormdataSingleBinaryRequest = {}, options?: Configuration): Promise> { + return this.api.testBodyMultipartFormdataSingleBinaryWithHttpInfo(param.myFile, options).toPromise(); + } + + /** + * Test single binary in multipart mime + * Test single binary in multipart mime + * @param param the request object + */ + public testBodyMultipartFormdataSingleBinary(param: BodyApiTestBodyMultipartFormdataSingleBinaryRequest = {}, options?: Configuration): Promise { + return this.api.testBodyMultipartFormdataSingleBinary(param.myFile, options).toPromise(); + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param param the request object + */ + public testEchoBodyAllOfPetWithHttpInfo(param: BodyApiTestEchoBodyAllOfPetRequest = {}, options?: Configuration): Promise> { + return this.api.testEchoBodyAllOfPetWithHttpInfo(param.pet, options).toPromise(); + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param param the request object + */ + public testEchoBodyAllOfPet(param: BodyApiTestEchoBodyAllOfPetRequest = {}, options?: Configuration): Promise { + return this.api.testEchoBodyAllOfPet(param.pet, options).toPromise(); + } + + /** + * Test free form object + * Test free form object + * @param param the request object + */ + public testEchoBodyFreeFormObjectResponseStringWithHttpInfo(param: BodyApiTestEchoBodyFreeFormObjectResponseStringRequest = {}, options?: Configuration): Promise> { + return this.api.testEchoBodyFreeFormObjectResponseStringWithHttpInfo(param.body, options).toPromise(); + } + + /** + * Test free form object + * Test free form object + * @param param the request object + */ + public testEchoBodyFreeFormObjectResponseString(param: BodyApiTestEchoBodyFreeFormObjectResponseStringRequest = {}, options?: Configuration): Promise { + return this.api.testEchoBodyFreeFormObjectResponseString(param.body, options).toPromise(); + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param param the request object + */ + public testEchoBodyPetWithHttpInfo(param: BodyApiTestEchoBodyPetRequest = {}, options?: Configuration): Promise> { + return this.api.testEchoBodyPetWithHttpInfo(param.pet, options).toPromise(); + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param param the request object + */ + public testEchoBodyPet(param: BodyApiTestEchoBodyPetRequest = {}, options?: Configuration): Promise { + return this.api.testEchoBodyPet(param.pet, options).toPromise(); + } + + /** + * Test empty response body + * Test empty response body + * @param param the request object + */ + public testEchoBodyPetResponseStringWithHttpInfo(param: BodyApiTestEchoBodyPetResponseStringRequest = {}, options?: Configuration): Promise> { + return this.api.testEchoBodyPetResponseStringWithHttpInfo(param.pet, options).toPromise(); + } + + /** + * Test empty response body + * Test empty response body + * @param param the request object + */ + public testEchoBodyPetResponseString(param: BodyApiTestEchoBodyPetResponseStringRequest = {}, options?: Configuration): Promise { + return this.api.testEchoBodyPetResponseString(param.pet, options).toPromise(); + } + + /** + * Test string enum response body + * Test string enum response body + * @param param the request object + */ + public testEchoBodyStringEnumWithHttpInfo(param: BodyApiTestEchoBodyStringEnumRequest = {}, options?: Configuration): Promise> { + return this.api.testEchoBodyStringEnumWithHttpInfo(param.body, options).toPromise(); + } + + /** + * Test string enum response body + * Test string enum response body + * @param param the request object + */ + public testEchoBodyStringEnum(param: BodyApiTestEchoBodyStringEnumRequest = {}, options?: Configuration): Promise { + return this.api.testEchoBodyStringEnum(param.body, options).toPromise(); + } + + /** + * Test empty json (request body) + * Test empty json (request body) + * @param param the request object + */ + public testEchoBodyTagResponseStringWithHttpInfo(param: BodyApiTestEchoBodyTagResponseStringRequest = {}, options?: Configuration): Promise> { + return this.api.testEchoBodyTagResponseStringWithHttpInfo(param.tag, options).toPromise(); + } + + /** + * Test empty json (request body) + * Test empty json (request body) + * @param param the request object + */ + public testEchoBodyTagResponseString(param: BodyApiTestEchoBodyTagResponseStringRequest = {}, options?: Configuration): Promise { + return this.api.testEchoBodyTagResponseString(param.tag, options).toPromise(); + } + +} + +import { ObservableFormApi } from "./ObservableAPI"; +import { FormApiRequestFactory, FormApiResponseProcessor} from "../apis/FormApi"; + +export interface FormApiTestFormIntegerBooleanStringRequest { + /** + * + * Defaults to: undefined + * @type number + * @memberof FormApitestFormIntegerBooleanString + */ + integerForm?: number + /** + * + * Defaults to: undefined + * @type boolean + * @memberof FormApitestFormIntegerBooleanString + */ + booleanForm?: boolean + /** + * + * Defaults to: undefined + * @type string + * @memberof FormApitestFormIntegerBooleanString + */ + stringForm?: string +} + +export interface FormApiTestFormObjectMultipartRequest { + /** + * + * Defaults to: undefined + * @type TestFormObjectMultipartRequestMarker + * @memberof FormApitestFormObjectMultipart + */ + marker: TestFormObjectMultipartRequestMarker +} + +export interface FormApiTestFormOneofRequest { + /** + * + * Defaults to: undefined + * @type string + * @memberof FormApitestFormOneof + */ + form1?: string + /** + * + * Defaults to: undefined + * @type number + * @memberof FormApitestFormOneof + */ + form2?: number + /** + * + * Defaults to: undefined + * @type string + * @memberof FormApitestFormOneof + */ + form3?: string + /** + * + * Defaults to: undefined + * @type boolean + * @memberof FormApitestFormOneof + */ + form4?: boolean + /** + * + * Defaults to: undefined + * @type number + * @memberof FormApitestFormOneof + */ + id?: number + /** + * + * Defaults to: undefined + * @type string + * @memberof FormApitestFormOneof + */ + name?: string +} + +export class ObjectFormApi { + private api: ObservableFormApi + + public constructor(configuration: Configuration, requestFactory?: FormApiRequestFactory, responseProcessor?: FormApiResponseProcessor) { + this.api = new ObservableFormApi(configuration, requestFactory, responseProcessor); + } + + /** + * Test form parameter(s) + * Test form parameter(s) + * @param param the request object + */ + public testFormIntegerBooleanStringWithHttpInfo(param: FormApiTestFormIntegerBooleanStringRequest = {}, options?: Configuration): Promise> { + return this.api.testFormIntegerBooleanStringWithHttpInfo(param.integerForm, param.booleanForm, param.stringForm, options).toPromise(); + } + + /** + * Test form parameter(s) + * Test form parameter(s) + * @param param the request object + */ + public testFormIntegerBooleanString(param: FormApiTestFormIntegerBooleanStringRequest = {}, options?: Configuration): Promise { + return this.api.testFormIntegerBooleanString(param.integerForm, param.booleanForm, param.stringForm, options).toPromise(); + } + + /** + * Test form parameter(s) for multipart schema + * Test form parameter(s) for multipart schema + * @param param the request object + */ + public testFormObjectMultipartWithHttpInfo(param: FormApiTestFormObjectMultipartRequest, options?: Configuration): Promise> { + return this.api.testFormObjectMultipartWithHttpInfo(param.marker, options).toPromise(); + } + + /** + * Test form parameter(s) for multipart schema + * Test form parameter(s) for multipart schema + * @param param the request object + */ + public testFormObjectMultipart(param: FormApiTestFormObjectMultipartRequest, options?: Configuration): Promise { + return this.api.testFormObjectMultipart(param.marker, options).toPromise(); + } + + /** + * Test form parameter(s) for oneOf schema + * Test form parameter(s) for oneOf schema + * @param param the request object + */ + public testFormOneofWithHttpInfo(param: FormApiTestFormOneofRequest = {}, options?: Configuration): Promise> { + return this.api.testFormOneofWithHttpInfo(param.form1, param.form2, param.form3, param.form4, param.id, param.name, options).toPromise(); + } + + /** + * Test form parameter(s) for oneOf schema + * Test form parameter(s) for oneOf schema + * @param param the request object + */ + public testFormOneof(param: FormApiTestFormOneofRequest = {}, options?: Configuration): Promise { + return this.api.testFormOneof(param.form1, param.form2, param.form3, param.form4, param.id, param.name, options).toPromise(); + } + +} + +import { ObservableHeaderApi } from "./ObservableAPI"; +import { HeaderApiRequestFactory, HeaderApiResponseProcessor} from "../apis/HeaderApi"; + +export interface HeaderApiTestHeaderIntegerBooleanStringEnumsRequest { + /** + * + * Defaults to: undefined + * @type number + * @memberof HeaderApitestHeaderIntegerBooleanStringEnums + */ + integerHeader?: number + /** + * + * Defaults to: undefined + * @type boolean + * @memberof HeaderApitestHeaderIntegerBooleanStringEnums + */ + booleanHeader?: boolean + /** + * + * Defaults to: undefined + * @type string + * @memberof HeaderApitestHeaderIntegerBooleanStringEnums + */ + stringHeader?: string + /** + * + * Defaults to: undefined + * @type 'success' | 'failure' | 'unclassified' + * @memberof HeaderApitestHeaderIntegerBooleanStringEnums + */ + enumNonrefStringHeader?: 'success' | 'failure' | 'unclassified' + /** + * + * Defaults to: undefined + * @type StringEnumRef + * @memberof HeaderApitestHeaderIntegerBooleanStringEnums + */ + enumRefStringHeader?: StringEnumRef +} + +export class ObjectHeaderApi { + private api: ObservableHeaderApi + + public constructor(configuration: Configuration, requestFactory?: HeaderApiRequestFactory, responseProcessor?: HeaderApiResponseProcessor) { + this.api = new ObservableHeaderApi(configuration, requestFactory, responseProcessor); + } + + /** + * Test header parameter(s) + * Test header parameter(s) + * @param param the request object + */ + public testHeaderIntegerBooleanStringEnumsWithHttpInfo(param: HeaderApiTestHeaderIntegerBooleanStringEnumsRequest = {}, options?: Configuration): Promise> { + return this.api.testHeaderIntegerBooleanStringEnumsWithHttpInfo(param.integerHeader, param.booleanHeader, param.stringHeader, param.enumNonrefStringHeader, param.enumRefStringHeader, options).toPromise(); + } + + /** + * Test header parameter(s) + * Test header parameter(s) + * @param param the request object + */ + public testHeaderIntegerBooleanStringEnums(param: HeaderApiTestHeaderIntegerBooleanStringEnumsRequest = {}, options?: Configuration): Promise { + return this.api.testHeaderIntegerBooleanStringEnums(param.integerHeader, param.booleanHeader, param.stringHeader, param.enumNonrefStringHeader, param.enumRefStringHeader, options).toPromise(); + } + +} + +import { ObservablePathApi } from "./ObservableAPI"; +import { PathApiRequestFactory, PathApiResponseProcessor} from "../apis/PathApi"; + +export interface PathApiTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequest { + /** + * + * Defaults to: undefined + * @type string + * @memberof PathApitestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath + */ + pathString: string + /** + * + * Defaults to: undefined + * @type number + * @memberof PathApitestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath + */ + pathInteger: number + /** + * + * Defaults to: undefined + * @type 'success' | 'failure' | 'unclassified' + * @memberof PathApitestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath + */ + enumNonrefStringPath: 'success' | 'failure' | 'unclassified' + /** + * + * Defaults to: undefined + * @type StringEnumRef + * @memberof PathApitestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath + */ + enumRefStringPath: StringEnumRef +} + +export class ObjectPathApi { + private api: ObservablePathApi + + public constructor(configuration: Configuration, requestFactory?: PathApiRequestFactory, responseProcessor?: PathApiResponseProcessor) { + this.api = new ObservablePathApi(configuration, requestFactory, responseProcessor); + } + + /** + * Test path parameter(s) + * Test path parameter(s) + * @param param the request object + */ + public testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(param: PathApiTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequest, options?: Configuration): Promise> { + return this.api.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(param.pathString, param.pathInteger, param.enumNonrefStringPath, param.enumRefStringPath, options).toPromise(); + } + + /** + * Test path parameter(s) + * Test path parameter(s) + * @param param the request object + */ + public testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(param: PathApiTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequest, options?: Configuration): Promise { + return this.api.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(param.pathString, param.pathInteger, param.enumNonrefStringPath, param.enumRefStringPath, options).toPromise(); + } + +} + +import { ObservableQueryApi } from "./ObservableAPI"; +import { QueryApiRequestFactory, QueryApiResponseProcessor} from "../apis/QueryApi"; + +export interface QueryApiTestEnumRefStringRequest { + /** + * + * Defaults to: undefined + * @type 'success' | 'failure' | 'unclassified' + * @memberof QueryApitestEnumRefString + */ + enumNonrefStringQuery?: 'success' | 'failure' | 'unclassified' + /** + * + * Defaults to: undefined + * @type StringEnumRef + * @memberof QueryApitestEnumRefString + */ + enumRefStringQuery?: StringEnumRef +} + +export interface QueryApiTestQueryDatetimeDateStringRequest { + /** + * + * Defaults to: undefined + * @type Date + * @memberof QueryApitestQueryDatetimeDateString + */ + datetimeQuery?: Date + /** + * + * Defaults to: undefined + * @type string + * @memberof QueryApitestQueryDatetimeDateString + */ + dateQuery?: string + /** + * + * Defaults to: undefined + * @type string + * @memberof QueryApitestQueryDatetimeDateString + */ + stringQuery?: string +} + +export interface QueryApiTestQueryIntegerBooleanStringRequest { + /** + * + * Defaults to: undefined + * @type number + * @memberof QueryApitestQueryIntegerBooleanString + */ + integerQuery?: number + /** + * + * Defaults to: undefined + * @type boolean + * @memberof QueryApitestQueryIntegerBooleanString + */ + booleanQuery?: boolean + /** + * + * Defaults to: undefined + * @type string + * @memberof QueryApitestQueryIntegerBooleanString + */ + stringQuery?: string +} + +export interface QueryApiTestQueryStyleDeepObjectExplodeTrueObjectRequest { + /** + * + * Defaults to: undefined + * @type Pet + * @memberof QueryApitestQueryStyleDeepObjectExplodeTrueObject + */ + queryObject?: Pet +} + +export interface QueryApiTestQueryStyleDeepObjectExplodeTrueObjectAllOfRequest { + /** + * + * Defaults to: undefined + * @type TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + * @memberof QueryApitestQueryStyleDeepObjectExplodeTrueObjectAllOf + */ + queryObject?: TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter +} + +export interface QueryApiTestQueryStyleFormExplodeFalseArrayIntegerRequest { + /** + * + * Defaults to: undefined + * @type Array<number> + * @memberof QueryApitestQueryStyleFormExplodeFalseArrayInteger + */ + queryObject?: Array +} + +export interface QueryApiTestQueryStyleFormExplodeFalseArrayStringRequest { + /** + * + * Defaults to: undefined + * @type Array<string> + * @memberof QueryApitestQueryStyleFormExplodeFalseArrayString + */ + queryObject?: Array +} + +export interface QueryApiTestQueryStyleFormExplodeTrueArrayStringRequest { + /** + * + * Defaults to: undefined + * @type TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + * @memberof QueryApitestQueryStyleFormExplodeTrueArrayString + */ + queryObject?: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter +} + +export interface QueryApiTestQueryStyleFormExplodeTrueObjectRequest { + /** + * + * Defaults to: undefined + * @type Pet + * @memberof QueryApitestQueryStyleFormExplodeTrueObject + */ + queryObject?: Pet +} + +export interface QueryApiTestQueryStyleFormExplodeTrueObjectAllOfRequest { + /** + * + * Defaults to: undefined + * @type DataQuery + * @memberof QueryApitestQueryStyleFormExplodeTrueObjectAllOf + */ + queryObject?: DataQuery +} + +export class ObjectQueryApi { + private api: ObservableQueryApi + + public constructor(configuration: Configuration, requestFactory?: QueryApiRequestFactory, responseProcessor?: QueryApiResponseProcessor) { + this.api = new ObservableQueryApi(configuration, requestFactory, responseProcessor); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param param the request object + */ + public testEnumRefStringWithHttpInfo(param: QueryApiTestEnumRefStringRequest = {}, options?: Configuration): Promise> { + return this.api.testEnumRefStringWithHttpInfo(param.enumNonrefStringQuery, param.enumRefStringQuery, options).toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param param the request object + */ + public testEnumRefString(param: QueryApiTestEnumRefStringRequest = {}, options?: Configuration): Promise { + return this.api.testEnumRefString(param.enumNonrefStringQuery, param.enumRefStringQuery, options).toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param param the request object + */ + public testQueryDatetimeDateStringWithHttpInfo(param: QueryApiTestQueryDatetimeDateStringRequest = {}, options?: Configuration): Promise> { + return this.api.testQueryDatetimeDateStringWithHttpInfo(param.datetimeQuery, param.dateQuery, param.stringQuery, options).toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param param the request object + */ + public testQueryDatetimeDateString(param: QueryApiTestQueryDatetimeDateStringRequest = {}, options?: Configuration): Promise { + return this.api.testQueryDatetimeDateString(param.datetimeQuery, param.dateQuery, param.stringQuery, options).toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param param the request object + */ + public testQueryIntegerBooleanStringWithHttpInfo(param: QueryApiTestQueryIntegerBooleanStringRequest = {}, options?: Configuration): Promise> { + return this.api.testQueryIntegerBooleanStringWithHttpInfo(param.integerQuery, param.booleanQuery, param.stringQuery, options).toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param param the request object + */ + public testQueryIntegerBooleanString(param: QueryApiTestQueryIntegerBooleanStringRequest = {}, options?: Configuration): Promise { + return this.api.testQueryIntegerBooleanString(param.integerQuery, param.booleanQuery, param.stringQuery, options).toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param param the request object + */ + public testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(param: QueryApiTestQueryStyleDeepObjectExplodeTrueObjectRequest = {}, options?: Configuration): Promise> { + return this.api.testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(param.queryObject, options).toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param param the request object + */ + public testQueryStyleDeepObjectExplodeTrueObject(param: QueryApiTestQueryStyleDeepObjectExplodeTrueObjectRequest = {}, options?: Configuration): Promise { + return this.api.testQueryStyleDeepObjectExplodeTrueObject(param.queryObject, options).toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param param the request object + */ + public testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(param: QueryApiTestQueryStyleDeepObjectExplodeTrueObjectAllOfRequest = {}, options?: Configuration): Promise> { + return this.api.testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(param.queryObject, options).toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param param the request object + */ + public testQueryStyleDeepObjectExplodeTrueObjectAllOf(param: QueryApiTestQueryStyleDeepObjectExplodeTrueObjectAllOfRequest = {}, options?: Configuration): Promise { + return this.api.testQueryStyleDeepObjectExplodeTrueObjectAllOf(param.queryObject, options).toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param param the request object + */ + public testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(param: QueryApiTestQueryStyleFormExplodeFalseArrayIntegerRequest = {}, options?: Configuration): Promise> { + return this.api.testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(param.queryObject, options).toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param param the request object + */ + public testQueryStyleFormExplodeFalseArrayInteger(param: QueryApiTestQueryStyleFormExplodeFalseArrayIntegerRequest = {}, options?: Configuration): Promise { + return this.api.testQueryStyleFormExplodeFalseArrayInteger(param.queryObject, options).toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param param the request object + */ + public testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(param: QueryApiTestQueryStyleFormExplodeFalseArrayStringRequest = {}, options?: Configuration): Promise> { + return this.api.testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(param.queryObject, options).toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param param the request object + */ + public testQueryStyleFormExplodeFalseArrayString(param: QueryApiTestQueryStyleFormExplodeFalseArrayStringRequest = {}, options?: Configuration): Promise { + return this.api.testQueryStyleFormExplodeFalseArrayString(param.queryObject, options).toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param param the request object + */ + public testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(param: QueryApiTestQueryStyleFormExplodeTrueArrayStringRequest = {}, options?: Configuration): Promise> { + return this.api.testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(param.queryObject, options).toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param param the request object + */ + public testQueryStyleFormExplodeTrueArrayString(param: QueryApiTestQueryStyleFormExplodeTrueArrayStringRequest = {}, options?: Configuration): Promise { + return this.api.testQueryStyleFormExplodeTrueArrayString(param.queryObject, options).toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param param the request object + */ + public testQueryStyleFormExplodeTrueObjectWithHttpInfo(param: QueryApiTestQueryStyleFormExplodeTrueObjectRequest = {}, options?: Configuration): Promise> { + return this.api.testQueryStyleFormExplodeTrueObjectWithHttpInfo(param.queryObject, options).toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param param the request object + */ + public testQueryStyleFormExplodeTrueObject(param: QueryApiTestQueryStyleFormExplodeTrueObjectRequest = {}, options?: Configuration): Promise { + return this.api.testQueryStyleFormExplodeTrueObject(param.queryObject, options).toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param param the request object + */ + public testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(param: QueryApiTestQueryStyleFormExplodeTrueObjectAllOfRequest = {}, options?: Configuration): Promise> { + return this.api.testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(param.queryObject, options).toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param param the request object + */ + public testQueryStyleFormExplodeTrueObjectAllOf(param: QueryApiTestQueryStyleFormExplodeTrueObjectAllOfRequest = {}, options?: Configuration): Promise { + return this.api.testQueryStyleFormExplodeTrueObjectAllOf(param.queryObject, options).toPromise(); + } + +} diff --git a/samples/client/echo_api/typescript/build/types/ObservableAPI.ts b/samples/client/echo_api/typescript/build/types/ObservableAPI.ts new file mode 100644 index 000000000000..f42b4599cf67 --- /dev/null +++ b/samples/client/echo_api/typescript/build/types/ObservableAPI.ts @@ -0,0 +1,1047 @@ +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; +import { Configuration} from '../configuration' +import { Observable, of, from } from '../rxjsStub'; +import {mergeMap, map} from '../rxjsStub'; +import { Bird } from '../models/Bird'; +import { Category } from '../models/Category'; +import { DataQuery } from '../models/DataQuery'; +import { DefaultValue } from '../models/DefaultValue'; +import { NumberPropertiesOnly } from '../models/NumberPropertiesOnly'; +import { Pet } from '../models/Pet'; +import { Query } from '../models/Query'; +import { StringEnumRef } from '../models/StringEnumRef'; +import { Tag } from '../models/Tag'; +import { TestFormObjectMultipartRequestMarker } from '../models/TestFormObjectMultipartRequestMarker'; +import { TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter } from '../models/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter'; +import { TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter } from '../models/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter'; + +import { AuthApiRequestFactory, AuthApiResponseProcessor} from "../apis/AuthApi"; +export class ObservableAuthApi { + private requestFactory: AuthApiRequestFactory; + private responseProcessor: AuthApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: AuthApiRequestFactory, + responseProcessor?: AuthApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = requestFactory || new AuthApiRequestFactory(configuration); + this.responseProcessor = responseProcessor || new AuthApiResponseProcessor(); + } + + /** + * To test HTTP basic authentication + * To test HTTP basic authentication + */ + public testAuthHttpBasicWithHttpInfo(_options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testAuthHttpBasic(_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.testAuthHttpBasicWithHttpInfo(rsp))); + })); + } + + /** + * To test HTTP basic authentication + * To test HTTP basic authentication + */ + public testAuthHttpBasic(_options?: Configuration): Observable { + return this.testAuthHttpBasicWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * To test HTTP bearer authentication + * To test HTTP bearer authentication + */ + public testAuthHttpBearerWithHttpInfo(_options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testAuthHttpBearer(_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.testAuthHttpBearerWithHttpInfo(rsp))); + })); + } + + /** + * To test HTTP bearer authentication + * To test HTTP bearer authentication + */ + public testAuthHttpBearer(_options?: Configuration): Observable { + return this.testAuthHttpBearerWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + +} + +import { BodyApiRequestFactory, BodyApiResponseProcessor} from "../apis/BodyApi"; +export class ObservableBodyApi { + private requestFactory: BodyApiRequestFactory; + private responseProcessor: BodyApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: BodyApiRequestFactory, + responseProcessor?: BodyApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = requestFactory || new BodyApiRequestFactory(configuration); + this.responseProcessor = responseProcessor || new BodyApiResponseProcessor(); + } + + /** + * Test binary (gif) response body + * Test binary (gif) response body + */ + public testBinaryGifWithHttpInfo(_options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testBinaryGif(_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.testBinaryGifWithHttpInfo(rsp))); + })); + } + + /** + * Test binary (gif) response body + * Test binary (gif) response body + */ + public testBinaryGif(_options?: Configuration): Observable { + return this.testBinaryGifWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param [body] + */ + public testBodyApplicationOctetstreamBinaryWithHttpInfo(body?: HttpFile, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testBodyApplicationOctetstreamBinary(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.testBodyApplicationOctetstreamBinaryWithHttpInfo(rsp))); + })); + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param [body] + */ + public testBodyApplicationOctetstreamBinary(body?: HttpFile, _options?: Configuration): Observable { + return this.testBodyApplicationOctetstreamBinaryWithHttpInfo(body, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Test array of binary in multipart mime + * Test array of binary in multipart mime + * @param files + */ + public testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files: Array, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testBodyMultipartFormdataArrayOfBinary(files, _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.testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(rsp))); + })); + } + + /** + * Test array of binary in multipart mime + * Test array of binary in multipart mime + * @param files + */ + public testBodyMultipartFormdataArrayOfBinary(files: Array, _options?: Configuration): Observable { + return this.testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Test single binary in multipart mime + * Test single binary in multipart mime + * @param [myFile] + */ + public testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile?: HttpFile, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testBodyMultipartFormdataSingleBinary(myFile, _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.testBodyMultipartFormdataSingleBinaryWithHttpInfo(rsp))); + })); + } + + /** + * Test single binary in multipart mime + * Test single binary in multipart mime + * @param [myFile] + */ + public testBodyMultipartFormdataSingleBinary(myFile?: HttpFile, _options?: Configuration): Observable { + return this.testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param [pet] Pet object that needs to be added to the store + */ + public testEchoBodyAllOfPetWithHttpInfo(pet?: Pet, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testEchoBodyAllOfPet(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.testEchoBodyAllOfPetWithHttpInfo(rsp))); + })); + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param [pet] Pet object that needs to be added to the store + */ + public testEchoBodyAllOfPet(pet?: Pet, _options?: Configuration): Observable { + return this.testEchoBodyAllOfPetWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Test free form object + * Test free form object + * @param [body] Free form object + */ + public testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body?: any, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testEchoBodyFreeFormObjectResponseString(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.testEchoBodyFreeFormObjectResponseStringWithHttpInfo(rsp))); + })); + } + + /** + * Test free form object + * Test free form object + * @param [body] Free form object + */ + public testEchoBodyFreeFormObjectResponseString(body?: any, _options?: Configuration): Observable { + return this.testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param [pet] Pet object that needs to be added to the store + */ + public testEchoBodyPetWithHttpInfo(pet?: Pet, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testEchoBodyPet(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.testEchoBodyPetWithHttpInfo(rsp))); + })); + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param [pet] Pet object that needs to be added to the store + */ + public testEchoBodyPet(pet?: Pet, _options?: Configuration): Observable { + return this.testEchoBodyPetWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Test empty response body + * Test empty response body + * @param [pet] Pet object that needs to be added to the store + */ + public testEchoBodyPetResponseStringWithHttpInfo(pet?: Pet, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testEchoBodyPetResponseString(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.testEchoBodyPetResponseStringWithHttpInfo(rsp))); + })); + } + + /** + * Test empty response body + * Test empty response body + * @param [pet] Pet object that needs to be added to the store + */ + public testEchoBodyPetResponseString(pet?: Pet, _options?: Configuration): Observable { + return this.testEchoBodyPetResponseStringWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Test string enum response body + * Test string enum response body + * @param [body] String enum + */ + public testEchoBodyStringEnumWithHttpInfo(body?: string, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testEchoBodyStringEnum(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.testEchoBodyStringEnumWithHttpInfo(rsp))); + })); + } + + /** + * Test string enum response body + * Test string enum response body + * @param [body] String enum + */ + public testEchoBodyStringEnum(body?: string, _options?: Configuration): Observable { + return this.testEchoBodyStringEnumWithHttpInfo(body, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Test empty json (request body) + * Test empty json (request body) + * @param [tag] Tag object + */ + public testEchoBodyTagResponseStringWithHttpInfo(tag?: Tag, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testEchoBodyTagResponseString(tag, _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.testEchoBodyTagResponseStringWithHttpInfo(rsp))); + })); + } + + /** + * Test empty json (request body) + * Test empty json (request body) + * @param [tag] Tag object + */ + public testEchoBodyTagResponseString(tag?: Tag, _options?: Configuration): Observable { + return this.testEchoBodyTagResponseStringWithHttpInfo(tag, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + +} + +import { FormApiRequestFactory, FormApiResponseProcessor} from "../apis/FormApi"; +export class ObservableFormApi { + private requestFactory: FormApiRequestFactory; + private responseProcessor: FormApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: FormApiRequestFactory, + responseProcessor?: FormApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = requestFactory || new FormApiRequestFactory(configuration); + this.responseProcessor = responseProcessor || new FormApiResponseProcessor(); + } + + /** + * Test form parameter(s) + * Test form parameter(s) + * @param [integerForm] + * @param [booleanForm] + * @param [stringForm] + */ + public testFormIntegerBooleanStringWithHttpInfo(integerForm?: number, booleanForm?: boolean, stringForm?: string, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testFormIntegerBooleanString(integerForm, booleanForm, stringForm, _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.testFormIntegerBooleanStringWithHttpInfo(rsp))); + })); + } + + /** + * Test form parameter(s) + * Test form parameter(s) + * @param [integerForm] + * @param [booleanForm] + * @param [stringForm] + */ + public testFormIntegerBooleanString(integerForm?: number, booleanForm?: boolean, stringForm?: string, _options?: Configuration): Observable { + return this.testFormIntegerBooleanStringWithHttpInfo(integerForm, booleanForm, stringForm, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Test form parameter(s) for multipart schema + * Test form parameter(s) for multipart schema + * @param marker + */ + public testFormObjectMultipartWithHttpInfo(marker: TestFormObjectMultipartRequestMarker, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testFormObjectMultipart(marker, _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.testFormObjectMultipartWithHttpInfo(rsp))); + })); + } + + /** + * Test form parameter(s) for multipart schema + * Test form parameter(s) for multipart schema + * @param marker + */ + public testFormObjectMultipart(marker: TestFormObjectMultipartRequestMarker, _options?: Configuration): Observable { + return this.testFormObjectMultipartWithHttpInfo(marker, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Test form parameter(s) for oneOf schema + * Test form parameter(s) for oneOf schema + * @param [form1] + * @param [form2] + * @param [form3] + * @param [form4] + * @param [id] + * @param [name] + */ + public testFormOneofWithHttpInfo(form1?: string, form2?: number, form3?: string, form4?: boolean, id?: number, name?: string, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testFormOneof(form1, form2, form3, form4, id, name, _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.testFormOneofWithHttpInfo(rsp))); + })); + } + + /** + * Test form parameter(s) for oneOf schema + * Test form parameter(s) for oneOf schema + * @param [form1] + * @param [form2] + * @param [form3] + * @param [form4] + * @param [id] + * @param [name] + */ + public testFormOneof(form1?: string, form2?: number, form3?: string, form4?: boolean, id?: number, name?: string, _options?: Configuration): Observable { + return this.testFormOneofWithHttpInfo(form1, form2, form3, form4, id, name, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + +} + +import { HeaderApiRequestFactory, HeaderApiResponseProcessor} from "../apis/HeaderApi"; +export class ObservableHeaderApi { + private requestFactory: HeaderApiRequestFactory; + private responseProcessor: HeaderApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: HeaderApiRequestFactory, + responseProcessor?: HeaderApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = requestFactory || new HeaderApiRequestFactory(configuration); + this.responseProcessor = responseProcessor || new HeaderApiResponseProcessor(); + } + + /** + * Test header parameter(s) + * Test header parameter(s) + * @param [integerHeader] + * @param [booleanHeader] + * @param [stringHeader] + * @param [enumNonrefStringHeader] + * @param [enumRefStringHeader] + */ + public testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader?: number, booleanHeader?: boolean, stringHeader?: string, enumNonrefStringHeader?: 'success' | 'failure' | 'unclassified', enumRefStringHeader?: StringEnumRef, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testHeaderIntegerBooleanStringEnums(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader, _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.testHeaderIntegerBooleanStringEnumsWithHttpInfo(rsp))); + })); + } + + /** + * Test header parameter(s) + * Test header parameter(s) + * @param [integerHeader] + * @param [booleanHeader] + * @param [stringHeader] + * @param [enumNonrefStringHeader] + * @param [enumRefStringHeader] + */ + public testHeaderIntegerBooleanStringEnums(integerHeader?: number, booleanHeader?: boolean, stringHeader?: string, enumNonrefStringHeader?: 'success' | 'failure' | 'unclassified', enumRefStringHeader?: StringEnumRef, _options?: Configuration): Observable { + return this.testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + +} + +import { PathApiRequestFactory, PathApiResponseProcessor} from "../apis/PathApi"; +export class ObservablePathApi { + private requestFactory: PathApiRequestFactory; + private responseProcessor: PathApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: PathApiRequestFactory, + responseProcessor?: PathApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = requestFactory || new PathApiRequestFactory(configuration); + this.responseProcessor = responseProcessor || new PathApiResponseProcessor(); + } + + /** + * Test path parameter(s) + * Test path parameter(s) + * @param pathString + * @param pathInteger + * @param enumNonrefStringPath + * @param enumRefStringPath + */ + public testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString: string, pathInteger: number, enumNonrefStringPath: 'success' | 'failure' | 'unclassified', enumRefStringPath: StringEnumRef, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath, _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.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(rsp))); + })); + } + + /** + * Test path parameter(s) + * Test path parameter(s) + * @param pathString + * @param pathInteger + * @param enumNonrefStringPath + * @param enumRefStringPath + */ + public testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString: string, pathInteger: number, enumNonrefStringPath: 'success' | 'failure' | 'unclassified', enumRefStringPath: StringEnumRef, _options?: Configuration): Observable { + return this.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + +} + +import { QueryApiRequestFactory, QueryApiResponseProcessor} from "../apis/QueryApi"; +export class ObservableQueryApi { + private requestFactory: QueryApiRequestFactory; + private responseProcessor: QueryApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: QueryApiRequestFactory, + responseProcessor?: QueryApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = requestFactory || new QueryApiRequestFactory(configuration); + this.responseProcessor = responseProcessor || new QueryApiResponseProcessor(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [enumNonrefStringQuery] + * @param [enumRefStringQuery] + */ + public testEnumRefStringWithHttpInfo(enumNonrefStringQuery?: 'success' | 'failure' | 'unclassified', enumRefStringQuery?: StringEnumRef, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testEnumRefString(enumNonrefStringQuery, enumRefStringQuery, _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.testEnumRefStringWithHttpInfo(rsp))); + })); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [enumNonrefStringQuery] + * @param [enumRefStringQuery] + */ + public testEnumRefString(enumNonrefStringQuery?: 'success' | 'failure' | 'unclassified', enumRefStringQuery?: StringEnumRef, _options?: Configuration): Observable { + return this.testEnumRefStringWithHttpInfo(enumNonrefStringQuery, enumRefStringQuery, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [datetimeQuery] + * @param [dateQuery] + * @param [stringQuery] + */ + public testQueryDatetimeDateStringWithHttpInfo(datetimeQuery?: Date, dateQuery?: string, stringQuery?: string, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testQueryDatetimeDateString(datetimeQuery, dateQuery, stringQuery, _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.testQueryDatetimeDateStringWithHttpInfo(rsp))); + })); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [datetimeQuery] + * @param [dateQuery] + * @param [stringQuery] + */ + public testQueryDatetimeDateString(datetimeQuery?: Date, dateQuery?: string, stringQuery?: string, _options?: Configuration): Observable { + return this.testQueryDatetimeDateStringWithHttpInfo(datetimeQuery, dateQuery, stringQuery, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [integerQuery] + * @param [booleanQuery] + * @param [stringQuery] + */ + public testQueryIntegerBooleanStringWithHttpInfo(integerQuery?: number, booleanQuery?: boolean, stringQuery?: string, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery, _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.testQueryIntegerBooleanStringWithHttpInfo(rsp))); + })); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [integerQuery] + * @param [booleanQuery] + * @param [stringQuery] + */ + public testQueryIntegerBooleanString(integerQuery?: number, booleanQuery?: boolean, stringQuery?: string, _options?: Configuration): Observable { + return this.testQueryIntegerBooleanStringWithHttpInfo(integerQuery, booleanQuery, stringQuery, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + public testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject?: Pet, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testQueryStyleDeepObjectExplodeTrueObject(queryObject, _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.testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(rsp))); + })); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + public testQueryStyleDeepObjectExplodeTrueObject(queryObject?: Pet, _options?: Configuration): Observable { + return this.testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + public testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(queryObject?: TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testQueryStyleDeepObjectExplodeTrueObjectAllOf(queryObject, _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.testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(rsp))); + })); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + public testQueryStyleDeepObjectExplodeTrueObjectAllOf(queryObject?: TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter, _options?: Configuration): Observable { + return this.testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(queryObject, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + public testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(queryObject?: Array, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testQueryStyleFormExplodeFalseArrayInteger(queryObject, _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.testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(rsp))); + })); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + public testQueryStyleFormExplodeFalseArrayInteger(queryObject?: Array, _options?: Configuration): Observable { + return this.testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(queryObject, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + public testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(queryObject?: Array, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testQueryStyleFormExplodeFalseArrayString(queryObject, _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.testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(rsp))); + })); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + public testQueryStyleFormExplodeFalseArrayString(queryObject?: Array, _options?: Configuration): Observable { + return this.testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(queryObject, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + public testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject?: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testQueryStyleFormExplodeTrueArrayString(queryObject, _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.testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(rsp))); + })); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + public testQueryStyleFormExplodeTrueArrayString(queryObject?: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter, _options?: Configuration): Observable { + return this.testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + public testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject?: Pet, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testQueryStyleFormExplodeTrueObject(queryObject, _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.testQueryStyleFormExplodeTrueObjectWithHttpInfo(rsp))); + })); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + public testQueryStyleFormExplodeTrueObject(queryObject?: Pet, _options?: Configuration): Observable { + return this.testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + public testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(queryObject?: DataQuery, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testQueryStyleFormExplodeTrueObjectAllOf(queryObject, _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.testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(rsp))); + })); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + public testQueryStyleFormExplodeTrueObjectAllOf(queryObject?: DataQuery, _options?: Configuration): Observable { + return this.testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(queryObject, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + +} diff --git a/samples/client/echo_api/typescript/build/types/PromiseAPI.ts b/samples/client/echo_api/typescript/build/types/PromiseAPI.ts new file mode 100644 index 000000000000..a0fde7619715 --- /dev/null +++ b/samples/client/echo_api/typescript/build/types/PromiseAPI.ts @@ -0,0 +1,701 @@ +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; +import { Configuration} from '../configuration' + +import { Bird } from '../models/Bird'; +import { Category } from '../models/Category'; +import { DataQuery } from '../models/DataQuery'; +import { DefaultValue } from '../models/DefaultValue'; +import { NumberPropertiesOnly } from '../models/NumberPropertiesOnly'; +import { Pet } from '../models/Pet'; +import { Query } from '../models/Query'; +import { StringEnumRef } from '../models/StringEnumRef'; +import { Tag } from '../models/Tag'; +import { TestFormObjectMultipartRequestMarker } from '../models/TestFormObjectMultipartRequestMarker'; +import { TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter } from '../models/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter'; +import { TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter } from '../models/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter'; +import { ObservableAuthApi } from './ObservableAPI'; + +import { AuthApiRequestFactory, AuthApiResponseProcessor} from "../apis/AuthApi"; +export class PromiseAuthApi { + private api: ObservableAuthApi + + public constructor( + configuration: Configuration, + requestFactory?: AuthApiRequestFactory, + responseProcessor?: AuthApiResponseProcessor + ) { + this.api = new ObservableAuthApi(configuration, requestFactory, responseProcessor); + } + + /** + * To test HTTP basic authentication + * To test HTTP basic authentication + */ + public testAuthHttpBasicWithHttpInfo(_options?: Configuration): Promise> { + const result = this.api.testAuthHttpBasicWithHttpInfo(_options); + return result.toPromise(); + } + + /** + * To test HTTP basic authentication + * To test HTTP basic authentication + */ + public testAuthHttpBasic(_options?: Configuration): Promise { + const result = this.api.testAuthHttpBasic(_options); + return result.toPromise(); + } + + /** + * To test HTTP bearer authentication + * To test HTTP bearer authentication + */ + public testAuthHttpBearerWithHttpInfo(_options?: Configuration): Promise> { + const result = this.api.testAuthHttpBearerWithHttpInfo(_options); + return result.toPromise(); + } + + /** + * To test HTTP bearer authentication + * To test HTTP bearer authentication + */ + public testAuthHttpBearer(_options?: Configuration): Promise { + const result = this.api.testAuthHttpBearer(_options); + return result.toPromise(); + } + + +} + + + +import { ObservableBodyApi } from './ObservableAPI'; + +import { BodyApiRequestFactory, BodyApiResponseProcessor} from "../apis/BodyApi"; +export class PromiseBodyApi { + private api: ObservableBodyApi + + public constructor( + configuration: Configuration, + requestFactory?: BodyApiRequestFactory, + responseProcessor?: BodyApiResponseProcessor + ) { + this.api = new ObservableBodyApi(configuration, requestFactory, responseProcessor); + } + + /** + * Test binary (gif) response body + * Test binary (gif) response body + */ + public testBinaryGifWithHttpInfo(_options?: Configuration): Promise> { + const result = this.api.testBinaryGifWithHttpInfo(_options); + return result.toPromise(); + } + + /** + * Test binary (gif) response body + * Test binary (gif) response body + */ + public testBinaryGif(_options?: Configuration): Promise { + const result = this.api.testBinaryGif(_options); + return result.toPromise(); + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param [body] + */ + public testBodyApplicationOctetstreamBinaryWithHttpInfo(body?: HttpFile, _options?: Configuration): Promise> { + const result = this.api.testBodyApplicationOctetstreamBinaryWithHttpInfo(body, _options); + return result.toPromise(); + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param [body] + */ + public testBodyApplicationOctetstreamBinary(body?: HttpFile, _options?: Configuration): Promise { + const result = this.api.testBodyApplicationOctetstreamBinary(body, _options); + return result.toPromise(); + } + + /** + * Test array of binary in multipart mime + * Test array of binary in multipart mime + * @param files + */ + public testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files: Array, _options?: Configuration): Promise> { + const result = this.api.testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files, _options); + return result.toPromise(); + } + + /** + * Test array of binary in multipart mime + * Test array of binary in multipart mime + * @param files + */ + public testBodyMultipartFormdataArrayOfBinary(files: Array, _options?: Configuration): Promise { + const result = this.api.testBodyMultipartFormdataArrayOfBinary(files, _options); + return result.toPromise(); + } + + /** + * Test single binary in multipart mime + * Test single binary in multipart mime + * @param [myFile] + */ + public testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile?: HttpFile, _options?: Configuration): Promise> { + const result = this.api.testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile, _options); + return result.toPromise(); + } + + /** + * Test single binary in multipart mime + * Test single binary in multipart mime + * @param [myFile] + */ + public testBodyMultipartFormdataSingleBinary(myFile?: HttpFile, _options?: Configuration): Promise { + const result = this.api.testBodyMultipartFormdataSingleBinary(myFile, _options); + return result.toPromise(); + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param [pet] Pet object that needs to be added to the store + */ + public testEchoBodyAllOfPetWithHttpInfo(pet?: Pet, _options?: Configuration): Promise> { + const result = this.api.testEchoBodyAllOfPetWithHttpInfo(pet, _options); + return result.toPromise(); + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param [pet] Pet object that needs to be added to the store + */ + public testEchoBodyAllOfPet(pet?: Pet, _options?: Configuration): Promise { + const result = this.api.testEchoBodyAllOfPet(pet, _options); + return result.toPromise(); + } + + /** + * Test free form object + * Test free form object + * @param [body] Free form object + */ + public testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body?: any, _options?: Configuration): Promise> { + const result = this.api.testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body, _options); + return result.toPromise(); + } + + /** + * Test free form object + * Test free form object + * @param [body] Free form object + */ + public testEchoBodyFreeFormObjectResponseString(body?: any, _options?: Configuration): Promise { + const result = this.api.testEchoBodyFreeFormObjectResponseString(body, _options); + return result.toPromise(); + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param [pet] Pet object that needs to be added to the store + */ + public testEchoBodyPetWithHttpInfo(pet?: Pet, _options?: Configuration): Promise> { + const result = this.api.testEchoBodyPetWithHttpInfo(pet, _options); + return result.toPromise(); + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param [pet] Pet object that needs to be added to the store + */ + public testEchoBodyPet(pet?: Pet, _options?: Configuration): Promise { + const result = this.api.testEchoBodyPet(pet, _options); + return result.toPromise(); + } + + /** + * Test empty response body + * Test empty response body + * @param [pet] Pet object that needs to be added to the store + */ + public testEchoBodyPetResponseStringWithHttpInfo(pet?: Pet, _options?: Configuration): Promise> { + const result = this.api.testEchoBodyPetResponseStringWithHttpInfo(pet, _options); + return result.toPromise(); + } + + /** + * Test empty response body + * Test empty response body + * @param [pet] Pet object that needs to be added to the store + */ + public testEchoBodyPetResponseString(pet?: Pet, _options?: Configuration): Promise { + const result = this.api.testEchoBodyPetResponseString(pet, _options); + return result.toPromise(); + } + + /** + * Test string enum response body + * Test string enum response body + * @param [body] String enum + */ + public testEchoBodyStringEnumWithHttpInfo(body?: string, _options?: Configuration): Promise> { + const result = this.api.testEchoBodyStringEnumWithHttpInfo(body, _options); + return result.toPromise(); + } + + /** + * Test string enum response body + * Test string enum response body + * @param [body] String enum + */ + public testEchoBodyStringEnum(body?: string, _options?: Configuration): Promise { + const result = this.api.testEchoBodyStringEnum(body, _options); + return result.toPromise(); + } + + /** + * Test empty json (request body) + * Test empty json (request body) + * @param [tag] Tag object + */ + public testEchoBodyTagResponseStringWithHttpInfo(tag?: Tag, _options?: Configuration): Promise> { + const result = this.api.testEchoBodyTagResponseStringWithHttpInfo(tag, _options); + return result.toPromise(); + } + + /** + * Test empty json (request body) + * Test empty json (request body) + * @param [tag] Tag object + */ + public testEchoBodyTagResponseString(tag?: Tag, _options?: Configuration): Promise { + const result = this.api.testEchoBodyTagResponseString(tag, _options); + return result.toPromise(); + } + + +} + + + +import { ObservableFormApi } from './ObservableAPI'; + +import { FormApiRequestFactory, FormApiResponseProcessor} from "../apis/FormApi"; +export class PromiseFormApi { + private api: ObservableFormApi + + public constructor( + configuration: Configuration, + requestFactory?: FormApiRequestFactory, + responseProcessor?: FormApiResponseProcessor + ) { + this.api = new ObservableFormApi(configuration, requestFactory, responseProcessor); + } + + /** + * Test form parameter(s) + * Test form parameter(s) + * @param [integerForm] + * @param [booleanForm] + * @param [stringForm] + */ + public testFormIntegerBooleanStringWithHttpInfo(integerForm?: number, booleanForm?: boolean, stringForm?: string, _options?: Configuration): Promise> { + const result = this.api.testFormIntegerBooleanStringWithHttpInfo(integerForm, booleanForm, stringForm, _options); + return result.toPromise(); + } + + /** + * Test form parameter(s) + * Test form parameter(s) + * @param [integerForm] + * @param [booleanForm] + * @param [stringForm] + */ + public testFormIntegerBooleanString(integerForm?: number, booleanForm?: boolean, stringForm?: string, _options?: Configuration): Promise { + const result = this.api.testFormIntegerBooleanString(integerForm, booleanForm, stringForm, _options); + return result.toPromise(); + } + + /** + * Test form parameter(s) for multipart schema + * Test form parameter(s) for multipart schema + * @param marker + */ + public testFormObjectMultipartWithHttpInfo(marker: TestFormObjectMultipartRequestMarker, _options?: Configuration): Promise> { + const result = this.api.testFormObjectMultipartWithHttpInfo(marker, _options); + return result.toPromise(); + } + + /** + * Test form parameter(s) for multipart schema + * Test form parameter(s) for multipart schema + * @param marker + */ + public testFormObjectMultipart(marker: TestFormObjectMultipartRequestMarker, _options?: Configuration): Promise { + const result = this.api.testFormObjectMultipart(marker, _options); + return result.toPromise(); + } + + /** + * Test form parameter(s) for oneOf schema + * Test form parameter(s) for oneOf schema + * @param [form1] + * @param [form2] + * @param [form3] + * @param [form4] + * @param [id] + * @param [name] + */ + public testFormOneofWithHttpInfo(form1?: string, form2?: number, form3?: string, form4?: boolean, id?: number, name?: string, _options?: Configuration): Promise> { + const result = this.api.testFormOneofWithHttpInfo(form1, form2, form3, form4, id, name, _options); + return result.toPromise(); + } + + /** + * Test form parameter(s) for oneOf schema + * Test form parameter(s) for oneOf schema + * @param [form1] + * @param [form2] + * @param [form3] + * @param [form4] + * @param [id] + * @param [name] + */ + public testFormOneof(form1?: string, form2?: number, form3?: string, form4?: boolean, id?: number, name?: string, _options?: Configuration): Promise { + const result = this.api.testFormOneof(form1, form2, form3, form4, id, name, _options); + return result.toPromise(); + } + + +} + + + +import { ObservableHeaderApi } from './ObservableAPI'; + +import { HeaderApiRequestFactory, HeaderApiResponseProcessor} from "../apis/HeaderApi"; +export class PromiseHeaderApi { + private api: ObservableHeaderApi + + public constructor( + configuration: Configuration, + requestFactory?: HeaderApiRequestFactory, + responseProcessor?: HeaderApiResponseProcessor + ) { + this.api = new ObservableHeaderApi(configuration, requestFactory, responseProcessor); + } + + /** + * Test header parameter(s) + * Test header parameter(s) + * @param [integerHeader] + * @param [booleanHeader] + * @param [stringHeader] + * @param [enumNonrefStringHeader] + * @param [enumRefStringHeader] + */ + public testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader?: number, booleanHeader?: boolean, stringHeader?: string, enumNonrefStringHeader?: 'success' | 'failure' | 'unclassified', enumRefStringHeader?: StringEnumRef, _options?: Configuration): Promise> { + const result = this.api.testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader, _options); + return result.toPromise(); + } + + /** + * Test header parameter(s) + * Test header parameter(s) + * @param [integerHeader] + * @param [booleanHeader] + * @param [stringHeader] + * @param [enumNonrefStringHeader] + * @param [enumRefStringHeader] + */ + public testHeaderIntegerBooleanStringEnums(integerHeader?: number, booleanHeader?: boolean, stringHeader?: string, enumNonrefStringHeader?: 'success' | 'failure' | 'unclassified', enumRefStringHeader?: StringEnumRef, _options?: Configuration): Promise { + const result = this.api.testHeaderIntegerBooleanStringEnums(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader, _options); + return result.toPromise(); + } + + +} + + + +import { ObservablePathApi } from './ObservableAPI'; + +import { PathApiRequestFactory, PathApiResponseProcessor} from "../apis/PathApi"; +export class PromisePathApi { + private api: ObservablePathApi + + public constructor( + configuration: Configuration, + requestFactory?: PathApiRequestFactory, + responseProcessor?: PathApiResponseProcessor + ) { + this.api = new ObservablePathApi(configuration, requestFactory, responseProcessor); + } + + /** + * Test path parameter(s) + * Test path parameter(s) + * @param pathString + * @param pathInteger + * @param enumNonrefStringPath + * @param enumRefStringPath + */ + public testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString: string, pathInteger: number, enumNonrefStringPath: 'success' | 'failure' | 'unclassified', enumRefStringPath: StringEnumRef, _options?: Configuration): Promise> { + const result = this.api.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath, _options); + return result.toPromise(); + } + + /** + * Test path parameter(s) + * Test path parameter(s) + * @param pathString + * @param pathInteger + * @param enumNonrefStringPath + * @param enumRefStringPath + */ + public testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString: string, pathInteger: number, enumNonrefStringPath: 'success' | 'failure' | 'unclassified', enumRefStringPath: StringEnumRef, _options?: Configuration): Promise { + const result = this.api.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath, _options); + return result.toPromise(); + } + + +} + + + +import { ObservableQueryApi } from './ObservableAPI'; + +import { QueryApiRequestFactory, QueryApiResponseProcessor} from "../apis/QueryApi"; +export class PromiseQueryApi { + private api: ObservableQueryApi + + public constructor( + configuration: Configuration, + requestFactory?: QueryApiRequestFactory, + responseProcessor?: QueryApiResponseProcessor + ) { + this.api = new ObservableQueryApi(configuration, requestFactory, responseProcessor); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [enumNonrefStringQuery] + * @param [enumRefStringQuery] + */ + public testEnumRefStringWithHttpInfo(enumNonrefStringQuery?: 'success' | 'failure' | 'unclassified', enumRefStringQuery?: StringEnumRef, _options?: Configuration): Promise> { + const result = this.api.testEnumRefStringWithHttpInfo(enumNonrefStringQuery, enumRefStringQuery, _options); + return result.toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [enumNonrefStringQuery] + * @param [enumRefStringQuery] + */ + public testEnumRefString(enumNonrefStringQuery?: 'success' | 'failure' | 'unclassified', enumRefStringQuery?: StringEnumRef, _options?: Configuration): Promise { + const result = this.api.testEnumRefString(enumNonrefStringQuery, enumRefStringQuery, _options); + return result.toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [datetimeQuery] + * @param [dateQuery] + * @param [stringQuery] + */ + public testQueryDatetimeDateStringWithHttpInfo(datetimeQuery?: Date, dateQuery?: string, stringQuery?: string, _options?: Configuration): Promise> { + const result = this.api.testQueryDatetimeDateStringWithHttpInfo(datetimeQuery, dateQuery, stringQuery, _options); + return result.toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [datetimeQuery] + * @param [dateQuery] + * @param [stringQuery] + */ + public testQueryDatetimeDateString(datetimeQuery?: Date, dateQuery?: string, stringQuery?: string, _options?: Configuration): Promise { + const result = this.api.testQueryDatetimeDateString(datetimeQuery, dateQuery, stringQuery, _options); + return result.toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [integerQuery] + * @param [booleanQuery] + * @param [stringQuery] + */ + public testQueryIntegerBooleanStringWithHttpInfo(integerQuery?: number, booleanQuery?: boolean, stringQuery?: string, _options?: Configuration): Promise> { + const result = this.api.testQueryIntegerBooleanStringWithHttpInfo(integerQuery, booleanQuery, stringQuery, _options); + return result.toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [integerQuery] + * @param [booleanQuery] + * @param [stringQuery] + */ + public testQueryIntegerBooleanString(integerQuery?: number, booleanQuery?: boolean, stringQuery?: string, _options?: Configuration): Promise { + const result = this.api.testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery, _options); + return result.toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + public testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject?: Pet, _options?: Configuration): Promise> { + const result = this.api.testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject, _options); + return result.toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + public testQueryStyleDeepObjectExplodeTrueObject(queryObject?: Pet, _options?: Configuration): Promise { + const result = this.api.testQueryStyleDeepObjectExplodeTrueObject(queryObject, _options); + return result.toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + public testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(queryObject?: TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter, _options?: Configuration): Promise> { + const result = this.api.testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(queryObject, _options); + return result.toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + public testQueryStyleDeepObjectExplodeTrueObjectAllOf(queryObject?: TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter, _options?: Configuration): Promise { + const result = this.api.testQueryStyleDeepObjectExplodeTrueObjectAllOf(queryObject, _options); + return result.toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + public testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(queryObject?: Array, _options?: Configuration): Promise> { + const result = this.api.testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(queryObject, _options); + return result.toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + public testQueryStyleFormExplodeFalseArrayInteger(queryObject?: Array, _options?: Configuration): Promise { + const result = this.api.testQueryStyleFormExplodeFalseArrayInteger(queryObject, _options); + return result.toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + public testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(queryObject?: Array, _options?: Configuration): Promise> { + const result = this.api.testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(queryObject, _options); + return result.toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + public testQueryStyleFormExplodeFalseArrayString(queryObject?: Array, _options?: Configuration): Promise { + const result = this.api.testQueryStyleFormExplodeFalseArrayString(queryObject, _options); + return result.toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + public testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject?: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter, _options?: Configuration): Promise> { + const result = this.api.testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject, _options); + return result.toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + public testQueryStyleFormExplodeTrueArrayString(queryObject?: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter, _options?: Configuration): Promise { + const result = this.api.testQueryStyleFormExplodeTrueArrayString(queryObject, _options); + return result.toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + public testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject?: Pet, _options?: Configuration): Promise> { + const result = this.api.testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject, _options); + return result.toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + public testQueryStyleFormExplodeTrueObject(queryObject?: Pet, _options?: Configuration): Promise { + const result = this.api.testQueryStyleFormExplodeTrueObject(queryObject, _options); + return result.toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + public testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(queryObject?: DataQuery, _options?: Configuration): Promise> { + const result = this.api.testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(queryObject, _options); + return result.toPromise(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + public testQueryStyleFormExplodeTrueObjectAllOf(queryObject?: DataQuery, _options?: Configuration): Promise { + const result = this.api.testQueryStyleFormExplodeTrueObjectAllOf(queryObject, _options); + return result.toPromise(); + } + + +} + + + diff --git a/samples/client/echo_api/typescript/build/util.ts b/samples/client/echo_api/typescript/build/util.ts new file mode 100644 index 000000000000..96ea3dfdc770 --- /dev/null +++ b/samples/client/echo_api/typescript/build/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 +} From cce15e0146bc758dbb93b335cc0997bc141e5add Mon Sep 17 00:00:00 2001 From: Ivan Vaskevych Date: Mon, 31 Mar 2025 12:38:15 +0200 Subject: [PATCH 6/9] Updates samples --- .../typescript/build/.openapi-generator/FILES | 1 - .../build/.openapi-generator/VERSION | 2 +- .../echo_api/typescript/build/apis/AuthApi.ts | 4 +- .../echo_api/typescript/build/apis/BodyApi.ts | 20 +- .../echo_api/typescript/build/apis/FormApi.ts | 6 +- .../typescript/build/apis/HeaderApi.ts | 2 +- .../echo_api/typescript/build/apis/PathApi.ts | 2 +- .../typescript/build/apis/QueryApi.ts | 20 +- .../typescript/build/configuration.ts | 24 +- .../client/echo_api/typescript/build/index.ts | 5 +- .../echo_api/typescript/build/package.json | 6 +- .../typescript/build/types/ObjectParamAPI.ts | 111 +- .../typescript/build/types/ObservableAPI.ts | 1110 ++++++++++++++--- .../typescript/build/types/PromiseAPI.ts | 867 +++++++++++-- 14 files changed, 1812 insertions(+), 368 deletions(-) diff --git a/samples/client/echo_api/typescript/build/.openapi-generator/FILES b/samples/client/echo_api/typescript/build/.openapi-generator/FILES index 566ce8b4c574..4db34aea13ac 100644 --- a/samples/client/echo_api/typescript/build/.openapi-generator/FILES +++ b/samples/client/echo_api/typescript/build/.openapi-generator/FILES @@ -1,6 +1,5 @@ .gitattributes .gitignore -.openapi-generator-ignore AuthApi.md BodyApi.md FormApi.md diff --git a/samples/client/echo_api/typescript/build/.openapi-generator/VERSION b/samples/client/echo_api/typescript/build/.openapi-generator/VERSION index 884119126398..96cfbb19ae28 100644 --- a/samples/client/echo_api/typescript/build/.openapi-generator/VERSION +++ b/samples/client/echo_api/typescript/build/.openapi-generator/VERSION @@ -1 +1 @@ -7.11.0-SNAPSHOT +7.13.0-SNAPSHOT diff --git a/samples/client/echo_api/typescript/build/apis/AuthApi.ts b/samples/client/echo_api/typescript/build/apis/AuthApi.ts index 0dcbd3ef7dd7..0dd98840a065 100644 --- a/samples/client/echo_api/typescript/build/apis/AuthApi.ts +++ b/samples/client/echo_api/typescript/build/apis/AuthApi.ts @@ -36,7 +36,7 @@ export class AuthApiRequestFactory extends BaseAPIRequestFactory { await authMethod?.applySecurityAuthentication(requestContext); } - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } @@ -66,7 +66,7 @@ export class AuthApiRequestFactory extends BaseAPIRequestFactory { await authMethod?.applySecurityAuthentication(requestContext); } - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } diff --git a/samples/client/echo_api/typescript/build/apis/BodyApi.ts b/samples/client/echo_api/typescript/build/apis/BodyApi.ts index 25bc040a5fbf..61542c9c1752 100644 --- a/samples/client/echo_api/typescript/build/apis/BodyApi.ts +++ b/samples/client/echo_api/typescript/build/apis/BodyApi.ts @@ -33,7 +33,7 @@ export class BodyApiRequestFactory extends BaseAPIRequestFactory { - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } @@ -70,7 +70,7 @@ export class BodyApiRequestFactory extends BaseAPIRequestFactory { requestContext.setBody(serializedBody); - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } @@ -126,7 +126,7 @@ export class BodyApiRequestFactory extends BaseAPIRequestFactory { } - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } @@ -179,7 +179,7 @@ export class BodyApiRequestFactory extends BaseAPIRequestFactory { } - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } @@ -216,7 +216,7 @@ export class BodyApiRequestFactory extends BaseAPIRequestFactory { requestContext.setBody(serializedBody); - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } @@ -253,7 +253,7 @@ export class BodyApiRequestFactory extends BaseAPIRequestFactory { requestContext.setBody(serializedBody); - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } @@ -290,7 +290,7 @@ export class BodyApiRequestFactory extends BaseAPIRequestFactory { requestContext.setBody(serializedBody); - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } @@ -327,7 +327,7 @@ export class BodyApiRequestFactory extends BaseAPIRequestFactory { requestContext.setBody(serializedBody); - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } @@ -364,7 +364,7 @@ export class BodyApiRequestFactory extends BaseAPIRequestFactory { requestContext.setBody(serializedBody); - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } @@ -401,7 +401,7 @@ export class BodyApiRequestFactory extends BaseAPIRequestFactory { requestContext.setBody(serializedBody); - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } diff --git a/samples/client/echo_api/typescript/build/apis/FormApi.ts b/samples/client/echo_api/typescript/build/apis/FormApi.ts index ccf60e881a32..84a741d76f58 100644 --- a/samples/client/echo_api/typescript/build/apis/FormApi.ts +++ b/samples/client/echo_api/typescript/build/apis/FormApi.ts @@ -70,7 +70,7 @@ export class FormApiRequestFactory extends BaseAPIRequestFactory { } - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } @@ -126,7 +126,7 @@ export class FormApiRequestFactory extends BaseAPIRequestFactory { } - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } @@ -207,7 +207,7 @@ export class FormApiRequestFactory extends BaseAPIRequestFactory { } - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } diff --git a/samples/client/echo_api/typescript/build/apis/HeaderApi.ts b/samples/client/echo_api/typescript/build/apis/HeaderApi.ts index d17c58da1425..c9bc1e8c868c 100644 --- a/samples/client/echo_api/typescript/build/apis/HeaderApi.ts +++ b/samples/client/echo_api/typescript/build/apis/HeaderApi.ts @@ -56,7 +56,7 @@ export class HeaderApiRequestFactory extends BaseAPIRequestFactory { - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } diff --git a/samples/client/echo_api/typescript/build/apis/PathApi.ts b/samples/client/echo_api/typescript/build/apis/PathApi.ts index c03204d8c827..8ab837782dad 100644 --- a/samples/client/echo_api/typescript/build/apis/PathApi.ts +++ b/samples/client/echo_api/typescript/build/apis/PathApi.ts @@ -63,7 +63,7 @@ export class PathApiRequestFactory extends BaseAPIRequestFactory { - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } diff --git a/samples/client/echo_api/typescript/build/apis/QueryApi.ts b/samples/client/echo_api/typescript/build/apis/QueryApi.ts index 4d928b17d1fa..47530ab09143 100644 --- a/samples/client/echo_api/typescript/build/apis/QueryApi.ts +++ b/samples/client/echo_api/typescript/build/apis/QueryApi.ts @@ -49,7 +49,7 @@ export class QueryApiRequestFactory extends BaseAPIRequestFactory { - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } @@ -94,7 +94,7 @@ export class QueryApiRequestFactory extends BaseAPIRequestFactory { - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } @@ -139,7 +139,7 @@ export class QueryApiRequestFactory extends BaseAPIRequestFactory { - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } @@ -173,7 +173,7 @@ export class QueryApiRequestFactory extends BaseAPIRequestFactory { - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } @@ -207,7 +207,7 @@ export class QueryApiRequestFactory extends BaseAPIRequestFactory { - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } @@ -238,7 +238,7 @@ export class QueryApiRequestFactory extends BaseAPIRequestFactory { - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } @@ -269,7 +269,7 @@ export class QueryApiRequestFactory extends BaseAPIRequestFactory { - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } @@ -303,7 +303,7 @@ export class QueryApiRequestFactory extends BaseAPIRequestFactory { - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } @@ -337,7 +337,7 @@ export class QueryApiRequestFactory extends BaseAPIRequestFactory { - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } @@ -371,7 +371,7 @@ export class QueryApiRequestFactory extends BaseAPIRequestFactory { - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } diff --git a/samples/client/echo_api/typescript/build/configuration.ts b/samples/client/echo_api/typescript/build/configuration.ts index 7acb56e66477..92aeec546f50 100644 --- a/samples/client/echo_api/typescript/build/configuration.ts +++ b/samples/client/echo_api/typescript/build/configuration.ts @@ -4,13 +4,25 @@ import { IsomorphicFetchHttpLibrary as DefaultHttpLibrary } from "./http/isomorp 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; +export interface Configuration { + readonly baseServer: BaseServerConfiguration; + readonly httpApi: HttpLibrary; + readonly middleware: M[]; + readonly authMethods: AuthMethods; } +// Additional option specific to middleware merge strategy +export interface MiddlewareMergeOptions { + // default is `'replace'` for backwards compatibility + middlewareMergeStrategy?: 'replace' | 'append' | 'prepend'; +} + +// Unify configuration options using Partial plus extra merge strategy +export type ConfigurationOptions = Partial> & MiddlewareMergeOptions; + +// aliases for convenience +export type StandardConfigurationOptions = ConfigurationOptions; +export type PromiseConfigurationOptions = ConfigurationOptions; /** * Interface with which a configuration object can be configured. @@ -79,4 +91,4 @@ export function createConfiguration(conf: ConfigurationParameters = {}): Configu ); } return configuration; -} \ No newline at end of file +} diff --git a/samples/client/echo_api/typescript/build/index.ts b/samples/client/echo_api/typescript/build/index.ts index ed8282fb46cc..bd47d6df7de4 100644 --- a/samples/client/echo_api/typescript/build/index.ts +++ b/samples/client/echo_api/typescript/build/index.ts @@ -2,11 +2,12 @@ export * from "./http/http"; export * from "./auth/auth"; export * from "./models/all"; export { createConfiguration } from "./configuration" -export type { Configuration } from "./configuration" +export type { Configuration, ConfigurationOptions, PromiseConfigurationOptions } from "./configuration" export * from "./apis/exception"; export * from "./servers"; export { RequiredError } from "./apis/baseapi"; -export type { PromiseMiddleware as Middleware } from './middleware'; +export type { PromiseMiddleware as Middleware, Middleware as ObservableMiddleware } from './middleware'; +export { Observable } from './rxjsStub'; export { PromiseAuthApi as AuthApi, PromiseBodyApi as BodyApi, PromiseFormApi as FormApi, PromiseHeaderApi as HeaderApi, PromisePathApi as PathApi, PromiseQueryApi as QueryApi } from './types/PromiseAPI'; diff --git a/samples/client/echo_api/typescript/build/package.json b/samples/client/echo_api/typescript/build/package.json index 5644934d7914..02862e75cd1d 100644 --- a/samples/client/echo_api/typescript/build/package.json +++ b/samples/client/echo_api/typescript/build/package.json @@ -32,11 +32,9 @@ }, "dependencies": { "whatwg-fetch": "^3.0.0", - "es6-promise": "^4.2.4", - "url-parse": "^1.4.3" + "es6-promise": "^4.2.4" }, "devDependencies": { - "typescript": "^4.0", - "@types/url-parse": "1.4.4" + "typescript": "^4.0" } } diff --git a/samples/client/echo_api/typescript/build/types/ObjectParamAPI.ts b/samples/client/echo_api/typescript/build/types/ObjectParamAPI.ts index 1d76035410ae..9c08fa610b21 100644 --- a/samples/client/echo_api/typescript/build/types/ObjectParamAPI.ts +++ b/samples/client/echo_api/typescript/build/types/ObjectParamAPI.ts @@ -1,5 +1,6 @@ import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; -import { Configuration} from '../configuration' +import { Configuration, ConfigurationOptions } from '../configuration' +import type { Middleware } from '../middleware'; import { Bird } from '../models/Bird'; import { Category } from '../models/Category'; @@ -35,7 +36,7 @@ export class ObjectAuthApi { * To test HTTP basic authentication * @param param the request object */ - public testAuthHttpBasicWithHttpInfo(param: AuthApiTestAuthHttpBasicRequest = {}, options?: Configuration): Promise> { + public testAuthHttpBasicWithHttpInfo(param: AuthApiTestAuthHttpBasicRequest = {}, options?: ConfigurationOptions): Promise> { return this.api.testAuthHttpBasicWithHttpInfo( options).toPromise(); } @@ -44,7 +45,7 @@ export class ObjectAuthApi { * To test HTTP basic authentication * @param param the request object */ - public testAuthHttpBasic(param: AuthApiTestAuthHttpBasicRequest = {}, options?: Configuration): Promise { + public testAuthHttpBasic(param: AuthApiTestAuthHttpBasicRequest = {}, options?: ConfigurationOptions): Promise { return this.api.testAuthHttpBasic( options).toPromise(); } @@ -53,7 +54,7 @@ export class ObjectAuthApi { * To test HTTP bearer authentication * @param param the request object */ - public testAuthHttpBearerWithHttpInfo(param: AuthApiTestAuthHttpBearerRequest = {}, options?: Configuration): Promise> { + public testAuthHttpBearerWithHttpInfo(param: AuthApiTestAuthHttpBearerRequest = {}, options?: ConfigurationOptions): Promise> { return this.api.testAuthHttpBearerWithHttpInfo( options).toPromise(); } @@ -62,7 +63,7 @@ export class ObjectAuthApi { * To test HTTP bearer authentication * @param param the request object */ - public testAuthHttpBearer(param: AuthApiTestAuthHttpBearerRequest = {}, options?: Configuration): Promise { + public testAuthHttpBearer(param: AuthApiTestAuthHttpBearerRequest = {}, options?: ConfigurationOptions): Promise { return this.api.testAuthHttpBearer( options).toPromise(); } @@ -169,7 +170,7 @@ export class ObjectBodyApi { * Test binary (gif) response body * @param param the request object */ - public testBinaryGifWithHttpInfo(param: BodyApiTestBinaryGifRequest = {}, options?: Configuration): Promise> { + public testBinaryGifWithHttpInfo(param: BodyApiTestBinaryGifRequest = {}, options?: ConfigurationOptions): Promise> { return this.api.testBinaryGifWithHttpInfo( options).toPromise(); } @@ -178,7 +179,7 @@ export class ObjectBodyApi { * Test binary (gif) response body * @param param the request object */ - public testBinaryGif(param: BodyApiTestBinaryGifRequest = {}, options?: Configuration): Promise { + public testBinaryGif(param: BodyApiTestBinaryGifRequest = {}, options?: ConfigurationOptions): Promise { return this.api.testBinaryGif( options).toPromise(); } @@ -187,7 +188,7 @@ export class ObjectBodyApi { * Test body parameter(s) * @param param the request object */ - public testBodyApplicationOctetstreamBinaryWithHttpInfo(param: BodyApiTestBodyApplicationOctetstreamBinaryRequest = {}, options?: Configuration): Promise> { + public testBodyApplicationOctetstreamBinaryWithHttpInfo(param: BodyApiTestBodyApplicationOctetstreamBinaryRequest = {}, options?: ConfigurationOptions): Promise> { return this.api.testBodyApplicationOctetstreamBinaryWithHttpInfo(param.body, options).toPromise(); } @@ -196,7 +197,7 @@ export class ObjectBodyApi { * Test body parameter(s) * @param param the request object */ - public testBodyApplicationOctetstreamBinary(param: BodyApiTestBodyApplicationOctetstreamBinaryRequest = {}, options?: Configuration): Promise { + public testBodyApplicationOctetstreamBinary(param: BodyApiTestBodyApplicationOctetstreamBinaryRequest = {}, options?: ConfigurationOptions): Promise { return this.api.testBodyApplicationOctetstreamBinary(param.body, options).toPromise(); } @@ -205,7 +206,7 @@ export class ObjectBodyApi { * Test array of binary in multipart mime * @param param the request object */ - public testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(param: BodyApiTestBodyMultipartFormdataArrayOfBinaryRequest, options?: Configuration): Promise> { + public testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(param: BodyApiTestBodyMultipartFormdataArrayOfBinaryRequest, options?: ConfigurationOptions): Promise> { return this.api.testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(param.files, options).toPromise(); } @@ -214,7 +215,7 @@ export class ObjectBodyApi { * Test array of binary in multipart mime * @param param the request object */ - public testBodyMultipartFormdataArrayOfBinary(param: BodyApiTestBodyMultipartFormdataArrayOfBinaryRequest, options?: Configuration): Promise { + public testBodyMultipartFormdataArrayOfBinary(param: BodyApiTestBodyMultipartFormdataArrayOfBinaryRequest, options?: ConfigurationOptions): Promise { return this.api.testBodyMultipartFormdataArrayOfBinary(param.files, options).toPromise(); } @@ -223,7 +224,7 @@ export class ObjectBodyApi { * Test single binary in multipart mime * @param param the request object */ - public testBodyMultipartFormdataSingleBinaryWithHttpInfo(param: BodyApiTestBodyMultipartFormdataSingleBinaryRequest = {}, options?: Configuration): Promise> { + public testBodyMultipartFormdataSingleBinaryWithHttpInfo(param: BodyApiTestBodyMultipartFormdataSingleBinaryRequest = {}, options?: ConfigurationOptions): Promise> { return this.api.testBodyMultipartFormdataSingleBinaryWithHttpInfo(param.myFile, options).toPromise(); } @@ -232,7 +233,7 @@ export class ObjectBodyApi { * Test single binary in multipart mime * @param param the request object */ - public testBodyMultipartFormdataSingleBinary(param: BodyApiTestBodyMultipartFormdataSingleBinaryRequest = {}, options?: Configuration): Promise { + public testBodyMultipartFormdataSingleBinary(param: BodyApiTestBodyMultipartFormdataSingleBinaryRequest = {}, options?: ConfigurationOptions): Promise { return this.api.testBodyMultipartFormdataSingleBinary(param.myFile, options).toPromise(); } @@ -241,7 +242,7 @@ export class ObjectBodyApi { * Test body parameter(s) * @param param the request object */ - public testEchoBodyAllOfPetWithHttpInfo(param: BodyApiTestEchoBodyAllOfPetRequest = {}, options?: Configuration): Promise> { + public testEchoBodyAllOfPetWithHttpInfo(param: BodyApiTestEchoBodyAllOfPetRequest = {}, options?: ConfigurationOptions): Promise> { return this.api.testEchoBodyAllOfPetWithHttpInfo(param.pet, options).toPromise(); } @@ -250,7 +251,7 @@ export class ObjectBodyApi { * Test body parameter(s) * @param param the request object */ - public testEchoBodyAllOfPet(param: BodyApiTestEchoBodyAllOfPetRequest = {}, options?: Configuration): Promise { + public testEchoBodyAllOfPet(param: BodyApiTestEchoBodyAllOfPetRequest = {}, options?: ConfigurationOptions): Promise { return this.api.testEchoBodyAllOfPet(param.pet, options).toPromise(); } @@ -259,7 +260,7 @@ export class ObjectBodyApi { * Test free form object * @param param the request object */ - public testEchoBodyFreeFormObjectResponseStringWithHttpInfo(param: BodyApiTestEchoBodyFreeFormObjectResponseStringRequest = {}, options?: Configuration): Promise> { + public testEchoBodyFreeFormObjectResponseStringWithHttpInfo(param: BodyApiTestEchoBodyFreeFormObjectResponseStringRequest = {}, options?: ConfigurationOptions): Promise> { return this.api.testEchoBodyFreeFormObjectResponseStringWithHttpInfo(param.body, options).toPromise(); } @@ -268,7 +269,7 @@ export class ObjectBodyApi { * Test free form object * @param param the request object */ - public testEchoBodyFreeFormObjectResponseString(param: BodyApiTestEchoBodyFreeFormObjectResponseStringRequest = {}, options?: Configuration): Promise { + public testEchoBodyFreeFormObjectResponseString(param: BodyApiTestEchoBodyFreeFormObjectResponseStringRequest = {}, options?: ConfigurationOptions): Promise { return this.api.testEchoBodyFreeFormObjectResponseString(param.body, options).toPromise(); } @@ -277,7 +278,7 @@ export class ObjectBodyApi { * Test body parameter(s) * @param param the request object */ - public testEchoBodyPetWithHttpInfo(param: BodyApiTestEchoBodyPetRequest = {}, options?: Configuration): Promise> { + public testEchoBodyPetWithHttpInfo(param: BodyApiTestEchoBodyPetRequest = {}, options?: ConfigurationOptions): Promise> { return this.api.testEchoBodyPetWithHttpInfo(param.pet, options).toPromise(); } @@ -286,7 +287,7 @@ export class ObjectBodyApi { * Test body parameter(s) * @param param the request object */ - public testEchoBodyPet(param: BodyApiTestEchoBodyPetRequest = {}, options?: Configuration): Promise { + public testEchoBodyPet(param: BodyApiTestEchoBodyPetRequest = {}, options?: ConfigurationOptions): Promise { return this.api.testEchoBodyPet(param.pet, options).toPromise(); } @@ -295,7 +296,7 @@ export class ObjectBodyApi { * Test empty response body * @param param the request object */ - public testEchoBodyPetResponseStringWithHttpInfo(param: BodyApiTestEchoBodyPetResponseStringRequest = {}, options?: Configuration): Promise> { + public testEchoBodyPetResponseStringWithHttpInfo(param: BodyApiTestEchoBodyPetResponseStringRequest = {}, options?: ConfigurationOptions): Promise> { return this.api.testEchoBodyPetResponseStringWithHttpInfo(param.pet, options).toPromise(); } @@ -304,7 +305,7 @@ export class ObjectBodyApi { * Test empty response body * @param param the request object */ - public testEchoBodyPetResponseString(param: BodyApiTestEchoBodyPetResponseStringRequest = {}, options?: Configuration): Promise { + public testEchoBodyPetResponseString(param: BodyApiTestEchoBodyPetResponseStringRequest = {}, options?: ConfigurationOptions): Promise { return this.api.testEchoBodyPetResponseString(param.pet, options).toPromise(); } @@ -313,7 +314,7 @@ export class ObjectBodyApi { * Test string enum response body * @param param the request object */ - public testEchoBodyStringEnumWithHttpInfo(param: BodyApiTestEchoBodyStringEnumRequest = {}, options?: Configuration): Promise> { + public testEchoBodyStringEnumWithHttpInfo(param: BodyApiTestEchoBodyStringEnumRequest = {}, options?: ConfigurationOptions): Promise> { return this.api.testEchoBodyStringEnumWithHttpInfo(param.body, options).toPromise(); } @@ -322,7 +323,7 @@ export class ObjectBodyApi { * Test string enum response body * @param param the request object */ - public testEchoBodyStringEnum(param: BodyApiTestEchoBodyStringEnumRequest = {}, options?: Configuration): Promise { + public testEchoBodyStringEnum(param: BodyApiTestEchoBodyStringEnumRequest = {}, options?: ConfigurationOptions): Promise { return this.api.testEchoBodyStringEnum(param.body, options).toPromise(); } @@ -331,7 +332,7 @@ export class ObjectBodyApi { * Test empty json (request body) * @param param the request object */ - public testEchoBodyTagResponseStringWithHttpInfo(param: BodyApiTestEchoBodyTagResponseStringRequest = {}, options?: Configuration): Promise> { + public testEchoBodyTagResponseStringWithHttpInfo(param: BodyApiTestEchoBodyTagResponseStringRequest = {}, options?: ConfigurationOptions): Promise> { return this.api.testEchoBodyTagResponseStringWithHttpInfo(param.tag, options).toPromise(); } @@ -340,7 +341,7 @@ export class ObjectBodyApi { * Test empty json (request body) * @param param the request object */ - public testEchoBodyTagResponseString(param: BodyApiTestEchoBodyTagResponseStringRequest = {}, options?: Configuration): Promise { + public testEchoBodyTagResponseString(param: BodyApiTestEchoBodyTagResponseStringRequest = {}, options?: ConfigurationOptions): Promise { return this.api.testEchoBodyTagResponseString(param.tag, options).toPromise(); } @@ -440,7 +441,7 @@ export class ObjectFormApi { * Test form parameter(s) * @param param the request object */ - public testFormIntegerBooleanStringWithHttpInfo(param: FormApiTestFormIntegerBooleanStringRequest = {}, options?: Configuration): Promise> { + public testFormIntegerBooleanStringWithHttpInfo(param: FormApiTestFormIntegerBooleanStringRequest = {}, options?: ConfigurationOptions): Promise> { return this.api.testFormIntegerBooleanStringWithHttpInfo(param.integerForm, param.booleanForm, param.stringForm, options).toPromise(); } @@ -449,7 +450,7 @@ export class ObjectFormApi { * Test form parameter(s) * @param param the request object */ - public testFormIntegerBooleanString(param: FormApiTestFormIntegerBooleanStringRequest = {}, options?: Configuration): Promise { + public testFormIntegerBooleanString(param: FormApiTestFormIntegerBooleanStringRequest = {}, options?: ConfigurationOptions): Promise { return this.api.testFormIntegerBooleanString(param.integerForm, param.booleanForm, param.stringForm, options).toPromise(); } @@ -458,7 +459,7 @@ export class ObjectFormApi { * Test form parameter(s) for multipart schema * @param param the request object */ - public testFormObjectMultipartWithHttpInfo(param: FormApiTestFormObjectMultipartRequest, options?: Configuration): Promise> { + public testFormObjectMultipartWithHttpInfo(param: FormApiTestFormObjectMultipartRequest, options?: ConfigurationOptions): Promise> { return this.api.testFormObjectMultipartWithHttpInfo(param.marker, options).toPromise(); } @@ -467,7 +468,7 @@ export class ObjectFormApi { * Test form parameter(s) for multipart schema * @param param the request object */ - public testFormObjectMultipart(param: FormApiTestFormObjectMultipartRequest, options?: Configuration): Promise { + public testFormObjectMultipart(param: FormApiTestFormObjectMultipartRequest, options?: ConfigurationOptions): Promise { return this.api.testFormObjectMultipart(param.marker, options).toPromise(); } @@ -476,7 +477,7 @@ export class ObjectFormApi { * Test form parameter(s) for oneOf schema * @param param the request object */ - public testFormOneofWithHttpInfo(param: FormApiTestFormOneofRequest = {}, options?: Configuration): Promise> { + public testFormOneofWithHttpInfo(param: FormApiTestFormOneofRequest = {}, options?: ConfigurationOptions): Promise> { return this.api.testFormOneofWithHttpInfo(param.form1, param.form2, param.form3, param.form4, param.id, param.name, options).toPromise(); } @@ -485,7 +486,7 @@ export class ObjectFormApi { * Test form parameter(s) for oneOf schema * @param param the request object */ - public testFormOneof(param: FormApiTestFormOneofRequest = {}, options?: Configuration): Promise { + public testFormOneof(param: FormApiTestFormOneofRequest = {}, options?: ConfigurationOptions): Promise { return this.api.testFormOneof(param.form1, param.form2, param.form3, param.form4, param.id, param.name, options).toPromise(); } @@ -544,7 +545,7 @@ export class ObjectHeaderApi { * Test header parameter(s) * @param param the request object */ - public testHeaderIntegerBooleanStringEnumsWithHttpInfo(param: HeaderApiTestHeaderIntegerBooleanStringEnumsRequest = {}, options?: Configuration): Promise> { + public testHeaderIntegerBooleanStringEnumsWithHttpInfo(param: HeaderApiTestHeaderIntegerBooleanStringEnumsRequest = {}, options?: ConfigurationOptions): Promise> { return this.api.testHeaderIntegerBooleanStringEnumsWithHttpInfo(param.integerHeader, param.booleanHeader, param.stringHeader, param.enumNonrefStringHeader, param.enumRefStringHeader, options).toPromise(); } @@ -553,7 +554,7 @@ export class ObjectHeaderApi { * Test header parameter(s) * @param param the request object */ - public testHeaderIntegerBooleanStringEnums(param: HeaderApiTestHeaderIntegerBooleanStringEnumsRequest = {}, options?: Configuration): Promise { + public testHeaderIntegerBooleanStringEnums(param: HeaderApiTestHeaderIntegerBooleanStringEnumsRequest = {}, options?: ConfigurationOptions): Promise { return this.api.testHeaderIntegerBooleanStringEnums(param.integerHeader, param.booleanHeader, param.stringHeader, param.enumNonrefStringHeader, param.enumRefStringHeader, options).toPromise(); } @@ -605,7 +606,7 @@ export class ObjectPathApi { * Test path parameter(s) * @param param the request object */ - public testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(param: PathApiTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequest, options?: Configuration): Promise> { + public testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(param: PathApiTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequest, options?: ConfigurationOptions): Promise> { return this.api.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(param.pathString, param.pathInteger, param.enumNonrefStringPath, param.enumRefStringPath, options).toPromise(); } @@ -614,7 +615,7 @@ export class ObjectPathApi { * Test path parameter(s) * @param param the request object */ - public testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(param: PathApiTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequest, options?: Configuration): Promise { + public testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(param: PathApiTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequest, options?: ConfigurationOptions): Promise { return this.api.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(param.pathString, param.pathInteger, param.enumNonrefStringPath, param.enumRefStringPath, options).toPromise(); } @@ -770,7 +771,7 @@ export class ObjectQueryApi { * Test query parameter(s) * @param param the request object */ - public testEnumRefStringWithHttpInfo(param: QueryApiTestEnumRefStringRequest = {}, options?: Configuration): Promise> { + public testEnumRefStringWithHttpInfo(param: QueryApiTestEnumRefStringRequest = {}, options?: ConfigurationOptions): Promise> { return this.api.testEnumRefStringWithHttpInfo(param.enumNonrefStringQuery, param.enumRefStringQuery, options).toPromise(); } @@ -779,7 +780,7 @@ export class ObjectQueryApi { * Test query parameter(s) * @param param the request object */ - public testEnumRefString(param: QueryApiTestEnumRefStringRequest = {}, options?: Configuration): Promise { + public testEnumRefString(param: QueryApiTestEnumRefStringRequest = {}, options?: ConfigurationOptions): Promise { return this.api.testEnumRefString(param.enumNonrefStringQuery, param.enumRefStringQuery, options).toPromise(); } @@ -788,7 +789,7 @@ export class ObjectQueryApi { * Test query parameter(s) * @param param the request object */ - public testQueryDatetimeDateStringWithHttpInfo(param: QueryApiTestQueryDatetimeDateStringRequest = {}, options?: Configuration): Promise> { + public testQueryDatetimeDateStringWithHttpInfo(param: QueryApiTestQueryDatetimeDateStringRequest = {}, options?: ConfigurationOptions): Promise> { return this.api.testQueryDatetimeDateStringWithHttpInfo(param.datetimeQuery, param.dateQuery, param.stringQuery, options).toPromise(); } @@ -797,7 +798,7 @@ export class ObjectQueryApi { * Test query parameter(s) * @param param the request object */ - public testQueryDatetimeDateString(param: QueryApiTestQueryDatetimeDateStringRequest = {}, options?: Configuration): Promise { + public testQueryDatetimeDateString(param: QueryApiTestQueryDatetimeDateStringRequest = {}, options?: ConfigurationOptions): Promise { return this.api.testQueryDatetimeDateString(param.datetimeQuery, param.dateQuery, param.stringQuery, options).toPromise(); } @@ -806,7 +807,7 @@ export class ObjectQueryApi { * Test query parameter(s) * @param param the request object */ - public testQueryIntegerBooleanStringWithHttpInfo(param: QueryApiTestQueryIntegerBooleanStringRequest = {}, options?: Configuration): Promise> { + public testQueryIntegerBooleanStringWithHttpInfo(param: QueryApiTestQueryIntegerBooleanStringRequest = {}, options?: ConfigurationOptions): Promise> { return this.api.testQueryIntegerBooleanStringWithHttpInfo(param.integerQuery, param.booleanQuery, param.stringQuery, options).toPromise(); } @@ -815,7 +816,7 @@ export class ObjectQueryApi { * Test query parameter(s) * @param param the request object */ - public testQueryIntegerBooleanString(param: QueryApiTestQueryIntegerBooleanStringRequest = {}, options?: Configuration): Promise { + public testQueryIntegerBooleanString(param: QueryApiTestQueryIntegerBooleanStringRequest = {}, options?: ConfigurationOptions): Promise { return this.api.testQueryIntegerBooleanString(param.integerQuery, param.booleanQuery, param.stringQuery, options).toPromise(); } @@ -824,7 +825,7 @@ export class ObjectQueryApi { * Test query parameter(s) * @param param the request object */ - public testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(param: QueryApiTestQueryStyleDeepObjectExplodeTrueObjectRequest = {}, options?: Configuration): Promise> { + public testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(param: QueryApiTestQueryStyleDeepObjectExplodeTrueObjectRequest = {}, options?: ConfigurationOptions): Promise> { return this.api.testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(param.queryObject, options).toPromise(); } @@ -833,7 +834,7 @@ export class ObjectQueryApi { * Test query parameter(s) * @param param the request object */ - public testQueryStyleDeepObjectExplodeTrueObject(param: QueryApiTestQueryStyleDeepObjectExplodeTrueObjectRequest = {}, options?: Configuration): Promise { + public testQueryStyleDeepObjectExplodeTrueObject(param: QueryApiTestQueryStyleDeepObjectExplodeTrueObjectRequest = {}, options?: ConfigurationOptions): Promise { return this.api.testQueryStyleDeepObjectExplodeTrueObject(param.queryObject, options).toPromise(); } @@ -842,7 +843,7 @@ export class ObjectQueryApi { * Test query parameter(s) * @param param the request object */ - public testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(param: QueryApiTestQueryStyleDeepObjectExplodeTrueObjectAllOfRequest = {}, options?: Configuration): Promise> { + public testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(param: QueryApiTestQueryStyleDeepObjectExplodeTrueObjectAllOfRequest = {}, options?: ConfigurationOptions): Promise> { return this.api.testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(param.queryObject, options).toPromise(); } @@ -851,7 +852,7 @@ export class ObjectQueryApi { * Test query parameter(s) * @param param the request object */ - public testQueryStyleDeepObjectExplodeTrueObjectAllOf(param: QueryApiTestQueryStyleDeepObjectExplodeTrueObjectAllOfRequest = {}, options?: Configuration): Promise { + public testQueryStyleDeepObjectExplodeTrueObjectAllOf(param: QueryApiTestQueryStyleDeepObjectExplodeTrueObjectAllOfRequest = {}, options?: ConfigurationOptions): Promise { return this.api.testQueryStyleDeepObjectExplodeTrueObjectAllOf(param.queryObject, options).toPromise(); } @@ -860,7 +861,7 @@ export class ObjectQueryApi { * Test query parameter(s) * @param param the request object */ - public testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(param: QueryApiTestQueryStyleFormExplodeFalseArrayIntegerRequest = {}, options?: Configuration): Promise> { + public testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(param: QueryApiTestQueryStyleFormExplodeFalseArrayIntegerRequest = {}, options?: ConfigurationOptions): Promise> { return this.api.testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(param.queryObject, options).toPromise(); } @@ -869,7 +870,7 @@ export class ObjectQueryApi { * Test query parameter(s) * @param param the request object */ - public testQueryStyleFormExplodeFalseArrayInteger(param: QueryApiTestQueryStyleFormExplodeFalseArrayIntegerRequest = {}, options?: Configuration): Promise { + public testQueryStyleFormExplodeFalseArrayInteger(param: QueryApiTestQueryStyleFormExplodeFalseArrayIntegerRequest = {}, options?: ConfigurationOptions): Promise { return this.api.testQueryStyleFormExplodeFalseArrayInteger(param.queryObject, options).toPromise(); } @@ -878,7 +879,7 @@ export class ObjectQueryApi { * Test query parameter(s) * @param param the request object */ - public testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(param: QueryApiTestQueryStyleFormExplodeFalseArrayStringRequest = {}, options?: Configuration): Promise> { + public testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(param: QueryApiTestQueryStyleFormExplodeFalseArrayStringRequest = {}, options?: ConfigurationOptions): Promise> { return this.api.testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(param.queryObject, options).toPromise(); } @@ -887,7 +888,7 @@ export class ObjectQueryApi { * Test query parameter(s) * @param param the request object */ - public testQueryStyleFormExplodeFalseArrayString(param: QueryApiTestQueryStyleFormExplodeFalseArrayStringRequest = {}, options?: Configuration): Promise { + public testQueryStyleFormExplodeFalseArrayString(param: QueryApiTestQueryStyleFormExplodeFalseArrayStringRequest = {}, options?: ConfigurationOptions): Promise { return this.api.testQueryStyleFormExplodeFalseArrayString(param.queryObject, options).toPromise(); } @@ -896,7 +897,7 @@ export class ObjectQueryApi { * Test query parameter(s) * @param param the request object */ - public testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(param: QueryApiTestQueryStyleFormExplodeTrueArrayStringRequest = {}, options?: Configuration): Promise> { + public testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(param: QueryApiTestQueryStyleFormExplodeTrueArrayStringRequest = {}, options?: ConfigurationOptions): Promise> { return this.api.testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(param.queryObject, options).toPromise(); } @@ -905,7 +906,7 @@ export class ObjectQueryApi { * Test query parameter(s) * @param param the request object */ - public testQueryStyleFormExplodeTrueArrayString(param: QueryApiTestQueryStyleFormExplodeTrueArrayStringRequest = {}, options?: Configuration): Promise { + public testQueryStyleFormExplodeTrueArrayString(param: QueryApiTestQueryStyleFormExplodeTrueArrayStringRequest = {}, options?: ConfigurationOptions): Promise { return this.api.testQueryStyleFormExplodeTrueArrayString(param.queryObject, options).toPromise(); } @@ -914,7 +915,7 @@ export class ObjectQueryApi { * Test query parameter(s) * @param param the request object */ - public testQueryStyleFormExplodeTrueObjectWithHttpInfo(param: QueryApiTestQueryStyleFormExplodeTrueObjectRequest = {}, options?: Configuration): Promise> { + public testQueryStyleFormExplodeTrueObjectWithHttpInfo(param: QueryApiTestQueryStyleFormExplodeTrueObjectRequest = {}, options?: ConfigurationOptions): Promise> { return this.api.testQueryStyleFormExplodeTrueObjectWithHttpInfo(param.queryObject, options).toPromise(); } @@ -923,7 +924,7 @@ export class ObjectQueryApi { * Test query parameter(s) * @param param the request object */ - public testQueryStyleFormExplodeTrueObject(param: QueryApiTestQueryStyleFormExplodeTrueObjectRequest = {}, options?: Configuration): Promise { + public testQueryStyleFormExplodeTrueObject(param: QueryApiTestQueryStyleFormExplodeTrueObjectRequest = {}, options?: ConfigurationOptions): Promise { return this.api.testQueryStyleFormExplodeTrueObject(param.queryObject, options).toPromise(); } @@ -932,7 +933,7 @@ export class ObjectQueryApi { * Test query parameter(s) * @param param the request object */ - public testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(param: QueryApiTestQueryStyleFormExplodeTrueObjectAllOfRequest = {}, options?: Configuration): Promise> { + public testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(param: QueryApiTestQueryStyleFormExplodeTrueObjectAllOfRequest = {}, options?: ConfigurationOptions): Promise> { return this.api.testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(param.queryObject, options).toPromise(); } @@ -941,7 +942,7 @@ export class ObjectQueryApi { * Test query parameter(s) * @param param the request object */ - public testQueryStyleFormExplodeTrueObjectAllOf(param: QueryApiTestQueryStyleFormExplodeTrueObjectAllOfRequest = {}, options?: Configuration): Promise { + public testQueryStyleFormExplodeTrueObjectAllOf(param: QueryApiTestQueryStyleFormExplodeTrueObjectAllOfRequest = {}, options?: ConfigurationOptions): Promise { return this.api.testQueryStyleFormExplodeTrueObjectAllOf(param.queryObject, options).toPromise(); } diff --git a/samples/client/echo_api/typescript/build/types/ObservableAPI.ts b/samples/client/echo_api/typescript/build/types/ObservableAPI.ts index f42b4599cf67..3f0a62314bdd 100644 --- a/samples/client/echo_api/typescript/build/types/ObservableAPI.ts +++ b/samples/client/echo_api/typescript/build/types/ObservableAPI.ts @@ -1,5 +1,6 @@ import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; -import { Configuration} from '../configuration' +import { Configuration, ConfigurationOptions } from '../configuration' +import type { Middleware } from '../middleware'; import { Observable, of, from } from '../rxjsStub'; import {mergeMap, map} from '../rxjsStub'; import { Bird } from '../models/Bird'; @@ -35,19 +36,48 @@ export class ObservableAuthApi { * To test HTTP basic authentication * To test HTTP basic authentication */ - public testAuthHttpBasicWithHttpInfo(_options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.testAuthHttpBasic(_options); - + public testAuthHttpBasicWithHttpInfo(_options?: ConfigurationOptions): Observable> { + let _config = this.configuration; + let allMiddleware: Middleware[] = []; + if (_options && _options.middleware){ + const middlewareMergeStrategy = _options.middlewareMergeStrategy || 'replace' // default to replace behavior + // call-time middleware provided + const calltimeMiddleware: Middleware[] = _options.middleware; + + switch(middlewareMergeStrategy){ + case 'append': + allMiddleware = this.configuration.middleware.concat(calltimeMiddleware); + break; + case 'prepend': + allMiddleware = calltimeMiddleware.concat(this.configuration.middleware) + break; + case 'replace': + allMiddleware = calltimeMiddleware + break; + default: + throw new Error(`unrecognized middleware merge strategy '${middlewareMergeStrategy}'`) + } + } + if (_options){ + _config = { + baseServer: _options.baseServer || this.configuration.baseServer, + httpApi: _options.httpApi || this.configuration.httpApi, + authMethods: _options.authMethods || this.configuration.authMethods, + middleware: allMiddleware || this.configuration.middleware + }; + } + + const requestContextPromise = this.requestFactory.testAuthHttpBasic(_config); // build promise chain let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { + for (const middleware of allMiddleware) { 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) { + for (const middleware of allMiddleware.reverse()) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testAuthHttpBasicWithHttpInfo(rsp))); @@ -58,7 +88,7 @@ export class ObservableAuthApi { * To test HTTP basic authentication * To test HTTP basic authentication */ - public testAuthHttpBasic(_options?: Configuration): Observable { + public testAuthHttpBasic(_options?: ConfigurationOptions): Observable { return this.testAuthHttpBasicWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); } @@ -66,19 +96,48 @@ export class ObservableAuthApi { * To test HTTP bearer authentication * To test HTTP bearer authentication */ - public testAuthHttpBearerWithHttpInfo(_options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.testAuthHttpBearer(_options); - + public testAuthHttpBearerWithHttpInfo(_options?: ConfigurationOptions): Observable> { + let _config = this.configuration; + let allMiddleware: Middleware[] = []; + if (_options && _options.middleware){ + const middlewareMergeStrategy = _options.middlewareMergeStrategy || 'replace' // default to replace behavior + // call-time middleware provided + const calltimeMiddleware: Middleware[] = _options.middleware; + + switch(middlewareMergeStrategy){ + case 'append': + allMiddleware = this.configuration.middleware.concat(calltimeMiddleware); + break; + case 'prepend': + allMiddleware = calltimeMiddleware.concat(this.configuration.middleware) + break; + case 'replace': + allMiddleware = calltimeMiddleware + break; + default: + throw new Error(`unrecognized middleware merge strategy '${middlewareMergeStrategy}'`) + } + } + if (_options){ + _config = { + baseServer: _options.baseServer || this.configuration.baseServer, + httpApi: _options.httpApi || this.configuration.httpApi, + authMethods: _options.authMethods || this.configuration.authMethods, + middleware: allMiddleware || this.configuration.middleware + }; + } + + const requestContextPromise = this.requestFactory.testAuthHttpBearer(_config); // build promise chain let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { + for (const middleware of allMiddleware) { 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) { + for (const middleware of allMiddleware.reverse()) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testAuthHttpBearerWithHttpInfo(rsp))); @@ -89,7 +148,7 @@ export class ObservableAuthApi { * To test HTTP bearer authentication * To test HTTP bearer authentication */ - public testAuthHttpBearer(_options?: Configuration): Observable { + public testAuthHttpBearer(_options?: ConfigurationOptions): Observable { return this.testAuthHttpBearerWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); } @@ -115,19 +174,48 @@ export class ObservableBodyApi { * Test binary (gif) response body * Test binary (gif) response body */ - public testBinaryGifWithHttpInfo(_options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.testBinaryGif(_options); - + public testBinaryGifWithHttpInfo(_options?: ConfigurationOptions): Observable> { + let _config = this.configuration; + let allMiddleware: Middleware[] = []; + if (_options && _options.middleware){ + const middlewareMergeStrategy = _options.middlewareMergeStrategy || 'replace' // default to replace behavior + // call-time middleware provided + const calltimeMiddleware: Middleware[] = _options.middleware; + + switch(middlewareMergeStrategy){ + case 'append': + allMiddleware = this.configuration.middleware.concat(calltimeMiddleware); + break; + case 'prepend': + allMiddleware = calltimeMiddleware.concat(this.configuration.middleware) + break; + case 'replace': + allMiddleware = calltimeMiddleware + break; + default: + throw new Error(`unrecognized middleware merge strategy '${middlewareMergeStrategy}'`) + } + } + if (_options){ + _config = { + baseServer: _options.baseServer || this.configuration.baseServer, + httpApi: _options.httpApi || this.configuration.httpApi, + authMethods: _options.authMethods || this.configuration.authMethods, + middleware: allMiddleware || this.configuration.middleware + }; + } + + const requestContextPromise = this.requestFactory.testBinaryGif(_config); // build promise chain let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { + for (const middleware of allMiddleware) { 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) { + for (const middleware of allMiddleware.reverse()) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testBinaryGifWithHttpInfo(rsp))); @@ -138,7 +226,7 @@ export class ObservableBodyApi { * Test binary (gif) response body * Test binary (gif) response body */ - public testBinaryGif(_options?: Configuration): Observable { + public testBinaryGif(_options?: ConfigurationOptions): Observable { return this.testBinaryGifWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); } @@ -147,19 +235,48 @@ export class ObservableBodyApi { * Test body parameter(s) * @param [body] */ - public testBodyApplicationOctetstreamBinaryWithHttpInfo(body?: HttpFile, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.testBodyApplicationOctetstreamBinary(body, _options); - + public testBodyApplicationOctetstreamBinaryWithHttpInfo(body?: HttpFile, _options?: ConfigurationOptions): Observable> { + let _config = this.configuration; + let allMiddleware: Middleware[] = []; + if (_options && _options.middleware){ + const middlewareMergeStrategy = _options.middlewareMergeStrategy || 'replace' // default to replace behavior + // call-time middleware provided + const calltimeMiddleware: Middleware[] = _options.middleware; + + switch(middlewareMergeStrategy){ + case 'append': + allMiddleware = this.configuration.middleware.concat(calltimeMiddleware); + break; + case 'prepend': + allMiddleware = calltimeMiddleware.concat(this.configuration.middleware) + break; + case 'replace': + allMiddleware = calltimeMiddleware + break; + default: + throw new Error(`unrecognized middleware merge strategy '${middlewareMergeStrategy}'`) + } + } + if (_options){ + _config = { + baseServer: _options.baseServer || this.configuration.baseServer, + httpApi: _options.httpApi || this.configuration.httpApi, + authMethods: _options.authMethods || this.configuration.authMethods, + middleware: allMiddleware || this.configuration.middleware + }; + } + + const requestContextPromise = this.requestFactory.testBodyApplicationOctetstreamBinary(body, _config); // build promise chain let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { + for (const middleware of allMiddleware) { 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) { + for (const middleware of allMiddleware.reverse()) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testBodyApplicationOctetstreamBinaryWithHttpInfo(rsp))); @@ -171,7 +288,7 @@ export class ObservableBodyApi { * Test body parameter(s) * @param [body] */ - public testBodyApplicationOctetstreamBinary(body?: HttpFile, _options?: Configuration): Observable { + public testBodyApplicationOctetstreamBinary(body?: HttpFile, _options?: ConfigurationOptions): Observable { return this.testBodyApplicationOctetstreamBinaryWithHttpInfo(body, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); } @@ -180,19 +297,48 @@ export class ObservableBodyApi { * Test array of binary in multipart mime * @param files */ - public testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files: Array, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.testBodyMultipartFormdataArrayOfBinary(files, _options); - + public testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files: Array, _options?: ConfigurationOptions): Observable> { + let _config = this.configuration; + let allMiddleware: Middleware[] = []; + if (_options && _options.middleware){ + const middlewareMergeStrategy = _options.middlewareMergeStrategy || 'replace' // default to replace behavior + // call-time middleware provided + const calltimeMiddleware: Middleware[] = _options.middleware; + + switch(middlewareMergeStrategy){ + case 'append': + allMiddleware = this.configuration.middleware.concat(calltimeMiddleware); + break; + case 'prepend': + allMiddleware = calltimeMiddleware.concat(this.configuration.middleware) + break; + case 'replace': + allMiddleware = calltimeMiddleware + break; + default: + throw new Error(`unrecognized middleware merge strategy '${middlewareMergeStrategy}'`) + } + } + if (_options){ + _config = { + baseServer: _options.baseServer || this.configuration.baseServer, + httpApi: _options.httpApi || this.configuration.httpApi, + authMethods: _options.authMethods || this.configuration.authMethods, + middleware: allMiddleware || this.configuration.middleware + }; + } + + const requestContextPromise = this.requestFactory.testBodyMultipartFormdataArrayOfBinary(files, _config); // build promise chain let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { + for (const middleware of allMiddleware) { 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) { + for (const middleware of allMiddleware.reverse()) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(rsp))); @@ -204,7 +350,7 @@ export class ObservableBodyApi { * Test array of binary in multipart mime * @param files */ - public testBodyMultipartFormdataArrayOfBinary(files: Array, _options?: Configuration): Observable { + public testBodyMultipartFormdataArrayOfBinary(files: Array, _options?: ConfigurationOptions): Observable { return this.testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); } @@ -213,19 +359,48 @@ export class ObservableBodyApi { * Test single binary in multipart mime * @param [myFile] */ - public testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile?: HttpFile, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.testBodyMultipartFormdataSingleBinary(myFile, _options); - + public testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile?: HttpFile, _options?: ConfigurationOptions): Observable> { + let _config = this.configuration; + let allMiddleware: Middleware[] = []; + if (_options && _options.middleware){ + const middlewareMergeStrategy = _options.middlewareMergeStrategy || 'replace' // default to replace behavior + // call-time middleware provided + const calltimeMiddleware: Middleware[] = _options.middleware; + + switch(middlewareMergeStrategy){ + case 'append': + allMiddleware = this.configuration.middleware.concat(calltimeMiddleware); + break; + case 'prepend': + allMiddleware = calltimeMiddleware.concat(this.configuration.middleware) + break; + case 'replace': + allMiddleware = calltimeMiddleware + break; + default: + throw new Error(`unrecognized middleware merge strategy '${middlewareMergeStrategy}'`) + } + } + if (_options){ + _config = { + baseServer: _options.baseServer || this.configuration.baseServer, + httpApi: _options.httpApi || this.configuration.httpApi, + authMethods: _options.authMethods || this.configuration.authMethods, + middleware: allMiddleware || this.configuration.middleware + }; + } + + const requestContextPromise = this.requestFactory.testBodyMultipartFormdataSingleBinary(myFile, _config); // build promise chain let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { + for (const middleware of allMiddleware) { 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) { + for (const middleware of allMiddleware.reverse()) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testBodyMultipartFormdataSingleBinaryWithHttpInfo(rsp))); @@ -237,7 +412,7 @@ export class ObservableBodyApi { * Test single binary in multipart mime * @param [myFile] */ - public testBodyMultipartFormdataSingleBinary(myFile?: HttpFile, _options?: Configuration): Observable { + public testBodyMultipartFormdataSingleBinary(myFile?: HttpFile, _options?: ConfigurationOptions): Observable { return this.testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); } @@ -246,19 +421,48 @@ export class ObservableBodyApi { * Test body parameter(s) * @param [pet] Pet object that needs to be added to the store */ - public testEchoBodyAllOfPetWithHttpInfo(pet?: Pet, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.testEchoBodyAllOfPet(pet, _options); - + public testEchoBodyAllOfPetWithHttpInfo(pet?: Pet, _options?: ConfigurationOptions): Observable> { + let _config = this.configuration; + let allMiddleware: Middleware[] = []; + if (_options && _options.middleware){ + const middlewareMergeStrategy = _options.middlewareMergeStrategy || 'replace' // default to replace behavior + // call-time middleware provided + const calltimeMiddleware: Middleware[] = _options.middleware; + + switch(middlewareMergeStrategy){ + case 'append': + allMiddleware = this.configuration.middleware.concat(calltimeMiddleware); + break; + case 'prepend': + allMiddleware = calltimeMiddleware.concat(this.configuration.middleware) + break; + case 'replace': + allMiddleware = calltimeMiddleware + break; + default: + throw new Error(`unrecognized middleware merge strategy '${middlewareMergeStrategy}'`) + } + } + if (_options){ + _config = { + baseServer: _options.baseServer || this.configuration.baseServer, + httpApi: _options.httpApi || this.configuration.httpApi, + authMethods: _options.authMethods || this.configuration.authMethods, + middleware: allMiddleware || this.configuration.middleware + }; + } + + const requestContextPromise = this.requestFactory.testEchoBodyAllOfPet(pet, _config); // build promise chain let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { + for (const middleware of allMiddleware) { 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) { + for (const middleware of allMiddleware.reverse()) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testEchoBodyAllOfPetWithHttpInfo(rsp))); @@ -270,7 +474,7 @@ export class ObservableBodyApi { * Test body parameter(s) * @param [pet] Pet object that needs to be added to the store */ - public testEchoBodyAllOfPet(pet?: Pet, _options?: Configuration): Observable { + public testEchoBodyAllOfPet(pet?: Pet, _options?: ConfigurationOptions): Observable { return this.testEchoBodyAllOfPetWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); } @@ -279,19 +483,48 @@ export class ObservableBodyApi { * Test free form object * @param [body] Free form object */ - public testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body?: any, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.testEchoBodyFreeFormObjectResponseString(body, _options); - + public testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body?: any, _options?: ConfigurationOptions): Observable> { + let _config = this.configuration; + let allMiddleware: Middleware[] = []; + if (_options && _options.middleware){ + const middlewareMergeStrategy = _options.middlewareMergeStrategy || 'replace' // default to replace behavior + // call-time middleware provided + const calltimeMiddleware: Middleware[] = _options.middleware; + + switch(middlewareMergeStrategy){ + case 'append': + allMiddleware = this.configuration.middleware.concat(calltimeMiddleware); + break; + case 'prepend': + allMiddleware = calltimeMiddleware.concat(this.configuration.middleware) + break; + case 'replace': + allMiddleware = calltimeMiddleware + break; + default: + throw new Error(`unrecognized middleware merge strategy '${middlewareMergeStrategy}'`) + } + } + if (_options){ + _config = { + baseServer: _options.baseServer || this.configuration.baseServer, + httpApi: _options.httpApi || this.configuration.httpApi, + authMethods: _options.authMethods || this.configuration.authMethods, + middleware: allMiddleware || this.configuration.middleware + }; + } + + const requestContextPromise = this.requestFactory.testEchoBodyFreeFormObjectResponseString(body, _config); // build promise chain let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { + for (const middleware of allMiddleware) { 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) { + for (const middleware of allMiddleware.reverse()) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testEchoBodyFreeFormObjectResponseStringWithHttpInfo(rsp))); @@ -303,7 +536,7 @@ export class ObservableBodyApi { * Test free form object * @param [body] Free form object */ - public testEchoBodyFreeFormObjectResponseString(body?: any, _options?: Configuration): Observable { + public testEchoBodyFreeFormObjectResponseString(body?: any, _options?: ConfigurationOptions): Observable { return this.testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); } @@ -312,19 +545,48 @@ export class ObservableBodyApi { * Test body parameter(s) * @param [pet] Pet object that needs to be added to the store */ - public testEchoBodyPetWithHttpInfo(pet?: Pet, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.testEchoBodyPet(pet, _options); - + public testEchoBodyPetWithHttpInfo(pet?: Pet, _options?: ConfigurationOptions): Observable> { + let _config = this.configuration; + let allMiddleware: Middleware[] = []; + if (_options && _options.middleware){ + const middlewareMergeStrategy = _options.middlewareMergeStrategy || 'replace' // default to replace behavior + // call-time middleware provided + const calltimeMiddleware: Middleware[] = _options.middleware; + + switch(middlewareMergeStrategy){ + case 'append': + allMiddleware = this.configuration.middleware.concat(calltimeMiddleware); + break; + case 'prepend': + allMiddleware = calltimeMiddleware.concat(this.configuration.middleware) + break; + case 'replace': + allMiddleware = calltimeMiddleware + break; + default: + throw new Error(`unrecognized middleware merge strategy '${middlewareMergeStrategy}'`) + } + } + if (_options){ + _config = { + baseServer: _options.baseServer || this.configuration.baseServer, + httpApi: _options.httpApi || this.configuration.httpApi, + authMethods: _options.authMethods || this.configuration.authMethods, + middleware: allMiddleware || this.configuration.middleware + }; + } + + const requestContextPromise = this.requestFactory.testEchoBodyPet(pet, _config); // build promise chain let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { + for (const middleware of allMiddleware) { 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) { + for (const middleware of allMiddleware.reverse()) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testEchoBodyPetWithHttpInfo(rsp))); @@ -336,7 +598,7 @@ export class ObservableBodyApi { * Test body parameter(s) * @param [pet] Pet object that needs to be added to the store */ - public testEchoBodyPet(pet?: Pet, _options?: Configuration): Observable { + public testEchoBodyPet(pet?: Pet, _options?: ConfigurationOptions): Observable { return this.testEchoBodyPetWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); } @@ -345,19 +607,48 @@ export class ObservableBodyApi { * Test empty response body * @param [pet] Pet object that needs to be added to the store */ - public testEchoBodyPetResponseStringWithHttpInfo(pet?: Pet, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.testEchoBodyPetResponseString(pet, _options); - + public testEchoBodyPetResponseStringWithHttpInfo(pet?: Pet, _options?: ConfigurationOptions): Observable> { + let _config = this.configuration; + let allMiddleware: Middleware[] = []; + if (_options && _options.middleware){ + const middlewareMergeStrategy = _options.middlewareMergeStrategy || 'replace' // default to replace behavior + // call-time middleware provided + const calltimeMiddleware: Middleware[] = _options.middleware; + + switch(middlewareMergeStrategy){ + case 'append': + allMiddleware = this.configuration.middleware.concat(calltimeMiddleware); + break; + case 'prepend': + allMiddleware = calltimeMiddleware.concat(this.configuration.middleware) + break; + case 'replace': + allMiddleware = calltimeMiddleware + break; + default: + throw new Error(`unrecognized middleware merge strategy '${middlewareMergeStrategy}'`) + } + } + if (_options){ + _config = { + baseServer: _options.baseServer || this.configuration.baseServer, + httpApi: _options.httpApi || this.configuration.httpApi, + authMethods: _options.authMethods || this.configuration.authMethods, + middleware: allMiddleware || this.configuration.middleware + }; + } + + const requestContextPromise = this.requestFactory.testEchoBodyPetResponseString(pet, _config); // build promise chain let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { + for (const middleware of allMiddleware) { 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) { + for (const middleware of allMiddleware.reverse()) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testEchoBodyPetResponseStringWithHttpInfo(rsp))); @@ -369,7 +660,7 @@ export class ObservableBodyApi { * Test empty response body * @param [pet] Pet object that needs to be added to the store */ - public testEchoBodyPetResponseString(pet?: Pet, _options?: Configuration): Observable { + public testEchoBodyPetResponseString(pet?: Pet, _options?: ConfigurationOptions): Observable { return this.testEchoBodyPetResponseStringWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); } @@ -378,19 +669,48 @@ export class ObservableBodyApi { * Test string enum response body * @param [body] String enum */ - public testEchoBodyStringEnumWithHttpInfo(body?: string, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.testEchoBodyStringEnum(body, _options); - + public testEchoBodyStringEnumWithHttpInfo(body?: string, _options?: ConfigurationOptions): Observable> { + let _config = this.configuration; + let allMiddleware: Middleware[] = []; + if (_options && _options.middleware){ + const middlewareMergeStrategy = _options.middlewareMergeStrategy || 'replace' // default to replace behavior + // call-time middleware provided + const calltimeMiddleware: Middleware[] = _options.middleware; + + switch(middlewareMergeStrategy){ + case 'append': + allMiddleware = this.configuration.middleware.concat(calltimeMiddleware); + break; + case 'prepend': + allMiddleware = calltimeMiddleware.concat(this.configuration.middleware) + break; + case 'replace': + allMiddleware = calltimeMiddleware + break; + default: + throw new Error(`unrecognized middleware merge strategy '${middlewareMergeStrategy}'`) + } + } + if (_options){ + _config = { + baseServer: _options.baseServer || this.configuration.baseServer, + httpApi: _options.httpApi || this.configuration.httpApi, + authMethods: _options.authMethods || this.configuration.authMethods, + middleware: allMiddleware || this.configuration.middleware + }; + } + + const requestContextPromise = this.requestFactory.testEchoBodyStringEnum(body, _config); // build promise chain let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { + for (const middleware of allMiddleware) { 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) { + for (const middleware of allMiddleware.reverse()) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testEchoBodyStringEnumWithHttpInfo(rsp))); @@ -402,7 +722,7 @@ export class ObservableBodyApi { * Test string enum response body * @param [body] String enum */ - public testEchoBodyStringEnum(body?: string, _options?: Configuration): Observable { + public testEchoBodyStringEnum(body?: string, _options?: ConfigurationOptions): Observable { return this.testEchoBodyStringEnumWithHttpInfo(body, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); } @@ -411,19 +731,48 @@ export class ObservableBodyApi { * Test empty json (request body) * @param [tag] Tag object */ - public testEchoBodyTagResponseStringWithHttpInfo(tag?: Tag, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.testEchoBodyTagResponseString(tag, _options); - + public testEchoBodyTagResponseStringWithHttpInfo(tag?: Tag, _options?: ConfigurationOptions): Observable> { + let _config = this.configuration; + let allMiddleware: Middleware[] = []; + if (_options && _options.middleware){ + const middlewareMergeStrategy = _options.middlewareMergeStrategy || 'replace' // default to replace behavior + // call-time middleware provided + const calltimeMiddleware: Middleware[] = _options.middleware; + + switch(middlewareMergeStrategy){ + case 'append': + allMiddleware = this.configuration.middleware.concat(calltimeMiddleware); + break; + case 'prepend': + allMiddleware = calltimeMiddleware.concat(this.configuration.middleware) + break; + case 'replace': + allMiddleware = calltimeMiddleware + break; + default: + throw new Error(`unrecognized middleware merge strategy '${middlewareMergeStrategy}'`) + } + } + if (_options){ + _config = { + baseServer: _options.baseServer || this.configuration.baseServer, + httpApi: _options.httpApi || this.configuration.httpApi, + authMethods: _options.authMethods || this.configuration.authMethods, + middleware: allMiddleware || this.configuration.middleware + }; + } + + const requestContextPromise = this.requestFactory.testEchoBodyTagResponseString(tag, _config); // build promise chain let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { + for (const middleware of allMiddleware) { 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) { + for (const middleware of allMiddleware.reverse()) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testEchoBodyTagResponseStringWithHttpInfo(rsp))); @@ -435,7 +784,7 @@ export class ObservableBodyApi { * Test empty json (request body) * @param [tag] Tag object */ - public testEchoBodyTagResponseString(tag?: Tag, _options?: Configuration): Observable { + public testEchoBodyTagResponseString(tag?: Tag, _options?: ConfigurationOptions): Observable { return this.testEchoBodyTagResponseStringWithHttpInfo(tag, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); } @@ -464,19 +813,48 @@ export class ObservableFormApi { * @param [booleanForm] * @param [stringForm] */ - public testFormIntegerBooleanStringWithHttpInfo(integerForm?: number, booleanForm?: boolean, stringForm?: string, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.testFormIntegerBooleanString(integerForm, booleanForm, stringForm, _options); - + public testFormIntegerBooleanStringWithHttpInfo(integerForm?: number, booleanForm?: boolean, stringForm?: string, _options?: ConfigurationOptions): Observable> { + let _config = this.configuration; + let allMiddleware: Middleware[] = []; + if (_options && _options.middleware){ + const middlewareMergeStrategy = _options.middlewareMergeStrategy || 'replace' // default to replace behavior + // call-time middleware provided + const calltimeMiddleware: Middleware[] = _options.middleware; + + switch(middlewareMergeStrategy){ + case 'append': + allMiddleware = this.configuration.middleware.concat(calltimeMiddleware); + break; + case 'prepend': + allMiddleware = calltimeMiddleware.concat(this.configuration.middleware) + break; + case 'replace': + allMiddleware = calltimeMiddleware + break; + default: + throw new Error(`unrecognized middleware merge strategy '${middlewareMergeStrategy}'`) + } + } + if (_options){ + _config = { + baseServer: _options.baseServer || this.configuration.baseServer, + httpApi: _options.httpApi || this.configuration.httpApi, + authMethods: _options.authMethods || this.configuration.authMethods, + middleware: allMiddleware || this.configuration.middleware + }; + } + + const requestContextPromise = this.requestFactory.testFormIntegerBooleanString(integerForm, booleanForm, stringForm, _config); // build promise chain let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { + for (const middleware of allMiddleware) { 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) { + for (const middleware of allMiddleware.reverse()) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testFormIntegerBooleanStringWithHttpInfo(rsp))); @@ -490,7 +868,7 @@ export class ObservableFormApi { * @param [booleanForm] * @param [stringForm] */ - public testFormIntegerBooleanString(integerForm?: number, booleanForm?: boolean, stringForm?: string, _options?: Configuration): Observable { + public testFormIntegerBooleanString(integerForm?: number, booleanForm?: boolean, stringForm?: string, _options?: ConfigurationOptions): Observable { return this.testFormIntegerBooleanStringWithHttpInfo(integerForm, booleanForm, stringForm, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); } @@ -499,19 +877,48 @@ export class ObservableFormApi { * Test form parameter(s) for multipart schema * @param marker */ - public testFormObjectMultipartWithHttpInfo(marker: TestFormObjectMultipartRequestMarker, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.testFormObjectMultipart(marker, _options); - + public testFormObjectMultipartWithHttpInfo(marker: TestFormObjectMultipartRequestMarker, _options?: ConfigurationOptions): Observable> { + let _config = this.configuration; + let allMiddleware: Middleware[] = []; + if (_options && _options.middleware){ + const middlewareMergeStrategy = _options.middlewareMergeStrategy || 'replace' // default to replace behavior + // call-time middleware provided + const calltimeMiddleware: Middleware[] = _options.middleware; + + switch(middlewareMergeStrategy){ + case 'append': + allMiddleware = this.configuration.middleware.concat(calltimeMiddleware); + break; + case 'prepend': + allMiddleware = calltimeMiddleware.concat(this.configuration.middleware) + break; + case 'replace': + allMiddleware = calltimeMiddleware + break; + default: + throw new Error(`unrecognized middleware merge strategy '${middlewareMergeStrategy}'`) + } + } + if (_options){ + _config = { + baseServer: _options.baseServer || this.configuration.baseServer, + httpApi: _options.httpApi || this.configuration.httpApi, + authMethods: _options.authMethods || this.configuration.authMethods, + middleware: allMiddleware || this.configuration.middleware + }; + } + + const requestContextPromise = this.requestFactory.testFormObjectMultipart(marker, _config); // build promise chain let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { + for (const middleware of allMiddleware) { 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) { + for (const middleware of allMiddleware.reverse()) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testFormObjectMultipartWithHttpInfo(rsp))); @@ -523,7 +930,7 @@ export class ObservableFormApi { * Test form parameter(s) for multipart schema * @param marker */ - public testFormObjectMultipart(marker: TestFormObjectMultipartRequestMarker, _options?: Configuration): Observable { + public testFormObjectMultipart(marker: TestFormObjectMultipartRequestMarker, _options?: ConfigurationOptions): Observable { return this.testFormObjectMultipartWithHttpInfo(marker, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); } @@ -537,19 +944,48 @@ export class ObservableFormApi { * @param [id] * @param [name] */ - public testFormOneofWithHttpInfo(form1?: string, form2?: number, form3?: string, form4?: boolean, id?: number, name?: string, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.testFormOneof(form1, form2, form3, form4, id, name, _options); - + public testFormOneofWithHttpInfo(form1?: string, form2?: number, form3?: string, form4?: boolean, id?: number, name?: string, _options?: ConfigurationOptions): Observable> { + let _config = this.configuration; + let allMiddleware: Middleware[] = []; + if (_options && _options.middleware){ + const middlewareMergeStrategy = _options.middlewareMergeStrategy || 'replace' // default to replace behavior + // call-time middleware provided + const calltimeMiddleware: Middleware[] = _options.middleware; + + switch(middlewareMergeStrategy){ + case 'append': + allMiddleware = this.configuration.middleware.concat(calltimeMiddleware); + break; + case 'prepend': + allMiddleware = calltimeMiddleware.concat(this.configuration.middleware) + break; + case 'replace': + allMiddleware = calltimeMiddleware + break; + default: + throw new Error(`unrecognized middleware merge strategy '${middlewareMergeStrategy}'`) + } + } + if (_options){ + _config = { + baseServer: _options.baseServer || this.configuration.baseServer, + httpApi: _options.httpApi || this.configuration.httpApi, + authMethods: _options.authMethods || this.configuration.authMethods, + middleware: allMiddleware || this.configuration.middleware + }; + } + + const requestContextPromise = this.requestFactory.testFormOneof(form1, form2, form3, form4, id, name, _config); // build promise chain let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { + for (const middleware of allMiddleware) { 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) { + for (const middleware of allMiddleware.reverse()) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testFormOneofWithHttpInfo(rsp))); @@ -566,7 +1002,7 @@ export class ObservableFormApi { * @param [id] * @param [name] */ - public testFormOneof(form1?: string, form2?: number, form3?: string, form4?: boolean, id?: number, name?: string, _options?: Configuration): Observable { + public testFormOneof(form1?: string, form2?: number, form3?: string, form4?: boolean, id?: number, name?: string, _options?: ConfigurationOptions): Observable { return this.testFormOneofWithHttpInfo(form1, form2, form3, form4, id, name, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); } @@ -597,19 +1033,48 @@ export class ObservableHeaderApi { * @param [enumNonrefStringHeader] * @param [enumRefStringHeader] */ - public testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader?: number, booleanHeader?: boolean, stringHeader?: string, enumNonrefStringHeader?: 'success' | 'failure' | 'unclassified', enumRefStringHeader?: StringEnumRef, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.testHeaderIntegerBooleanStringEnums(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader, _options); - + public testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader?: number, booleanHeader?: boolean, stringHeader?: string, enumNonrefStringHeader?: 'success' | 'failure' | 'unclassified', enumRefStringHeader?: StringEnumRef, _options?: ConfigurationOptions): Observable> { + let _config = this.configuration; + let allMiddleware: Middleware[] = []; + if (_options && _options.middleware){ + const middlewareMergeStrategy = _options.middlewareMergeStrategy || 'replace' // default to replace behavior + // call-time middleware provided + const calltimeMiddleware: Middleware[] = _options.middleware; + + switch(middlewareMergeStrategy){ + case 'append': + allMiddleware = this.configuration.middleware.concat(calltimeMiddleware); + break; + case 'prepend': + allMiddleware = calltimeMiddleware.concat(this.configuration.middleware) + break; + case 'replace': + allMiddleware = calltimeMiddleware + break; + default: + throw new Error(`unrecognized middleware merge strategy '${middlewareMergeStrategy}'`) + } + } + if (_options){ + _config = { + baseServer: _options.baseServer || this.configuration.baseServer, + httpApi: _options.httpApi || this.configuration.httpApi, + authMethods: _options.authMethods || this.configuration.authMethods, + middleware: allMiddleware || this.configuration.middleware + }; + } + + const requestContextPromise = this.requestFactory.testHeaderIntegerBooleanStringEnums(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader, _config); // build promise chain let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { + for (const middleware of allMiddleware) { 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) { + for (const middleware of allMiddleware.reverse()) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testHeaderIntegerBooleanStringEnumsWithHttpInfo(rsp))); @@ -625,7 +1090,7 @@ export class ObservableHeaderApi { * @param [enumNonrefStringHeader] * @param [enumRefStringHeader] */ - public testHeaderIntegerBooleanStringEnums(integerHeader?: number, booleanHeader?: boolean, stringHeader?: string, enumNonrefStringHeader?: 'success' | 'failure' | 'unclassified', enumRefStringHeader?: StringEnumRef, _options?: Configuration): Observable { + public testHeaderIntegerBooleanStringEnums(integerHeader?: number, booleanHeader?: boolean, stringHeader?: string, enumNonrefStringHeader?: 'success' | 'failure' | 'unclassified', enumRefStringHeader?: StringEnumRef, _options?: ConfigurationOptions): Observable { return this.testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); } @@ -655,19 +1120,48 @@ export class ObservablePathApi { * @param enumNonrefStringPath * @param enumRefStringPath */ - public testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString: string, pathInteger: number, enumNonrefStringPath: 'success' | 'failure' | 'unclassified', enumRefStringPath: StringEnumRef, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath, _options); - + public testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString: string, pathInteger: number, enumNonrefStringPath: 'success' | 'failure' | 'unclassified', enumRefStringPath: StringEnumRef, _options?: ConfigurationOptions): Observable> { + let _config = this.configuration; + let allMiddleware: Middleware[] = []; + if (_options && _options.middleware){ + const middlewareMergeStrategy = _options.middlewareMergeStrategy || 'replace' // default to replace behavior + // call-time middleware provided + const calltimeMiddleware: Middleware[] = _options.middleware; + + switch(middlewareMergeStrategy){ + case 'append': + allMiddleware = this.configuration.middleware.concat(calltimeMiddleware); + break; + case 'prepend': + allMiddleware = calltimeMiddleware.concat(this.configuration.middleware) + break; + case 'replace': + allMiddleware = calltimeMiddleware + break; + default: + throw new Error(`unrecognized middleware merge strategy '${middlewareMergeStrategy}'`) + } + } + if (_options){ + _config = { + baseServer: _options.baseServer || this.configuration.baseServer, + httpApi: _options.httpApi || this.configuration.httpApi, + authMethods: _options.authMethods || this.configuration.authMethods, + middleware: allMiddleware || this.configuration.middleware + }; + } + + const requestContextPromise = this.requestFactory.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath, _config); // build promise chain let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { + for (const middleware of allMiddleware) { 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) { + for (const middleware of allMiddleware.reverse()) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(rsp))); @@ -682,7 +1176,7 @@ export class ObservablePathApi { * @param enumNonrefStringPath * @param enumRefStringPath */ - public testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString: string, pathInteger: number, enumNonrefStringPath: 'success' | 'failure' | 'unclassified', enumRefStringPath: StringEnumRef, _options?: Configuration): Observable { + public testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString: string, pathInteger: number, enumNonrefStringPath: 'success' | 'failure' | 'unclassified', enumRefStringPath: StringEnumRef, _options?: ConfigurationOptions): Observable { return this.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); } @@ -710,19 +1204,48 @@ export class ObservableQueryApi { * @param [enumNonrefStringQuery] * @param [enumRefStringQuery] */ - public testEnumRefStringWithHttpInfo(enumNonrefStringQuery?: 'success' | 'failure' | 'unclassified', enumRefStringQuery?: StringEnumRef, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.testEnumRefString(enumNonrefStringQuery, enumRefStringQuery, _options); - + public testEnumRefStringWithHttpInfo(enumNonrefStringQuery?: 'success' | 'failure' | 'unclassified', enumRefStringQuery?: StringEnumRef, _options?: ConfigurationOptions): Observable> { + let _config = this.configuration; + let allMiddleware: Middleware[] = []; + if (_options && _options.middleware){ + const middlewareMergeStrategy = _options.middlewareMergeStrategy || 'replace' // default to replace behavior + // call-time middleware provided + const calltimeMiddleware: Middleware[] = _options.middleware; + + switch(middlewareMergeStrategy){ + case 'append': + allMiddleware = this.configuration.middleware.concat(calltimeMiddleware); + break; + case 'prepend': + allMiddleware = calltimeMiddleware.concat(this.configuration.middleware) + break; + case 'replace': + allMiddleware = calltimeMiddleware + break; + default: + throw new Error(`unrecognized middleware merge strategy '${middlewareMergeStrategy}'`) + } + } + if (_options){ + _config = { + baseServer: _options.baseServer || this.configuration.baseServer, + httpApi: _options.httpApi || this.configuration.httpApi, + authMethods: _options.authMethods || this.configuration.authMethods, + middleware: allMiddleware || this.configuration.middleware + }; + } + + const requestContextPromise = this.requestFactory.testEnumRefString(enumNonrefStringQuery, enumRefStringQuery, _config); // build promise chain let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { + for (const middleware of allMiddleware) { 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) { + for (const middleware of allMiddleware.reverse()) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testEnumRefStringWithHttpInfo(rsp))); @@ -735,7 +1258,7 @@ export class ObservableQueryApi { * @param [enumNonrefStringQuery] * @param [enumRefStringQuery] */ - public testEnumRefString(enumNonrefStringQuery?: 'success' | 'failure' | 'unclassified', enumRefStringQuery?: StringEnumRef, _options?: Configuration): Observable { + public testEnumRefString(enumNonrefStringQuery?: 'success' | 'failure' | 'unclassified', enumRefStringQuery?: StringEnumRef, _options?: ConfigurationOptions): Observable { return this.testEnumRefStringWithHttpInfo(enumNonrefStringQuery, enumRefStringQuery, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); } @@ -746,19 +1269,48 @@ export class ObservableQueryApi { * @param [dateQuery] * @param [stringQuery] */ - public testQueryDatetimeDateStringWithHttpInfo(datetimeQuery?: Date, dateQuery?: string, stringQuery?: string, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.testQueryDatetimeDateString(datetimeQuery, dateQuery, stringQuery, _options); - + public testQueryDatetimeDateStringWithHttpInfo(datetimeQuery?: Date, dateQuery?: string, stringQuery?: string, _options?: ConfigurationOptions): Observable> { + let _config = this.configuration; + let allMiddleware: Middleware[] = []; + if (_options && _options.middleware){ + const middlewareMergeStrategy = _options.middlewareMergeStrategy || 'replace' // default to replace behavior + // call-time middleware provided + const calltimeMiddleware: Middleware[] = _options.middleware; + + switch(middlewareMergeStrategy){ + case 'append': + allMiddleware = this.configuration.middleware.concat(calltimeMiddleware); + break; + case 'prepend': + allMiddleware = calltimeMiddleware.concat(this.configuration.middleware) + break; + case 'replace': + allMiddleware = calltimeMiddleware + break; + default: + throw new Error(`unrecognized middleware merge strategy '${middlewareMergeStrategy}'`) + } + } + if (_options){ + _config = { + baseServer: _options.baseServer || this.configuration.baseServer, + httpApi: _options.httpApi || this.configuration.httpApi, + authMethods: _options.authMethods || this.configuration.authMethods, + middleware: allMiddleware || this.configuration.middleware + }; + } + + const requestContextPromise = this.requestFactory.testQueryDatetimeDateString(datetimeQuery, dateQuery, stringQuery, _config); // build promise chain let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { + for (const middleware of allMiddleware) { 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) { + for (const middleware of allMiddleware.reverse()) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testQueryDatetimeDateStringWithHttpInfo(rsp))); @@ -772,7 +1324,7 @@ export class ObservableQueryApi { * @param [dateQuery] * @param [stringQuery] */ - public testQueryDatetimeDateString(datetimeQuery?: Date, dateQuery?: string, stringQuery?: string, _options?: Configuration): Observable { + public testQueryDatetimeDateString(datetimeQuery?: Date, dateQuery?: string, stringQuery?: string, _options?: ConfigurationOptions): Observable { return this.testQueryDatetimeDateStringWithHttpInfo(datetimeQuery, dateQuery, stringQuery, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); } @@ -783,19 +1335,48 @@ export class ObservableQueryApi { * @param [booleanQuery] * @param [stringQuery] */ - public testQueryIntegerBooleanStringWithHttpInfo(integerQuery?: number, booleanQuery?: boolean, stringQuery?: string, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery, _options); - + public testQueryIntegerBooleanStringWithHttpInfo(integerQuery?: number, booleanQuery?: boolean, stringQuery?: string, _options?: ConfigurationOptions): Observable> { + let _config = this.configuration; + let allMiddleware: Middleware[] = []; + if (_options && _options.middleware){ + const middlewareMergeStrategy = _options.middlewareMergeStrategy || 'replace' // default to replace behavior + // call-time middleware provided + const calltimeMiddleware: Middleware[] = _options.middleware; + + switch(middlewareMergeStrategy){ + case 'append': + allMiddleware = this.configuration.middleware.concat(calltimeMiddleware); + break; + case 'prepend': + allMiddleware = calltimeMiddleware.concat(this.configuration.middleware) + break; + case 'replace': + allMiddleware = calltimeMiddleware + break; + default: + throw new Error(`unrecognized middleware merge strategy '${middlewareMergeStrategy}'`) + } + } + if (_options){ + _config = { + baseServer: _options.baseServer || this.configuration.baseServer, + httpApi: _options.httpApi || this.configuration.httpApi, + authMethods: _options.authMethods || this.configuration.authMethods, + middleware: allMiddleware || this.configuration.middleware + }; + } + + const requestContextPromise = this.requestFactory.testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery, _config); // build promise chain let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { + for (const middleware of allMiddleware) { 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) { + for (const middleware of allMiddleware.reverse()) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testQueryIntegerBooleanStringWithHttpInfo(rsp))); @@ -809,7 +1390,7 @@ export class ObservableQueryApi { * @param [booleanQuery] * @param [stringQuery] */ - public testQueryIntegerBooleanString(integerQuery?: number, booleanQuery?: boolean, stringQuery?: string, _options?: Configuration): Observable { + public testQueryIntegerBooleanString(integerQuery?: number, booleanQuery?: boolean, stringQuery?: string, _options?: ConfigurationOptions): Observable { return this.testQueryIntegerBooleanStringWithHttpInfo(integerQuery, booleanQuery, stringQuery, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); } @@ -818,19 +1399,48 @@ export class ObservableQueryApi { * Test query parameter(s) * @param [queryObject] */ - public testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject?: Pet, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.testQueryStyleDeepObjectExplodeTrueObject(queryObject, _options); - + public testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject?: Pet, _options?: ConfigurationOptions): Observable> { + let _config = this.configuration; + let allMiddleware: Middleware[] = []; + if (_options && _options.middleware){ + const middlewareMergeStrategy = _options.middlewareMergeStrategy || 'replace' // default to replace behavior + // call-time middleware provided + const calltimeMiddleware: Middleware[] = _options.middleware; + + switch(middlewareMergeStrategy){ + case 'append': + allMiddleware = this.configuration.middleware.concat(calltimeMiddleware); + break; + case 'prepend': + allMiddleware = calltimeMiddleware.concat(this.configuration.middleware) + break; + case 'replace': + allMiddleware = calltimeMiddleware + break; + default: + throw new Error(`unrecognized middleware merge strategy '${middlewareMergeStrategy}'`) + } + } + if (_options){ + _config = { + baseServer: _options.baseServer || this.configuration.baseServer, + httpApi: _options.httpApi || this.configuration.httpApi, + authMethods: _options.authMethods || this.configuration.authMethods, + middleware: allMiddleware || this.configuration.middleware + }; + } + + const requestContextPromise = this.requestFactory.testQueryStyleDeepObjectExplodeTrueObject(queryObject, _config); // build promise chain let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { + for (const middleware of allMiddleware) { 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) { + for (const middleware of allMiddleware.reverse()) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(rsp))); @@ -842,7 +1452,7 @@ export class ObservableQueryApi { * Test query parameter(s) * @param [queryObject] */ - public testQueryStyleDeepObjectExplodeTrueObject(queryObject?: Pet, _options?: Configuration): Observable { + public testQueryStyleDeepObjectExplodeTrueObject(queryObject?: Pet, _options?: ConfigurationOptions): Observable { return this.testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); } @@ -851,19 +1461,48 @@ export class ObservableQueryApi { * Test query parameter(s) * @param [queryObject] */ - public testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(queryObject?: TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.testQueryStyleDeepObjectExplodeTrueObjectAllOf(queryObject, _options); - + public testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(queryObject?: TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter, _options?: ConfigurationOptions): Observable> { + let _config = this.configuration; + let allMiddleware: Middleware[] = []; + if (_options && _options.middleware){ + const middlewareMergeStrategy = _options.middlewareMergeStrategy || 'replace' // default to replace behavior + // call-time middleware provided + const calltimeMiddleware: Middleware[] = _options.middleware; + + switch(middlewareMergeStrategy){ + case 'append': + allMiddleware = this.configuration.middleware.concat(calltimeMiddleware); + break; + case 'prepend': + allMiddleware = calltimeMiddleware.concat(this.configuration.middleware) + break; + case 'replace': + allMiddleware = calltimeMiddleware + break; + default: + throw new Error(`unrecognized middleware merge strategy '${middlewareMergeStrategy}'`) + } + } + if (_options){ + _config = { + baseServer: _options.baseServer || this.configuration.baseServer, + httpApi: _options.httpApi || this.configuration.httpApi, + authMethods: _options.authMethods || this.configuration.authMethods, + middleware: allMiddleware || this.configuration.middleware + }; + } + + const requestContextPromise = this.requestFactory.testQueryStyleDeepObjectExplodeTrueObjectAllOf(queryObject, _config); // build promise chain let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { + for (const middleware of allMiddleware) { 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) { + for (const middleware of allMiddleware.reverse()) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(rsp))); @@ -875,7 +1514,7 @@ export class ObservableQueryApi { * Test query parameter(s) * @param [queryObject] */ - public testQueryStyleDeepObjectExplodeTrueObjectAllOf(queryObject?: TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter, _options?: Configuration): Observable { + public testQueryStyleDeepObjectExplodeTrueObjectAllOf(queryObject?: TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter, _options?: ConfigurationOptions): Observable { return this.testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(queryObject, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); } @@ -884,19 +1523,48 @@ export class ObservableQueryApi { * Test query parameter(s) * @param [queryObject] */ - public testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(queryObject?: Array, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.testQueryStyleFormExplodeFalseArrayInteger(queryObject, _options); - + public testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(queryObject?: Array, _options?: ConfigurationOptions): Observable> { + let _config = this.configuration; + let allMiddleware: Middleware[] = []; + if (_options && _options.middleware){ + const middlewareMergeStrategy = _options.middlewareMergeStrategy || 'replace' // default to replace behavior + // call-time middleware provided + const calltimeMiddleware: Middleware[] = _options.middleware; + + switch(middlewareMergeStrategy){ + case 'append': + allMiddleware = this.configuration.middleware.concat(calltimeMiddleware); + break; + case 'prepend': + allMiddleware = calltimeMiddleware.concat(this.configuration.middleware) + break; + case 'replace': + allMiddleware = calltimeMiddleware + break; + default: + throw new Error(`unrecognized middleware merge strategy '${middlewareMergeStrategy}'`) + } + } + if (_options){ + _config = { + baseServer: _options.baseServer || this.configuration.baseServer, + httpApi: _options.httpApi || this.configuration.httpApi, + authMethods: _options.authMethods || this.configuration.authMethods, + middleware: allMiddleware || this.configuration.middleware + }; + } + + const requestContextPromise = this.requestFactory.testQueryStyleFormExplodeFalseArrayInteger(queryObject, _config); // build promise chain let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { + for (const middleware of allMiddleware) { 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) { + for (const middleware of allMiddleware.reverse()) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(rsp))); @@ -908,7 +1576,7 @@ export class ObservableQueryApi { * Test query parameter(s) * @param [queryObject] */ - public testQueryStyleFormExplodeFalseArrayInteger(queryObject?: Array, _options?: Configuration): Observable { + public testQueryStyleFormExplodeFalseArrayInteger(queryObject?: Array, _options?: ConfigurationOptions): Observable { return this.testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(queryObject, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); } @@ -917,19 +1585,48 @@ export class ObservableQueryApi { * Test query parameter(s) * @param [queryObject] */ - public testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(queryObject?: Array, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.testQueryStyleFormExplodeFalseArrayString(queryObject, _options); - + public testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(queryObject?: Array, _options?: ConfigurationOptions): Observable> { + let _config = this.configuration; + let allMiddleware: Middleware[] = []; + if (_options && _options.middleware){ + const middlewareMergeStrategy = _options.middlewareMergeStrategy || 'replace' // default to replace behavior + // call-time middleware provided + const calltimeMiddleware: Middleware[] = _options.middleware; + + switch(middlewareMergeStrategy){ + case 'append': + allMiddleware = this.configuration.middleware.concat(calltimeMiddleware); + break; + case 'prepend': + allMiddleware = calltimeMiddleware.concat(this.configuration.middleware) + break; + case 'replace': + allMiddleware = calltimeMiddleware + break; + default: + throw new Error(`unrecognized middleware merge strategy '${middlewareMergeStrategy}'`) + } + } + if (_options){ + _config = { + baseServer: _options.baseServer || this.configuration.baseServer, + httpApi: _options.httpApi || this.configuration.httpApi, + authMethods: _options.authMethods || this.configuration.authMethods, + middleware: allMiddleware || this.configuration.middleware + }; + } + + const requestContextPromise = this.requestFactory.testQueryStyleFormExplodeFalseArrayString(queryObject, _config); // build promise chain let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { + for (const middleware of allMiddleware) { 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) { + for (const middleware of allMiddleware.reverse()) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(rsp))); @@ -941,7 +1638,7 @@ export class ObservableQueryApi { * Test query parameter(s) * @param [queryObject] */ - public testQueryStyleFormExplodeFalseArrayString(queryObject?: Array, _options?: Configuration): Observable { + public testQueryStyleFormExplodeFalseArrayString(queryObject?: Array, _options?: ConfigurationOptions): Observable { return this.testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(queryObject, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); } @@ -950,19 +1647,48 @@ export class ObservableQueryApi { * Test query parameter(s) * @param [queryObject] */ - public testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject?: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.testQueryStyleFormExplodeTrueArrayString(queryObject, _options); - + public testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject?: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter, _options?: ConfigurationOptions): Observable> { + let _config = this.configuration; + let allMiddleware: Middleware[] = []; + if (_options && _options.middleware){ + const middlewareMergeStrategy = _options.middlewareMergeStrategy || 'replace' // default to replace behavior + // call-time middleware provided + const calltimeMiddleware: Middleware[] = _options.middleware; + + switch(middlewareMergeStrategy){ + case 'append': + allMiddleware = this.configuration.middleware.concat(calltimeMiddleware); + break; + case 'prepend': + allMiddleware = calltimeMiddleware.concat(this.configuration.middleware) + break; + case 'replace': + allMiddleware = calltimeMiddleware + break; + default: + throw new Error(`unrecognized middleware merge strategy '${middlewareMergeStrategy}'`) + } + } + if (_options){ + _config = { + baseServer: _options.baseServer || this.configuration.baseServer, + httpApi: _options.httpApi || this.configuration.httpApi, + authMethods: _options.authMethods || this.configuration.authMethods, + middleware: allMiddleware || this.configuration.middleware + }; + } + + const requestContextPromise = this.requestFactory.testQueryStyleFormExplodeTrueArrayString(queryObject, _config); // build promise chain let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { + for (const middleware of allMiddleware) { 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) { + for (const middleware of allMiddleware.reverse()) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(rsp))); @@ -974,7 +1700,7 @@ export class ObservableQueryApi { * Test query parameter(s) * @param [queryObject] */ - public testQueryStyleFormExplodeTrueArrayString(queryObject?: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter, _options?: Configuration): Observable { + public testQueryStyleFormExplodeTrueArrayString(queryObject?: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter, _options?: ConfigurationOptions): Observable { return this.testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); } @@ -983,19 +1709,48 @@ export class ObservableQueryApi { * Test query parameter(s) * @param [queryObject] */ - public testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject?: Pet, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.testQueryStyleFormExplodeTrueObject(queryObject, _options); - + public testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject?: Pet, _options?: ConfigurationOptions): Observable> { + let _config = this.configuration; + let allMiddleware: Middleware[] = []; + if (_options && _options.middleware){ + const middlewareMergeStrategy = _options.middlewareMergeStrategy || 'replace' // default to replace behavior + // call-time middleware provided + const calltimeMiddleware: Middleware[] = _options.middleware; + + switch(middlewareMergeStrategy){ + case 'append': + allMiddleware = this.configuration.middleware.concat(calltimeMiddleware); + break; + case 'prepend': + allMiddleware = calltimeMiddleware.concat(this.configuration.middleware) + break; + case 'replace': + allMiddleware = calltimeMiddleware + break; + default: + throw new Error(`unrecognized middleware merge strategy '${middlewareMergeStrategy}'`) + } + } + if (_options){ + _config = { + baseServer: _options.baseServer || this.configuration.baseServer, + httpApi: _options.httpApi || this.configuration.httpApi, + authMethods: _options.authMethods || this.configuration.authMethods, + middleware: allMiddleware || this.configuration.middleware + }; + } + + const requestContextPromise = this.requestFactory.testQueryStyleFormExplodeTrueObject(queryObject, _config); // build promise chain let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { + for (const middleware of allMiddleware) { 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) { + for (const middleware of allMiddleware.reverse()) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testQueryStyleFormExplodeTrueObjectWithHttpInfo(rsp))); @@ -1007,7 +1762,7 @@ export class ObservableQueryApi { * Test query parameter(s) * @param [queryObject] */ - public testQueryStyleFormExplodeTrueObject(queryObject?: Pet, _options?: Configuration): Observable { + public testQueryStyleFormExplodeTrueObject(queryObject?: Pet, _options?: ConfigurationOptions): Observable { return this.testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); } @@ -1016,19 +1771,48 @@ export class ObservableQueryApi { * Test query parameter(s) * @param [queryObject] */ - public testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(queryObject?: DataQuery, _options?: Configuration): Observable> { - const requestContextPromise = this.requestFactory.testQueryStyleFormExplodeTrueObjectAllOf(queryObject, _options); - + public testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(queryObject?: DataQuery, _options?: ConfigurationOptions): Observable> { + let _config = this.configuration; + let allMiddleware: Middleware[] = []; + if (_options && _options.middleware){ + const middlewareMergeStrategy = _options.middlewareMergeStrategy || 'replace' // default to replace behavior + // call-time middleware provided + const calltimeMiddleware: Middleware[] = _options.middleware; + + switch(middlewareMergeStrategy){ + case 'append': + allMiddleware = this.configuration.middleware.concat(calltimeMiddleware); + break; + case 'prepend': + allMiddleware = calltimeMiddleware.concat(this.configuration.middleware) + break; + case 'replace': + allMiddleware = calltimeMiddleware + break; + default: + throw new Error(`unrecognized middleware merge strategy '${middlewareMergeStrategy}'`) + } + } + if (_options){ + _config = { + baseServer: _options.baseServer || this.configuration.baseServer, + httpApi: _options.httpApi || this.configuration.httpApi, + authMethods: _options.authMethods || this.configuration.authMethods, + middleware: allMiddleware || this.configuration.middleware + }; + } + + const requestContextPromise = this.requestFactory.testQueryStyleFormExplodeTrueObjectAllOf(queryObject, _config); // build promise chain let middlewarePreObservable = from(requestContextPromise); - for (const middleware of this.configuration.middleware) { + for (const middleware of allMiddleware) { 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) { + for (const middleware of allMiddleware.reverse()) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(rsp))); @@ -1040,7 +1824,7 @@ export class ObservableQueryApi { * Test query parameter(s) * @param [queryObject] */ - public testQueryStyleFormExplodeTrueObjectAllOf(queryObject?: DataQuery, _options?: Configuration): Observable { + public testQueryStyleFormExplodeTrueObjectAllOf(queryObject?: DataQuery, _options?: ConfigurationOptions): Observable { return this.testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(queryObject, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); } diff --git a/samples/client/echo_api/typescript/build/types/PromiseAPI.ts b/samples/client/echo_api/typescript/build/types/PromiseAPI.ts index a0fde7619715..23aa5f09a596 100644 --- a/samples/client/echo_api/typescript/build/types/PromiseAPI.ts +++ b/samples/client/echo_api/typescript/build/types/PromiseAPI.ts @@ -1,5 +1,6 @@ import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; -import { Configuration} from '../configuration' +import { Configuration, ConfigurationOptions, PromiseConfigurationOptions } from '../configuration' +import { PromiseMiddleware, Middleware, PromiseMiddlewareWrapper } from '../middleware'; import { Bird } from '../models/Bird'; import { Category } from '../models/Category'; @@ -31,8 +32,20 @@ export class PromiseAuthApi { * To test HTTP basic authentication * To test HTTP basic authentication */ - public testAuthHttpBasicWithHttpInfo(_options?: Configuration): Promise> { - const result = this.api.testAuthHttpBasicWithHttpInfo(_options); + public testAuthHttpBasicWithHttpInfo(_options?: PromiseConfigurationOptions): Promise> { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testAuthHttpBasicWithHttpInfo(observableOptions); return result.toPromise(); } @@ -40,8 +53,20 @@ export class PromiseAuthApi { * To test HTTP basic authentication * To test HTTP basic authentication */ - public testAuthHttpBasic(_options?: Configuration): Promise { - const result = this.api.testAuthHttpBasic(_options); + public testAuthHttpBasic(_options?: PromiseConfigurationOptions): Promise { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testAuthHttpBasic(observableOptions); return result.toPromise(); } @@ -49,8 +74,20 @@ export class PromiseAuthApi { * To test HTTP bearer authentication * To test HTTP bearer authentication */ - public testAuthHttpBearerWithHttpInfo(_options?: Configuration): Promise> { - const result = this.api.testAuthHttpBearerWithHttpInfo(_options); + public testAuthHttpBearerWithHttpInfo(_options?: PromiseConfigurationOptions): Promise> { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testAuthHttpBearerWithHttpInfo(observableOptions); return result.toPromise(); } @@ -58,8 +95,20 @@ export class PromiseAuthApi { * To test HTTP bearer authentication * To test HTTP bearer authentication */ - public testAuthHttpBearer(_options?: Configuration): Promise { - const result = this.api.testAuthHttpBearer(_options); + public testAuthHttpBearer(_options?: PromiseConfigurationOptions): Promise { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testAuthHttpBearer(observableOptions); return result.toPromise(); } @@ -86,8 +135,20 @@ export class PromiseBodyApi { * Test binary (gif) response body * Test binary (gif) response body */ - public testBinaryGifWithHttpInfo(_options?: Configuration): Promise> { - const result = this.api.testBinaryGifWithHttpInfo(_options); + public testBinaryGifWithHttpInfo(_options?: PromiseConfigurationOptions): Promise> { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testBinaryGifWithHttpInfo(observableOptions); return result.toPromise(); } @@ -95,8 +156,20 @@ export class PromiseBodyApi { * Test binary (gif) response body * Test binary (gif) response body */ - public testBinaryGif(_options?: Configuration): Promise { - const result = this.api.testBinaryGif(_options); + public testBinaryGif(_options?: PromiseConfigurationOptions): Promise { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testBinaryGif(observableOptions); return result.toPromise(); } @@ -105,8 +178,20 @@ export class PromiseBodyApi { * Test body parameter(s) * @param [body] */ - public testBodyApplicationOctetstreamBinaryWithHttpInfo(body?: HttpFile, _options?: Configuration): Promise> { - const result = this.api.testBodyApplicationOctetstreamBinaryWithHttpInfo(body, _options); + public testBodyApplicationOctetstreamBinaryWithHttpInfo(body?: HttpFile, _options?: PromiseConfigurationOptions): Promise> { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testBodyApplicationOctetstreamBinaryWithHttpInfo(body, observableOptions); return result.toPromise(); } @@ -115,8 +200,20 @@ export class PromiseBodyApi { * Test body parameter(s) * @param [body] */ - public testBodyApplicationOctetstreamBinary(body?: HttpFile, _options?: Configuration): Promise { - const result = this.api.testBodyApplicationOctetstreamBinary(body, _options); + public testBodyApplicationOctetstreamBinary(body?: HttpFile, _options?: PromiseConfigurationOptions): Promise { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testBodyApplicationOctetstreamBinary(body, observableOptions); return result.toPromise(); } @@ -125,8 +222,20 @@ export class PromiseBodyApi { * Test array of binary in multipart mime * @param files */ - public testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files: Array, _options?: Configuration): Promise> { - const result = this.api.testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files, _options); + public testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files: Array, _options?: PromiseConfigurationOptions): Promise> { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files, observableOptions); return result.toPromise(); } @@ -135,8 +244,20 @@ export class PromiseBodyApi { * Test array of binary in multipart mime * @param files */ - public testBodyMultipartFormdataArrayOfBinary(files: Array, _options?: Configuration): Promise { - const result = this.api.testBodyMultipartFormdataArrayOfBinary(files, _options); + public testBodyMultipartFormdataArrayOfBinary(files: Array, _options?: PromiseConfigurationOptions): Promise { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testBodyMultipartFormdataArrayOfBinary(files, observableOptions); return result.toPromise(); } @@ -145,8 +266,20 @@ export class PromiseBodyApi { * Test single binary in multipart mime * @param [myFile] */ - public testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile?: HttpFile, _options?: Configuration): Promise> { - const result = this.api.testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile, _options); + public testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile?: HttpFile, _options?: PromiseConfigurationOptions): Promise> { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile, observableOptions); return result.toPromise(); } @@ -155,8 +288,20 @@ export class PromiseBodyApi { * Test single binary in multipart mime * @param [myFile] */ - public testBodyMultipartFormdataSingleBinary(myFile?: HttpFile, _options?: Configuration): Promise { - const result = this.api.testBodyMultipartFormdataSingleBinary(myFile, _options); + public testBodyMultipartFormdataSingleBinary(myFile?: HttpFile, _options?: PromiseConfigurationOptions): Promise { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testBodyMultipartFormdataSingleBinary(myFile, observableOptions); return result.toPromise(); } @@ -165,8 +310,20 @@ export class PromiseBodyApi { * Test body parameter(s) * @param [pet] Pet object that needs to be added to the store */ - public testEchoBodyAllOfPetWithHttpInfo(pet?: Pet, _options?: Configuration): Promise> { - const result = this.api.testEchoBodyAllOfPetWithHttpInfo(pet, _options); + public testEchoBodyAllOfPetWithHttpInfo(pet?: Pet, _options?: PromiseConfigurationOptions): Promise> { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testEchoBodyAllOfPetWithHttpInfo(pet, observableOptions); return result.toPromise(); } @@ -175,8 +332,20 @@ export class PromiseBodyApi { * Test body parameter(s) * @param [pet] Pet object that needs to be added to the store */ - public testEchoBodyAllOfPet(pet?: Pet, _options?: Configuration): Promise { - const result = this.api.testEchoBodyAllOfPet(pet, _options); + public testEchoBodyAllOfPet(pet?: Pet, _options?: PromiseConfigurationOptions): Promise { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testEchoBodyAllOfPet(pet, observableOptions); return result.toPromise(); } @@ -185,8 +354,20 @@ export class PromiseBodyApi { * Test free form object * @param [body] Free form object */ - public testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body?: any, _options?: Configuration): Promise> { - const result = this.api.testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body, _options); + public testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body?: any, _options?: PromiseConfigurationOptions): Promise> { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body, observableOptions); return result.toPromise(); } @@ -195,8 +376,20 @@ export class PromiseBodyApi { * Test free form object * @param [body] Free form object */ - public testEchoBodyFreeFormObjectResponseString(body?: any, _options?: Configuration): Promise { - const result = this.api.testEchoBodyFreeFormObjectResponseString(body, _options); + public testEchoBodyFreeFormObjectResponseString(body?: any, _options?: PromiseConfigurationOptions): Promise { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testEchoBodyFreeFormObjectResponseString(body, observableOptions); return result.toPromise(); } @@ -205,8 +398,20 @@ export class PromiseBodyApi { * Test body parameter(s) * @param [pet] Pet object that needs to be added to the store */ - public testEchoBodyPetWithHttpInfo(pet?: Pet, _options?: Configuration): Promise> { - const result = this.api.testEchoBodyPetWithHttpInfo(pet, _options); + public testEchoBodyPetWithHttpInfo(pet?: Pet, _options?: PromiseConfigurationOptions): Promise> { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testEchoBodyPetWithHttpInfo(pet, observableOptions); return result.toPromise(); } @@ -215,8 +420,20 @@ export class PromiseBodyApi { * Test body parameter(s) * @param [pet] Pet object that needs to be added to the store */ - public testEchoBodyPet(pet?: Pet, _options?: Configuration): Promise { - const result = this.api.testEchoBodyPet(pet, _options); + public testEchoBodyPet(pet?: Pet, _options?: PromiseConfigurationOptions): Promise { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testEchoBodyPet(pet, observableOptions); return result.toPromise(); } @@ -225,8 +442,20 @@ export class PromiseBodyApi { * Test empty response body * @param [pet] Pet object that needs to be added to the store */ - public testEchoBodyPetResponseStringWithHttpInfo(pet?: Pet, _options?: Configuration): Promise> { - const result = this.api.testEchoBodyPetResponseStringWithHttpInfo(pet, _options); + public testEchoBodyPetResponseStringWithHttpInfo(pet?: Pet, _options?: PromiseConfigurationOptions): Promise> { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testEchoBodyPetResponseStringWithHttpInfo(pet, observableOptions); return result.toPromise(); } @@ -235,8 +464,20 @@ export class PromiseBodyApi { * Test empty response body * @param [pet] Pet object that needs to be added to the store */ - public testEchoBodyPetResponseString(pet?: Pet, _options?: Configuration): Promise { - const result = this.api.testEchoBodyPetResponseString(pet, _options); + public testEchoBodyPetResponseString(pet?: Pet, _options?: PromiseConfigurationOptions): Promise { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testEchoBodyPetResponseString(pet, observableOptions); return result.toPromise(); } @@ -245,8 +486,20 @@ export class PromiseBodyApi { * Test string enum response body * @param [body] String enum */ - public testEchoBodyStringEnumWithHttpInfo(body?: string, _options?: Configuration): Promise> { - const result = this.api.testEchoBodyStringEnumWithHttpInfo(body, _options); + public testEchoBodyStringEnumWithHttpInfo(body?: string, _options?: PromiseConfigurationOptions): Promise> { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testEchoBodyStringEnumWithHttpInfo(body, observableOptions); return result.toPromise(); } @@ -255,8 +508,20 @@ export class PromiseBodyApi { * Test string enum response body * @param [body] String enum */ - public testEchoBodyStringEnum(body?: string, _options?: Configuration): Promise { - const result = this.api.testEchoBodyStringEnum(body, _options); + public testEchoBodyStringEnum(body?: string, _options?: PromiseConfigurationOptions): Promise { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testEchoBodyStringEnum(body, observableOptions); return result.toPromise(); } @@ -265,8 +530,20 @@ export class PromiseBodyApi { * Test empty json (request body) * @param [tag] Tag object */ - public testEchoBodyTagResponseStringWithHttpInfo(tag?: Tag, _options?: Configuration): Promise> { - const result = this.api.testEchoBodyTagResponseStringWithHttpInfo(tag, _options); + public testEchoBodyTagResponseStringWithHttpInfo(tag?: Tag, _options?: PromiseConfigurationOptions): Promise> { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testEchoBodyTagResponseStringWithHttpInfo(tag, observableOptions); return result.toPromise(); } @@ -275,8 +552,20 @@ export class PromiseBodyApi { * Test empty json (request body) * @param [tag] Tag object */ - public testEchoBodyTagResponseString(tag?: Tag, _options?: Configuration): Promise { - const result = this.api.testEchoBodyTagResponseString(tag, _options); + public testEchoBodyTagResponseString(tag?: Tag, _options?: PromiseConfigurationOptions): Promise { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testEchoBodyTagResponseString(tag, observableOptions); return result.toPromise(); } @@ -306,8 +595,20 @@ export class PromiseFormApi { * @param [booleanForm] * @param [stringForm] */ - public testFormIntegerBooleanStringWithHttpInfo(integerForm?: number, booleanForm?: boolean, stringForm?: string, _options?: Configuration): Promise> { - const result = this.api.testFormIntegerBooleanStringWithHttpInfo(integerForm, booleanForm, stringForm, _options); + public testFormIntegerBooleanStringWithHttpInfo(integerForm?: number, booleanForm?: boolean, stringForm?: string, _options?: PromiseConfigurationOptions): Promise> { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testFormIntegerBooleanStringWithHttpInfo(integerForm, booleanForm, stringForm, observableOptions); return result.toPromise(); } @@ -318,8 +619,20 @@ export class PromiseFormApi { * @param [booleanForm] * @param [stringForm] */ - public testFormIntegerBooleanString(integerForm?: number, booleanForm?: boolean, stringForm?: string, _options?: Configuration): Promise { - const result = this.api.testFormIntegerBooleanString(integerForm, booleanForm, stringForm, _options); + public testFormIntegerBooleanString(integerForm?: number, booleanForm?: boolean, stringForm?: string, _options?: PromiseConfigurationOptions): Promise { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testFormIntegerBooleanString(integerForm, booleanForm, stringForm, observableOptions); return result.toPromise(); } @@ -328,8 +641,20 @@ export class PromiseFormApi { * Test form parameter(s) for multipart schema * @param marker */ - public testFormObjectMultipartWithHttpInfo(marker: TestFormObjectMultipartRequestMarker, _options?: Configuration): Promise> { - const result = this.api.testFormObjectMultipartWithHttpInfo(marker, _options); + public testFormObjectMultipartWithHttpInfo(marker: TestFormObjectMultipartRequestMarker, _options?: PromiseConfigurationOptions): Promise> { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testFormObjectMultipartWithHttpInfo(marker, observableOptions); return result.toPromise(); } @@ -338,8 +663,20 @@ export class PromiseFormApi { * Test form parameter(s) for multipart schema * @param marker */ - public testFormObjectMultipart(marker: TestFormObjectMultipartRequestMarker, _options?: Configuration): Promise { - const result = this.api.testFormObjectMultipart(marker, _options); + public testFormObjectMultipart(marker: TestFormObjectMultipartRequestMarker, _options?: PromiseConfigurationOptions): Promise { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testFormObjectMultipart(marker, observableOptions); return result.toPromise(); } @@ -353,8 +690,20 @@ export class PromiseFormApi { * @param [id] * @param [name] */ - public testFormOneofWithHttpInfo(form1?: string, form2?: number, form3?: string, form4?: boolean, id?: number, name?: string, _options?: Configuration): Promise> { - const result = this.api.testFormOneofWithHttpInfo(form1, form2, form3, form4, id, name, _options); + public testFormOneofWithHttpInfo(form1?: string, form2?: number, form3?: string, form4?: boolean, id?: number, name?: string, _options?: PromiseConfigurationOptions): Promise> { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testFormOneofWithHttpInfo(form1, form2, form3, form4, id, name, observableOptions); return result.toPromise(); } @@ -368,8 +717,20 @@ export class PromiseFormApi { * @param [id] * @param [name] */ - public testFormOneof(form1?: string, form2?: number, form3?: string, form4?: boolean, id?: number, name?: string, _options?: Configuration): Promise { - const result = this.api.testFormOneof(form1, form2, form3, form4, id, name, _options); + public testFormOneof(form1?: string, form2?: number, form3?: string, form4?: boolean, id?: number, name?: string, _options?: PromiseConfigurationOptions): Promise { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testFormOneof(form1, form2, form3, form4, id, name, observableOptions); return result.toPromise(); } @@ -401,8 +762,20 @@ export class PromiseHeaderApi { * @param [enumNonrefStringHeader] * @param [enumRefStringHeader] */ - public testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader?: number, booleanHeader?: boolean, stringHeader?: string, enumNonrefStringHeader?: 'success' | 'failure' | 'unclassified', enumRefStringHeader?: StringEnumRef, _options?: Configuration): Promise> { - const result = this.api.testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader, _options); + public testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader?: number, booleanHeader?: boolean, stringHeader?: string, enumNonrefStringHeader?: 'success' | 'failure' | 'unclassified', enumRefStringHeader?: StringEnumRef, _options?: PromiseConfigurationOptions): Promise> { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader, observableOptions); return result.toPromise(); } @@ -415,8 +788,20 @@ export class PromiseHeaderApi { * @param [enumNonrefStringHeader] * @param [enumRefStringHeader] */ - public testHeaderIntegerBooleanStringEnums(integerHeader?: number, booleanHeader?: boolean, stringHeader?: string, enumNonrefStringHeader?: 'success' | 'failure' | 'unclassified', enumRefStringHeader?: StringEnumRef, _options?: Configuration): Promise { - const result = this.api.testHeaderIntegerBooleanStringEnums(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader, _options); + public testHeaderIntegerBooleanStringEnums(integerHeader?: number, booleanHeader?: boolean, stringHeader?: string, enumNonrefStringHeader?: 'success' | 'failure' | 'unclassified', enumRefStringHeader?: StringEnumRef, _options?: PromiseConfigurationOptions): Promise { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testHeaderIntegerBooleanStringEnums(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader, observableOptions); return result.toPromise(); } @@ -447,8 +832,20 @@ export class PromisePathApi { * @param enumNonrefStringPath * @param enumRefStringPath */ - public testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString: string, pathInteger: number, enumNonrefStringPath: 'success' | 'failure' | 'unclassified', enumRefStringPath: StringEnumRef, _options?: Configuration): Promise> { - const result = this.api.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath, _options); + public testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString: string, pathInteger: number, enumNonrefStringPath: 'success' | 'failure' | 'unclassified', enumRefStringPath: StringEnumRef, _options?: PromiseConfigurationOptions): Promise> { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath, observableOptions); return result.toPromise(); } @@ -460,8 +857,20 @@ export class PromisePathApi { * @param enumNonrefStringPath * @param enumRefStringPath */ - public testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString: string, pathInteger: number, enumNonrefStringPath: 'success' | 'failure' | 'unclassified', enumRefStringPath: StringEnumRef, _options?: Configuration): Promise { - const result = this.api.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath, _options); + public testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString: string, pathInteger: number, enumNonrefStringPath: 'success' | 'failure' | 'unclassified', enumRefStringPath: StringEnumRef, _options?: PromiseConfigurationOptions): Promise { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath, observableOptions); return result.toPromise(); } @@ -490,8 +899,20 @@ export class PromiseQueryApi { * @param [enumNonrefStringQuery] * @param [enumRefStringQuery] */ - public testEnumRefStringWithHttpInfo(enumNonrefStringQuery?: 'success' | 'failure' | 'unclassified', enumRefStringQuery?: StringEnumRef, _options?: Configuration): Promise> { - const result = this.api.testEnumRefStringWithHttpInfo(enumNonrefStringQuery, enumRefStringQuery, _options); + public testEnumRefStringWithHttpInfo(enumNonrefStringQuery?: 'success' | 'failure' | 'unclassified', enumRefStringQuery?: StringEnumRef, _options?: PromiseConfigurationOptions): Promise> { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testEnumRefStringWithHttpInfo(enumNonrefStringQuery, enumRefStringQuery, observableOptions); return result.toPromise(); } @@ -501,8 +922,20 @@ export class PromiseQueryApi { * @param [enumNonrefStringQuery] * @param [enumRefStringQuery] */ - public testEnumRefString(enumNonrefStringQuery?: 'success' | 'failure' | 'unclassified', enumRefStringQuery?: StringEnumRef, _options?: Configuration): Promise { - const result = this.api.testEnumRefString(enumNonrefStringQuery, enumRefStringQuery, _options); + public testEnumRefString(enumNonrefStringQuery?: 'success' | 'failure' | 'unclassified', enumRefStringQuery?: StringEnumRef, _options?: PromiseConfigurationOptions): Promise { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testEnumRefString(enumNonrefStringQuery, enumRefStringQuery, observableOptions); return result.toPromise(); } @@ -513,8 +946,20 @@ export class PromiseQueryApi { * @param [dateQuery] * @param [stringQuery] */ - public testQueryDatetimeDateStringWithHttpInfo(datetimeQuery?: Date, dateQuery?: string, stringQuery?: string, _options?: Configuration): Promise> { - const result = this.api.testQueryDatetimeDateStringWithHttpInfo(datetimeQuery, dateQuery, stringQuery, _options); + public testQueryDatetimeDateStringWithHttpInfo(datetimeQuery?: Date, dateQuery?: string, stringQuery?: string, _options?: PromiseConfigurationOptions): Promise> { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testQueryDatetimeDateStringWithHttpInfo(datetimeQuery, dateQuery, stringQuery, observableOptions); return result.toPromise(); } @@ -525,8 +970,20 @@ export class PromiseQueryApi { * @param [dateQuery] * @param [stringQuery] */ - public testQueryDatetimeDateString(datetimeQuery?: Date, dateQuery?: string, stringQuery?: string, _options?: Configuration): Promise { - const result = this.api.testQueryDatetimeDateString(datetimeQuery, dateQuery, stringQuery, _options); + public testQueryDatetimeDateString(datetimeQuery?: Date, dateQuery?: string, stringQuery?: string, _options?: PromiseConfigurationOptions): Promise { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testQueryDatetimeDateString(datetimeQuery, dateQuery, stringQuery, observableOptions); return result.toPromise(); } @@ -537,8 +994,20 @@ export class PromiseQueryApi { * @param [booleanQuery] * @param [stringQuery] */ - public testQueryIntegerBooleanStringWithHttpInfo(integerQuery?: number, booleanQuery?: boolean, stringQuery?: string, _options?: Configuration): Promise> { - const result = this.api.testQueryIntegerBooleanStringWithHttpInfo(integerQuery, booleanQuery, stringQuery, _options); + public testQueryIntegerBooleanStringWithHttpInfo(integerQuery?: number, booleanQuery?: boolean, stringQuery?: string, _options?: PromiseConfigurationOptions): Promise> { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testQueryIntegerBooleanStringWithHttpInfo(integerQuery, booleanQuery, stringQuery, observableOptions); return result.toPromise(); } @@ -549,8 +1018,20 @@ export class PromiseQueryApi { * @param [booleanQuery] * @param [stringQuery] */ - public testQueryIntegerBooleanString(integerQuery?: number, booleanQuery?: boolean, stringQuery?: string, _options?: Configuration): Promise { - const result = this.api.testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery, _options); + public testQueryIntegerBooleanString(integerQuery?: number, booleanQuery?: boolean, stringQuery?: string, _options?: PromiseConfigurationOptions): Promise { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery, observableOptions); return result.toPromise(); } @@ -559,8 +1040,20 @@ export class PromiseQueryApi { * Test query parameter(s) * @param [queryObject] */ - public testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject?: Pet, _options?: Configuration): Promise> { - const result = this.api.testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject, _options); + public testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject?: Pet, _options?: PromiseConfigurationOptions): Promise> { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject, observableOptions); return result.toPromise(); } @@ -569,8 +1062,20 @@ export class PromiseQueryApi { * Test query parameter(s) * @param [queryObject] */ - public testQueryStyleDeepObjectExplodeTrueObject(queryObject?: Pet, _options?: Configuration): Promise { - const result = this.api.testQueryStyleDeepObjectExplodeTrueObject(queryObject, _options); + public testQueryStyleDeepObjectExplodeTrueObject(queryObject?: Pet, _options?: PromiseConfigurationOptions): Promise { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testQueryStyleDeepObjectExplodeTrueObject(queryObject, observableOptions); return result.toPromise(); } @@ -579,8 +1084,20 @@ export class PromiseQueryApi { * Test query parameter(s) * @param [queryObject] */ - public testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(queryObject?: TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter, _options?: Configuration): Promise> { - const result = this.api.testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(queryObject, _options); + public testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(queryObject?: TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter, _options?: PromiseConfigurationOptions): Promise> { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(queryObject, observableOptions); return result.toPromise(); } @@ -589,8 +1106,20 @@ export class PromiseQueryApi { * Test query parameter(s) * @param [queryObject] */ - public testQueryStyleDeepObjectExplodeTrueObjectAllOf(queryObject?: TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter, _options?: Configuration): Promise { - const result = this.api.testQueryStyleDeepObjectExplodeTrueObjectAllOf(queryObject, _options); + public testQueryStyleDeepObjectExplodeTrueObjectAllOf(queryObject?: TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter, _options?: PromiseConfigurationOptions): Promise { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testQueryStyleDeepObjectExplodeTrueObjectAllOf(queryObject, observableOptions); return result.toPromise(); } @@ -599,8 +1128,20 @@ export class PromiseQueryApi { * Test query parameter(s) * @param [queryObject] */ - public testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(queryObject?: Array, _options?: Configuration): Promise> { - const result = this.api.testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(queryObject, _options); + public testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(queryObject?: Array, _options?: PromiseConfigurationOptions): Promise> { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(queryObject, observableOptions); return result.toPromise(); } @@ -609,8 +1150,20 @@ export class PromiseQueryApi { * Test query parameter(s) * @param [queryObject] */ - public testQueryStyleFormExplodeFalseArrayInteger(queryObject?: Array, _options?: Configuration): Promise { - const result = this.api.testQueryStyleFormExplodeFalseArrayInteger(queryObject, _options); + public testQueryStyleFormExplodeFalseArrayInteger(queryObject?: Array, _options?: PromiseConfigurationOptions): Promise { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testQueryStyleFormExplodeFalseArrayInteger(queryObject, observableOptions); return result.toPromise(); } @@ -619,8 +1172,20 @@ export class PromiseQueryApi { * Test query parameter(s) * @param [queryObject] */ - public testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(queryObject?: Array, _options?: Configuration): Promise> { - const result = this.api.testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(queryObject, _options); + public testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(queryObject?: Array, _options?: PromiseConfigurationOptions): Promise> { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(queryObject, observableOptions); return result.toPromise(); } @@ -629,8 +1194,20 @@ export class PromiseQueryApi { * Test query parameter(s) * @param [queryObject] */ - public testQueryStyleFormExplodeFalseArrayString(queryObject?: Array, _options?: Configuration): Promise { - const result = this.api.testQueryStyleFormExplodeFalseArrayString(queryObject, _options); + public testQueryStyleFormExplodeFalseArrayString(queryObject?: Array, _options?: PromiseConfigurationOptions): Promise { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testQueryStyleFormExplodeFalseArrayString(queryObject, observableOptions); return result.toPromise(); } @@ -639,8 +1216,20 @@ export class PromiseQueryApi { * Test query parameter(s) * @param [queryObject] */ - public testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject?: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter, _options?: Configuration): Promise> { - const result = this.api.testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject, _options); + public testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject?: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter, _options?: PromiseConfigurationOptions): Promise> { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject, observableOptions); return result.toPromise(); } @@ -649,8 +1238,20 @@ export class PromiseQueryApi { * Test query parameter(s) * @param [queryObject] */ - public testQueryStyleFormExplodeTrueArrayString(queryObject?: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter, _options?: Configuration): Promise { - const result = this.api.testQueryStyleFormExplodeTrueArrayString(queryObject, _options); + public testQueryStyleFormExplodeTrueArrayString(queryObject?: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter, _options?: PromiseConfigurationOptions): Promise { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testQueryStyleFormExplodeTrueArrayString(queryObject, observableOptions); return result.toPromise(); } @@ -659,8 +1260,20 @@ export class PromiseQueryApi { * Test query parameter(s) * @param [queryObject] */ - public testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject?: Pet, _options?: Configuration): Promise> { - const result = this.api.testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject, _options); + public testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject?: Pet, _options?: PromiseConfigurationOptions): Promise> { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject, observableOptions); return result.toPromise(); } @@ -669,8 +1282,20 @@ export class PromiseQueryApi { * Test query parameter(s) * @param [queryObject] */ - public testQueryStyleFormExplodeTrueObject(queryObject?: Pet, _options?: Configuration): Promise { - const result = this.api.testQueryStyleFormExplodeTrueObject(queryObject, _options); + public testQueryStyleFormExplodeTrueObject(queryObject?: Pet, _options?: PromiseConfigurationOptions): Promise { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testQueryStyleFormExplodeTrueObject(queryObject, observableOptions); return result.toPromise(); } @@ -679,8 +1304,20 @@ export class PromiseQueryApi { * Test query parameter(s) * @param [queryObject] */ - public testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(queryObject?: DataQuery, _options?: Configuration): Promise> { - const result = this.api.testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(queryObject, _options); + public testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(queryObject?: DataQuery, _options?: PromiseConfigurationOptions): Promise> { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(queryObject, observableOptions); return result.toPromise(); } @@ -689,8 +1326,20 @@ export class PromiseQueryApi { * Test query parameter(s) * @param [queryObject] */ - public testQueryStyleFormExplodeTrueObjectAllOf(queryObject?: DataQuery, _options?: Configuration): Promise { - const result = this.api.testQueryStyleFormExplodeTrueObjectAllOf(queryObject, _options); + public testQueryStyleFormExplodeTrueObjectAllOf(queryObject?: DataQuery, _options?: PromiseConfigurationOptions): Promise { + let observableOptions: undefined | ConfigurationOptions + if (_options){ + observableOptions = { + baseServer: _options.baseServer, + httpApi: _options.httpApi, + middleware: _options.middleware?.map( + m => new PromiseMiddlewareWrapper(m) + ), + middlewareMergeStrategy: _options.middlewareMergeStrategy, + authMethods: _options.authMethods + } + } + const result = this.api.testQueryStyleFormExplodeTrueObjectAllOf(queryObject, observableOptions); return result.toPromise(); } From 8ac240a37b390871a869e18b01203f9de14821f9 Mon Sep 17 00:00:00 2001 From: Ivan Vaskevych Date: Mon, 31 Mar 2025 17:04:59 +0200 Subject: [PATCH 7/9] Fixes updated samples --- samples/client/echo_api/typescript/build/package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/samples/client/echo_api/typescript/build/package.json b/samples/client/echo_api/typescript/build/package.json index 02862e75cd1d..9e432da37ca0 100644 --- a/samples/client/echo_api/typescript/build/package.json +++ b/samples/client/echo_api/typescript/build/package.json @@ -31,10 +31,11 @@ "prepare": "npm run build" }, "dependencies": { - "whatwg-fetch": "^3.0.0", - "es6-promise": "^4.2.4" + "es6-promise": "^4.2.4", + "whatwg-fetch": "^3.0.0" }, "devDependencies": { + "@types/node": "^22.13.14", "typescript": "^4.0" } } From 2c1f1eba4a5f25d5a3bccb32b09eee6e44f5cddb Mon Sep 17 00:00:00 2001 From: Ivan Vaskevych Date: Mon, 31 Mar 2025 18:04:49 +0200 Subject: [PATCH 8/9] Fixes the fix --- samples/client/echo_api/typescript/build/package.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/samples/client/echo_api/typescript/build/package.json b/samples/client/echo_api/typescript/build/package.json index 9e432da37ca0..02862e75cd1d 100644 --- a/samples/client/echo_api/typescript/build/package.json +++ b/samples/client/echo_api/typescript/build/package.json @@ -31,11 +31,10 @@ "prepare": "npm run build" }, "dependencies": { - "es6-promise": "^4.2.4", - "whatwg-fetch": "^3.0.0" + "whatwg-fetch": "^3.0.0", + "es6-promise": "^4.2.4" }, "devDependencies": { - "@types/node": "^22.13.14", "typescript": "^4.0" } } From 469aa38c00b934ffd123d1e9499eb237cc8c2cbe Mon Sep 17 00:00:00 2001 From: Ivan Vaskevych Date: Mon, 31 Mar 2025 18:28:09 +0200 Subject: [PATCH 9/9] Fixes the example config --- bin/configs/typescript-echo-api.yaml | 1 + .../echo_api/typescript/build/apis/AuthApi.ts | 6 +- .../echo_api/typescript/build/apis/BodyApi.ts | 24 ++++---- .../echo_api/typescript/build/apis/FormApi.ts | 8 ++- .../typescript/build/apis/HeaderApi.ts | 4 +- .../echo_api/typescript/build/apis/PathApi.ts | 4 +- .../typescript/build/apis/QueryApi.ts | 22 ++++---- .../echo_api/typescript/build/http/http.ts | 55 +++++++++---------- .../typescript/build/http/isomorphic-fetch.ts | 6 +- .../echo_api/typescript/build/package.json | 5 +- .../echo_api/typescript/build/tsconfig.json | 1 - 11 files changed, 74 insertions(+), 62 deletions(-) diff --git a/bin/configs/typescript-echo-api.yaml b/bin/configs/typescript-echo-api.yaml index bc064e691552..fe269242e18f 100644 --- a/bin/configs/typescript-echo-api.yaml +++ b/bin/configs/typescript-echo-api.yaml @@ -5,5 +5,6 @@ templateDir: modules/openapi-generator/src/main/resources/typescript additionalProperties: artifactId: echo-api-typescript hideGenerationTimestamp: "true" + platform: node npmVersion: 1.0.0 npmName: '@openapitools/typescript-echo-api' diff --git a/samples/client/echo_api/typescript/build/apis/AuthApi.ts b/samples/client/echo_api/typescript/build/apis/AuthApi.ts index 0dd98840a065..dc623dd93bae 100644 --- a/samples/client/echo_api/typescript/build/apis/AuthApi.ts +++ b/samples/client/echo_api/typescript/build/apis/AuthApi.ts @@ -2,6 +2,8 @@ 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'; @@ -104,7 +106,7 @@ export class AuthApiResponseProcessor { return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** @@ -133,7 +135,7 @@ export class AuthApiResponseProcessor { return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } } diff --git a/samples/client/echo_api/typescript/build/apis/BodyApi.ts b/samples/client/echo_api/typescript/build/apis/BodyApi.ts index 61542c9c1752..72e0c4d5d903 100644 --- a/samples/client/echo_api/typescript/build/apis/BodyApi.ts +++ b/samples/client/echo_api/typescript/build/apis/BodyApi.ts @@ -2,6 +2,8 @@ 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'; @@ -165,7 +167,7 @@ export class BodyApiRequestFactory extends BaseAPIRequestFactory { if (myFile !== undefined) { // TODO: replace .append with .set if (localVarFormParams instanceof FormData) { - localVarFormParams.append('my-file', myFile, myFile.name); + localVarFormParams.append('my-file', myFile.data, myFile.name); } } @@ -436,7 +438,7 @@ export class BodyApiResponseProcessor { return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** @@ -465,7 +467,7 @@ export class BodyApiResponseProcessor { return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** @@ -494,7 +496,7 @@ export class BodyApiResponseProcessor { return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** @@ -523,7 +525,7 @@ export class BodyApiResponseProcessor { return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** @@ -552,7 +554,7 @@ export class BodyApiResponseProcessor { return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** @@ -581,7 +583,7 @@ export class BodyApiResponseProcessor { return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** @@ -610,7 +612,7 @@ export class BodyApiResponseProcessor { return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** @@ -639,7 +641,7 @@ export class BodyApiResponseProcessor { return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** @@ -668,7 +670,7 @@ export class BodyApiResponseProcessor { return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** @@ -697,7 +699,7 @@ export class BodyApiResponseProcessor { return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } } diff --git a/samples/client/echo_api/typescript/build/apis/FormApi.ts b/samples/client/echo_api/typescript/build/apis/FormApi.ts index 84a741d76f58..48777372f260 100644 --- a/samples/client/echo_api/typescript/build/apis/FormApi.ts +++ b/samples/client/echo_api/typescript/build/apis/FormApi.ts @@ -2,6 +2,8 @@ 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'; @@ -245,7 +247,7 @@ export class FormApiResponseProcessor { return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** @@ -274,7 +276,7 @@ export class FormApiResponseProcessor { return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** @@ -303,7 +305,7 @@ export class FormApiResponseProcessor { return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } } diff --git a/samples/client/echo_api/typescript/build/apis/HeaderApi.ts b/samples/client/echo_api/typescript/build/apis/HeaderApi.ts index c9bc1e8c868c..6129865cc205 100644 --- a/samples/client/echo_api/typescript/build/apis/HeaderApi.ts +++ b/samples/client/echo_api/typescript/build/apis/HeaderApi.ts @@ -2,6 +2,8 @@ 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'; @@ -94,7 +96,7 @@ export class HeaderApiResponseProcessor { return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } } diff --git a/samples/client/echo_api/typescript/build/apis/PathApi.ts b/samples/client/echo_api/typescript/build/apis/PathApi.ts index 8ab837782dad..04aa49c504d2 100644 --- a/samples/client/echo_api/typescript/build/apis/PathApi.ts +++ b/samples/client/echo_api/typescript/build/apis/PathApi.ts @@ -2,6 +2,8 @@ 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'; @@ -101,7 +103,7 @@ export class PathApiResponseProcessor { return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } } diff --git a/samples/client/echo_api/typescript/build/apis/QueryApi.ts b/samples/client/echo_api/typescript/build/apis/QueryApi.ts index 47530ab09143..60e4a749ca73 100644 --- a/samples/client/echo_api/typescript/build/apis/QueryApi.ts +++ b/samples/client/echo_api/typescript/build/apis/QueryApi.ts @@ -2,6 +2,8 @@ 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'; @@ -409,7 +411,7 @@ export class QueryApiResponseProcessor { return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** @@ -438,7 +440,7 @@ export class QueryApiResponseProcessor { return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** @@ -467,7 +469,7 @@ export class QueryApiResponseProcessor { return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** @@ -496,7 +498,7 @@ export class QueryApiResponseProcessor { return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** @@ -525,7 +527,7 @@ export class QueryApiResponseProcessor { return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** @@ -554,7 +556,7 @@ export class QueryApiResponseProcessor { return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** @@ -583,7 +585,7 @@ export class QueryApiResponseProcessor { return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** @@ -612,7 +614,7 @@ export class QueryApiResponseProcessor { return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** @@ -641,7 +643,7 @@ export class QueryApiResponseProcessor { return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** @@ -670,7 +672,7 @@ export class QueryApiResponseProcessor { return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } - throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } } diff --git a/samples/client/echo_api/typescript/build/http/http.ts b/samples/client/echo_api/typescript/build/http/http.ts index fd40471a98f4..115d854c58b5 100644 --- a/samples/client/echo_api/typescript/build/http/http.ts +++ b/samples/client/echo_api/typescript/build/http/http.ts @@ -1,3 +1,8 @@ +// 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'; @@ -20,7 +25,10 @@ export enum HttpMethod { /** * Represents an HTTP file which will be transferred from or to a server. */ -export type HttpFile = Blob & { readonly name: string }; +export type HttpFile = { + data: Buffer, + name: string +}; export class HttpException extends Error { public constructor(msg: string) { @@ -39,7 +47,7 @@ function ensureAbsoluteUrl(url: string) { if (url.startsWith("http://") || url.startsWith("https://")) { return url; } - return window.location.origin + url; + throw new Error("You need to define an absolute base url for the server."); } /** @@ -49,6 +57,7 @@ export class RequestContext { private headers: Headers = {}; 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 @@ -125,37 +134,34 @@ export class RequestContext { 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; + binary(): Promise; } /** * Helper class to generate a `ResponseBody` from binary data */ export class SelfDecodingBody implements ResponseBody { - constructor(private dataSource: Promise) {} + constructor(private dataSource: Promise) {} - binary(): Promise { + binary(): Promise { return this.dataSource; } async text(): Promise { - const data: Blob = await this.dataSource; - // @ts-ignore - if (data.text) { - // @ts-ignore - return data.text(); - } - - return new Promise((resolve, reject) => { - const reader = new FileReader(); - reader.addEventListener("load", () => resolve(reader.result as string)); - reader.addEventListener("error", () => reject(reader.error)); - reader.readAsText(data); - }); + const data: Buffer = await this.dataSource; + return data.toString(); } } @@ -202,23 +208,14 @@ export class ResponseContext { public async getBodyAsFile(): Promise { const data = await this.body.binary(); const fileName = this.getParsedHeader("content-disposition")["filename"] || ""; - const contentType = this.headers["content-type"] || ""; - try { - return new File([data], fileName, { type: contentType }); - } catch (error) { - /** Fallback for when the File constructor is not available */ - return Object.assign(data, { - name: fileName, - type: contentType - }); - } + 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 { + public getBodyAsAny(): Promise { try { return this.body.text(); } catch {} diff --git a/samples/client/echo_api/typescript/build/http/isomorphic-fetch.ts b/samples/client/echo_api/typescript/build/http/isomorphic-fetch.ts index 3af85f3d902c..26d267cfc063 100644 --- a/samples/client/echo_api/typescript/build/http/isomorphic-fetch.ts +++ b/samples/client/echo_api/typescript/build/http/isomorphic-fetch.ts @@ -1,6 +1,6 @@ import {HttpLibrary, RequestContext, ResponseContext} from './http'; import { from, Observable } from '../rxjsStub'; -import "whatwg-fetch"; +import fetch from "node-fetch"; export class IsomorphicFetchHttpLibrary implements HttpLibrary { @@ -12,7 +12,7 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary { method: method, body: body as any, headers: request.getHeaders(), - credentials: "same-origin" + agent: request.getAgent(), }).then((resp: any) => { const headers: { [name: string]: string } = {}; resp.headers.forEach((value: string, name: string) => { @@ -21,7 +21,7 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary { const body = { text: () => resp.text(), - binary: () => resp.blob() + binary: () => resp.buffer() }; return new ResponseContext(resp.status, headers, body); }); diff --git a/samples/client/echo_api/typescript/build/package.json b/samples/client/echo_api/typescript/build/package.json index 02862e75cd1d..9a517a58901c 100644 --- a/samples/client/echo_api/typescript/build/package.json +++ b/samples/client/echo_api/typescript/build/package.json @@ -31,7 +31,10 @@ "prepare": "npm run build" }, "dependencies": { - "whatwg-fetch": "^3.0.0", + "node-fetch": "^2.6.0", + "@types/node-fetch": "^2.5.7", + "@types/node": "*", + "form-data": "^2.5.0", "es6-promise": "^4.2.4" }, "devDependencies": { diff --git a/samples/client/echo_api/typescript/build/tsconfig.json b/samples/client/echo_api/typescript/build/tsconfig.json index b5f1ee70e9cb..98956dc9c6c6 100644 --- a/samples/client/echo_api/typescript/build/tsconfig.json +++ b/samples/client/echo_api/typescript/build/tsconfig.json @@ -23,7 +23,6 @@ "es6" ,"ES2017.Object" ,"ES2021.String" - ,"dom" ], }, "exclude": [