diff --git a/bin/configs/typescript-echo-api.yaml b/bin/configs/typescript-echo-api.yaml new file mode 100644 index 00000000000..fe269242e18 --- /dev/null +++ b/bin/configs/typescript-echo-api.yaml @@ -0,0 +1,10 @@ +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" + platform: node + npmVersion: 1.0.0 + npmName: '@openapitools/typescript-echo-api' 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 732d87b7515..e27a5c02bbd 100644 --- a/modules/openapi-generator/src/main/resources/typescript/api/api.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/api/api.mustache @@ -70,6 +70,10 @@ export class {{classname}}RequestFactory extends BaseAPIRequestFactory { requestContext.setQueryParam("{{baseName}}", ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}", "{{dataFormat}}")); {{/isPrimitiveType}} {{^isPrimitiveType}} + {{#isEnumRef}} + requestContext.setQueryParam("{{baseName}}", ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}", "{{dataFormat}}")); + {{/isEnumRef}} + {{^isEnumRef}} {{#isExplode}} const serializedParams = ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}", "{{dataFormat}}"); {{#isArray}} @@ -86,6 +90,7 @@ export class {{classname}}RequestFactory extends BaseAPIRequestFactory { {{^isExplode}} requestContext.setQueryParam("{{baseName}}", ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}", "{{dataFormat}}")); {{/isExplode}} + {{/isEnumRef}} {{/isPrimitiveType}} } {{/queryParams}} diff --git a/samples/client/echo_api/typescript/build/.gitattributes b/samples/client/echo_api/typescript/build/.gitattributes new file mode 100644 index 00000000000..7bf5a17b22f --- /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 00000000000..1521c8b7652 --- /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 00000000000..7484ee590a3 --- /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 00000000000..4db34aea13a --- /dev/null +++ b/samples/client/echo_api/typescript/build/.openapi-generator/FILES @@ -0,0 +1,46 @@ +.gitattributes +.gitignore +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 00000000000..96cfbb19ae2 --- /dev/null +++ b/samples/client/echo_api/typescript/build/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.13.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 00000000000..349a5adaa7e --- /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 00000000000..182218637c7 --- /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 00000000000..f29d546be6e --- /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 00000000000..01a5d81dee4 --- /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 00000000000..10ed995105b --- /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 00000000000..cbc94d10a43 --- /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 00000000000..a23263b9b6b --- /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 00000000000..dc623dd93ba --- /dev/null +++ b/samples/client/echo_api/typescript/build/apis/AuthApi.ts @@ -0,0 +1,141 @@ +// TODO: better import syntax? +import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; +import {Configuration} from '../configuration'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; +import * as FormData from "form-data"; +import { URLSearchParams } from 'url'; +import {ObjectSerializer} from '../models/ObjectSerializer'; +import {ApiException} from './exception'; +import {canConsumeForm, isCodeInRange} from '../util'; +import {SecurityAuthentication} from '../auth/auth'; + + + +/** + * 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 = _config?.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 = _config?.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 00000000000..72e0c4d5d90 --- /dev/null +++ b/samples/client/echo_api/typescript/build/apis/BodyApi.ts @@ -0,0 +1,705 @@ +// TODO: better import syntax? +import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; +import {Configuration} from '../configuration'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; +import * as FormData from "form-data"; +import { URLSearchParams } from 'url'; +import {ObjectSerializer} from '../models/ObjectSerializer'; +import {ApiException} from './exception'; +import {canConsumeForm, isCodeInRange} from '../util'; +import {SecurityAuthentication} from '../auth/auth'; + + +import { 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 = _config?.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 = _config?.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 = _config?.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.data, myFile.name); + } + } + + requestContext.setBody(localVarFormParams); + + if(!useForm) { + const contentType = ObjectSerializer.getPreferredMediaType([ + "multipart/form-data" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + } + + + const defaultAuth: SecurityAuthentication | undefined = _config?.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 = _config?.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 = _config?.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 = _config?.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 = _config?.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 = _config?.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 = _config?.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 00000000000..48777372f26 --- /dev/null +++ b/samples/client/echo_api/typescript/build/apis/FormApi.ts @@ -0,0 +1,311 @@ +// TODO: better import syntax? +import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; +import {Configuration} from '../configuration'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; +import * as FormData from "form-data"; +import { URLSearchParams } from 'url'; +import {ObjectSerializer} from '../models/ObjectSerializer'; +import {ApiException} from './exception'; +import {canConsumeForm, isCodeInRange} from '../util'; +import {SecurityAuthentication} from '../auth/auth'; + + +import { 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 = _config?.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 = _config?.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 = _config?.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 00000000000..6129865cc20 --- /dev/null +++ b/samples/client/echo_api/typescript/build/apis/HeaderApi.ts @@ -0,0 +1,102 @@ +// TODO: better import syntax? +import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; +import {Configuration} from '../configuration'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; +import * as FormData from "form-data"; +import { URLSearchParams } from 'url'; +import {ObjectSerializer} from '../models/ObjectSerializer'; +import {ApiException} from './exception'; +import {canConsumeForm, isCodeInRange} from '../util'; +import {SecurityAuthentication} from '../auth/auth'; + + +import { 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 = _config?.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 00000000000..04aa49c504d --- /dev/null +++ b/samples/client/echo_api/typescript/build/apis/PathApi.ts @@ -0,0 +1,109 @@ +// TODO: better import syntax? +import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; +import {Configuration} from '../configuration'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; +import * as FormData from "form-data"; +import { URLSearchParams } from 'url'; +import {ObjectSerializer} from '../models/ObjectSerializer'; +import {ApiException} from './exception'; +import {canConsumeForm, isCodeInRange} from '../util'; +import {SecurityAuthentication} from '../auth/auth'; + + +import { 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 = _config?.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 00000000000..60e4a749ca7 --- /dev/null +++ b/samples/client/echo_api/typescript/build/apis/QueryApi.ts @@ -0,0 +1,678 @@ +// TODO: better import syntax? +import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; +import {Configuration} from '../configuration'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; +import * as FormData from "form-data"; +import { URLSearchParams } from 'url'; +import {ObjectSerializer} from '../models/ObjectSerializer'; +import {ApiException} from './exception'; +import {canConsumeForm, isCodeInRange} from '../util'; +import {SecurityAuthentication} from '../auth/auth'; + + +import { 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 = _config?.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 = _config?.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 = _config?.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 = _config?.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 = _config?.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 = _config?.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 = _config?.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 = _config?.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 = _config?.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 = _config?.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 00000000000..4c47d7cb15a --- /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 00000000000..9365d33a8f7 --- /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 00000000000..fc340a792ce --- /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 00000000000..92aeec546f5 --- /dev/null +++ b/samples/client/echo_api/typescript/build/configuration.ts @@ -0,0 +1,94 @@ +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: 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. + */ +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; +} 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 00000000000..b253029754e --- /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 00000000000..115d854c58b --- /dev/null +++ b/samples/client/echo_api/typescript/build/http/http.ts @@ -0,0 +1,256 @@ +// TODO: evaluate if we can easily get rid of this library +import * as FormData from "form-data"; +import { URL, URLSearchParams } from 'url'; +import * as http from 'http'; +import * as https from 'https'; +import { Observable, from } from '../rxjsStub'; + +export * from './isomorphic-fetch'; + +/** + * Represents an HTTP method. + */ +export enum HttpMethod { + GET = "GET", + HEAD = "HEAD", + POST = "POST", + PUT = "PUT", + DELETE = "DELETE", + CONNECT = "CONNECT", + OPTIONS = "OPTIONS", + TRACE = "TRACE", + PATCH = "PATCH" +} + +/** + * Represents an HTTP file which will be transferred from or to a server. + */ +export type HttpFile = { + data: Buffer, + name: string +}; + +export class HttpException extends Error { + public constructor(msg: string) { + super(msg); + } +} + +/** + * Represents the body of an outgoing HTTP request. + */ +export type RequestBody = undefined | string | FormData | URLSearchParams; + +type Headers = Record; + +function ensureAbsoluteUrl(url: string) { + if (url.startsWith("http://") || url.startsWith("https://")) { + return url; + } + throw new Error("You need to define an absolute base url for the server."); +} + +/** + * Represents an HTTP request context + */ +export class RequestContext { + private headers: 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 + * + * @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; + } + + public setAgent(agent: http.Agent | https.Agent) { + this.agent = agent; + } + + public getAgent(): http.Agent | https.Agent | undefined { + return this.agent; + } +} + +export interface ResponseBody { + text(): Promise; + binary(): Promise; +} + +/** + * Helper class to generate a `ResponseBody` from binary data + */ +export class SelfDecodingBody implements ResponseBody { + constructor(private dataSource: Promise) {} + + binary(): Promise { + return this.dataSource; + } + + async text(): Promise { + const data: Buffer = await this.dataSource; + return data.toString(); + } +} + +export class ResponseContext { + public constructor( + public httpStatusCode: number, + public headers: 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"] || ""; + return { data, name: fileName }; + } + + /** + * Use a heuristic to get a body of unknown data structure. + * Return as string if possible, otherwise as binary. + */ + public getBodyAsAny(): Promise { + try { + return this.body.text(); + } catch {} + + try { + return this.body.binary(); + } catch {} + + return Promise.resolve(undefined); + } +} + +export interface HttpLibrary { + send(request: RequestContext): Observable; +} + +export interface PromiseHttpLibrary { + send(request: RequestContext): Promise; +} + +export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLibrary { + return { + send(request: RequestContext): Observable { + return from(promiseHttpLibrary.send(request)); + } + } +} + +export class HttpInfo extends ResponseContext { + public constructor( + 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 00000000000..26d267cfc06 --- /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 fetch from "node-fetch"; + +export class IsomorphicFetchHttpLibrary implements HttpLibrary { + + public send(request: RequestContext): Observable { + let method = request.getHttpMethod().toString(); + let body = request.getBody(); + + const resultPromise = fetch(request.getUrl(), { + method: method, + body: body as any, + headers: request.getHeaders(), + agent: request.getAgent(), + }).then((resp: any) => { + const headers: { [name: string]: string } = {}; + resp.headers.forEach((value: string, name: string) => { + headers[name] = value; + }); + + const body = { + text: () => resp.text(), + binary: () => resp.buffer() + }; + return new ResponseContext(resp.status, headers, body); + }); + + return from>(resultPromise); + + } +} diff --git a/samples/client/echo_api/typescript/build/index.ts b/samples/client/echo_api/typescript/build/index.ts new file mode 100644 index 00000000000..bd47d6df7de --- /dev/null +++ b/samples/client/echo_api/typescript/build/index.ts @@ -0,0 +1,13 @@ +export * from "./http/http"; +export * from "./auth/auth"; +export * from "./models/all"; +export { createConfiguration } 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, 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/middleware.ts b/samples/client/echo_api/typescript/build/middleware.ts new file mode 100644 index 00000000000..524f93f016b --- /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 00000000000..c08fd50f9ea --- /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 00000000000..739eab7c4cc --- /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 00000000000..6b52d951fb7 --- /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 00000000000..05cc0d9ad41 --- /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 00000000000..8787f9c7f6b --- /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 00000000000..0e7fed81633 --- /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 00000000000..276d033ed06 --- /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 00000000000..a69887a4288 --- /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 00000000000..b208b9c892c --- /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 00000000000..cb9adebd7f8 --- /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 00000000000..14e19e7ccec --- /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 00000000000..b0201ab7eb8 --- /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 00000000000..0474367333c --- /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 00000000000..6c43a5186e1 --- /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 00000000000..9a517a58901 --- /dev/null +++ b/samples/client/echo_api/typescript/build/package.json @@ -0,0 +1,43 @@ +{ + "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": { + "node-fetch": "^2.6.0", + "@types/node-fetch": "^2.5.7", + "@types/node": "*", + "form-data": "^2.5.0", + "es6-promise": "^4.2.4" + }, + "devDependencies": { + "typescript": "^4.0" + } +} 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 00000000000..4c73715a248 --- /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 00000000000..b52dff31fba --- /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 00000000000..98956dc9c6c --- /dev/null +++ b/samples/client/echo_api/typescript/build/tsconfig.json @@ -0,0 +1,35 @@ +{ + "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" + ], + }, + "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 00000000000..9c08fa610b2 --- /dev/null +++ b/samples/client/echo_api/typescript/build/types/ObjectParamAPI.ts @@ -0,0 +1,949 @@ +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; +import { Configuration, ConfigurationOptions } from '../configuration' +import type { Middleware } from '../middleware'; + +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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: ConfigurationOptions): 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?: 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 new file mode 100644 index 00000000000..3f0a62314bd --- /dev/null +++ b/samples/client/echo_api/typescript/build/types/ObservableAPI.ts @@ -0,0 +1,1831 @@ +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; +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'; +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?: 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 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 allMiddleware.reverse()) { + 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?: ConfigurationOptions): Observable { + return this.testAuthHttpBasicWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * To test HTTP bearer authentication + * To test HTTP bearer authentication + */ + 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 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 allMiddleware.reverse()) { + 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?: ConfigurationOptions): 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?: 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 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 allMiddleware.reverse()) { + 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?: ConfigurationOptions): 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?: 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 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 allMiddleware.reverse()) { + 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?: ConfigurationOptions): 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?: 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 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 allMiddleware.reverse()) { + 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?: ConfigurationOptions): 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?: 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 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 allMiddleware.reverse()) { + 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?: ConfigurationOptions): 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?: 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 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 allMiddleware.reverse()) { + 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?: ConfigurationOptions): 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?: 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 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 allMiddleware.reverse()) { + 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?: ConfigurationOptions): 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?: 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 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 allMiddleware.reverse()) { + 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?: ConfigurationOptions): 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?: 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 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 allMiddleware.reverse()) { + 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?: ConfigurationOptions): 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?: 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 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 allMiddleware.reverse()) { + 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?: ConfigurationOptions): 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?: 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 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 allMiddleware.reverse()) { + 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?: ConfigurationOptions): 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?: 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 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 allMiddleware.reverse()) { + 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?: ConfigurationOptions): 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?: 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 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 allMiddleware.reverse()) { + 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?: ConfigurationOptions): 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?: 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 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 allMiddleware.reverse()) { + 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?: ConfigurationOptions): 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?: 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 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 allMiddleware.reverse()) { + 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?: ConfigurationOptions): 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?: 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 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 allMiddleware.reverse()) { + 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?: ConfigurationOptions): 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?: 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 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 allMiddleware.reverse()) { + 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?: ConfigurationOptions): 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?: 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 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 allMiddleware.reverse()) { + 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?: ConfigurationOptions): 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?: 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 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 allMiddleware.reverse()) { + 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?: ConfigurationOptions): 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?: 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 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 allMiddleware.reverse()) { + 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?: ConfigurationOptions): 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?: 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 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 allMiddleware.reverse()) { + 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?: ConfigurationOptions): 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?: 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 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 allMiddleware.reverse()) { + 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?: ConfigurationOptions): 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?: 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 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 allMiddleware.reverse()) { + 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?: ConfigurationOptions): 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?: 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 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 allMiddleware.reverse()) { + 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?: ConfigurationOptions): 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?: 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 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 allMiddleware.reverse()) { + 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?: ConfigurationOptions): 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?: 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 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 allMiddleware.reverse()) { + 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?: 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 new file mode 100644 index 00000000000..23aa5f09a59 --- /dev/null +++ b/samples/client/echo_api/typescript/build/types/PromiseAPI.ts @@ -0,0 +1,1350 @@ +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; +import { Configuration, ConfigurationOptions, PromiseConfigurationOptions } from '../configuration' +import { PromiseMiddleware, Middleware, PromiseMiddlewareWrapper } from '../middleware'; + +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?: 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(); + } + + /** + * To test HTTP basic authentication + * To test HTTP basic authentication + */ + 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(); + } + + /** + * To test HTTP bearer authentication + * To test HTTP bearer authentication + */ + 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(); + } + + /** + * To test HTTP bearer authentication + * To test HTTP bearer authentication + */ + 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(); + } + + +} + + + +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?: 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(); + } + + /** + * Test binary (gif) response body + * Test binary (gif) response body + */ + 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(); + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param [body] + */ + 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(); + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param [body] + */ + 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(); + } + + /** + * Test array of binary in multipart mime + * Test array of binary in multipart mime + * @param files + */ + 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(); + } + + /** + * Test array of binary in multipart mime + * Test array of binary in multipart mime + * @param files + */ + 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(); + } + + /** + * Test single binary in multipart mime + * Test single binary in multipart mime + * @param [myFile] + */ + 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(); + } + + /** + * Test single binary in multipart mime + * Test single binary in multipart mime + * @param [myFile] + */ + 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(); + } + + /** + * 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?: 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(); + } + + /** + * 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?: 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(); + } + + /** + * Test free form object + * Test free form object + * @param [body] Free form object + */ + 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(); + } + + /** + * Test free form object + * Test free form object + * @param [body] Free form object + */ + 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(); + } + + /** + * 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?: 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(); + } + + /** + * 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?: 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(); + } + + /** + * 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?: 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(); + } + + /** + * 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?: 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(); + } + + /** + * Test string enum response body + * Test string enum response body + * @param [body] String enum + */ + 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(); + } + + /** + * Test string enum response body + * Test string enum response body + * @param [body] String enum + */ + 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(); + } + + /** + * Test empty json (request body) + * Test empty json (request body) + * @param [tag] Tag object + */ + 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(); + } + + /** + * Test empty json (request body) + * Test empty json (request body) + * @param [tag] Tag object + */ + 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(); + } + + +} + + + +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?: 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(); + } + + /** + * Test form parameter(s) + * Test form parameter(s) + * @param [integerForm] + * @param [booleanForm] + * @param [stringForm] + */ + 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(); + } + + /** + * Test form parameter(s) for multipart schema + * Test form parameter(s) for multipart schema + * @param marker + */ + 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(); + } + + /** + * Test form parameter(s) for multipart schema + * Test form parameter(s) for multipart schema + * @param marker + */ + 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(); + } + + /** + * 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?: 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(); + } + + /** + * 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?: 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(); + } + + +} + + + +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?: 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(); + } + + /** + * 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?: 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(); + } + + +} + + + +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?: 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(); + } + + /** + * 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?: 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(); + } + + +} + + + +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?: 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(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [enumNonrefStringQuery] + * @param [enumRefStringQuery] + */ + 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(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [datetimeQuery] + * @param [dateQuery] + * @param [stringQuery] + */ + 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(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [datetimeQuery] + * @param [dateQuery] + * @param [stringQuery] + */ + 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(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [integerQuery] + * @param [booleanQuery] + * @param [stringQuery] + */ + 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(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [integerQuery] + * @param [booleanQuery] + * @param [stringQuery] + */ + 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(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + 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(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + 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(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + 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(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + 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(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + 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(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + 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(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + 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(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + 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(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + 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(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + 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(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + 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(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + 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(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + 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(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param [queryObject] + */ + 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(); + } + + +} + + + 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 00000000000..96ea3dfdc77 --- /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 +}