forked from loafle/openapi-generator-original
Fixes the non-working query parameter when it's an Enum (#20210)
* Fixes the non-working query parameter when it's a Enum * Update modules/openapi-generator/src/main/resources/typescript/api/api.mustache Co-authored-by: Alexey Makhrov <amakhrov@gmail.com> * Fixes the tags order * Adds Echo API client tests for typescript: step 1 * Adds Echo API client tests for typescript: step 2 * Updates samples * Fixes updated samples * Fixes the fix * Fixes the example config --------- Co-authored-by: Alexey Makhrov <amakhrov@gmail.com>
This commit is contained in:
parent
587fcff85c
commit
a8d56fd8ce
10
bin/configs/typescript-echo-api.yaml
Normal file
10
bin/configs/typescript-echo-api.yaml
Normal file
@ -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'
|
@ -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}}
|
||||
|
8
samples/client/echo_api/typescript/build/.gitattributes
generated
vendored
Normal file
8
samples/client/echo_api/typescript/build/.gitattributes
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
**/* linguist-generated
|
||||
*.md linguist-documentation
|
||||
|
||||
.gitattributes text
|
||||
.gitattributes export-ignore
|
||||
|
||||
.gitignore text
|
||||
.gitignore export-ignore
|
1
samples/client/echo_api/typescript/build/.gitignore
generated
vendored
Normal file
1
samples/client/echo_api/typescript/build/.gitignore
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
dist
|
23
samples/client/echo_api/typescript/build/.openapi-generator-ignore
generated
Normal file
23
samples/client/echo_api/typescript/build/.openapi-generator-ignore
generated
Normal file
@ -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
|
46
samples/client/echo_api/typescript/build/.openapi-generator/FILES
generated
Normal file
46
samples/client/echo_api/typescript/build/.openapi-generator/FILES
generated
Normal file
@ -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
|
1
samples/client/echo_api/typescript/build/.openapi-generator/VERSION
generated
Normal file
1
samples/client/echo_api/typescript/build/.openapi-generator/VERSION
generated
Normal file
@ -0,0 +1 @@
|
||||
7.13.0-SNAPSHOT
|
103
samples/client/echo_api/typescript/build/AuthApi.md
generated
Normal file
103
samples/client/echo_api/typescript/build/AuthApi.md
generated
Normal file
@ -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)
|
||||
|
||||
|
581
samples/client/echo_api/typescript/build/BodyApi.md
generated
Normal file
581
samples/client/echo_api/typescript/build/BodyApi.md
generated
Normal file
@ -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)
|
||||
|
||||
|
194
samples/client/echo_api/typescript/build/FormApi.md
generated
Normal file
194
samples/client/echo_api/typescript/build/FormApi.md
generated
Normal file
@ -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)
|
||||
|
||||
|
75
samples/client/echo_api/typescript/build/HeaderApi.md
generated
Normal file
75
samples/client/echo_api/typescript/build/HeaderApi.md
generated
Normal file
@ -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)
|
||||
|
||||
|
72
samples/client/echo_api/typescript/build/PathApi.md
generated
Normal file
72
samples/client/echo_api/typescript/build/PathApi.md
generated
Normal file
@ -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)
|
||||
|
||||
|
606
samples/client/echo_api/typescript/build/QueryApi.md
generated
Normal file
606
samples/client/echo_api/typescript/build/QueryApi.md
generated
Normal file
@ -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)
|
||||
|
||||
|
80
samples/client/echo_api/typescript/build/README.md
generated
Normal file
80
samples/client/echo_api/typescript/build/README.md
generated
Normal file
@ -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<your_api.RequestContext> {
|
||||
// Modify context here and return
|
||||
return Promise.resolve(context);
|
||||
}
|
||||
|
||||
post(context: your_api.ResponseContext): Promise<your_api.ResponseContext> {
|
||||
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<your_api.Pet> createdPet = api.addPet(p);
|
||||
|
||||
```
|
141
samples/client/echo_api/typescript/build/apis/AuthApi.ts
generated
Normal file
141
samples/client/echo_api/typescript/build/apis/AuthApi.ts
generated
Normal file
@ -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<RequestContext> {
|
||||
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<RequestContext> {
|
||||
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<HttpInfo<string >> {
|
||||
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<string | Buffer | undefined>(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<HttpInfo<string >> {
|
||||
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<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
|
||||
}
|
||||
|
||||
}
|
705
samples/client/echo_api/typescript/build/apis/BodyApi.ts
generated
Normal file
705
samples/client/echo_api/typescript/build/apis/BodyApi.ts
generated
Normal file
@ -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<RequestContext> {
|
||||
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<RequestContext> {
|
||||
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<HttpFile>, _options?: Configuration): Promise<RequestContext> {
|
||||
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<RequestContext> {
|
||||
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<RequestContext> {
|
||||
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<RequestContext> {
|
||||
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<RequestContext> {
|
||||
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<RequestContext> {
|
||||
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<RequestContext> {
|
||||
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<RequestContext> {
|
||||
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<HttpInfo<HttpFile >> {
|
||||
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<string | Buffer | undefined>(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<HttpInfo<string >> {
|
||||
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<string | Buffer | undefined>(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<HttpInfo<string >> {
|
||||
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<string | Buffer | undefined>(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<HttpInfo<string >> {
|
||||
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<string | Buffer | undefined>(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<HttpInfo<Pet >> {
|
||||
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<string | Buffer | undefined>(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<HttpInfo<string >> {
|
||||
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<string | Buffer | undefined>(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<HttpInfo<Pet >> {
|
||||
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<string | Buffer | undefined>(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<HttpInfo<string >> {
|
||||
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<string | Buffer | undefined>(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<HttpInfo<StringEnumRef >> {
|
||||
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<string | Buffer | undefined>(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<HttpInfo<string >> {
|
||||
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<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
|
||||
}
|
||||
|
||||
}
|
311
samples/client/echo_api/typescript/build/apis/FormApi.ts
generated
Normal file
311
samples/client/echo_api/typescript/build/apis/FormApi.ts
generated
Normal file
@ -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<RequestContext> {
|
||||
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<RequestContext> {
|
||||
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<RequestContext> {
|
||||
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<HttpInfo<string >> {
|
||||
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<string | Buffer | undefined>(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<HttpInfo<string >> {
|
||||
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<string | Buffer | undefined>(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<HttpInfo<string >> {
|
||||
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<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
|
||||
}
|
||||
|
||||
}
|
102
samples/client/echo_api/typescript/build/apis/HeaderApi.ts
generated
Normal file
102
samples/client/echo_api/typescript/build/apis/HeaderApi.ts
generated
Normal file
@ -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<RequestContext> {
|
||||
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<HttpInfo<string >> {
|
||||
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<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
|
||||
}
|
||||
|
||||
}
|
109
samples/client/echo_api/typescript/build/apis/PathApi.ts
generated
Normal file
109
samples/client/echo_api/typescript/build/apis/PathApi.ts
generated
Normal file
@ -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<RequestContext> {
|
||||
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<HttpInfo<string >> {
|
||||
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<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
|
||||
}
|
||||
|
||||
}
|
678
samples/client/echo_api/typescript/build/apis/QueryApi.ts
generated
Normal file
678
samples/client/echo_api/typescript/build/apis/QueryApi.ts
generated
Normal file
@ -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<RequestContext> {
|
||||
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<RequestContext> {
|
||||
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<RequestContext> {
|
||||
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<RequestContext> {
|
||||
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<RequestContext> {
|
||||
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<number>, _options?: Configuration): Promise<RequestContext> {
|
||||
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<number>", ""));
|
||||
}
|
||||
|
||||
|
||||
|
||||
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<string>, _options?: Configuration): Promise<RequestContext> {
|
||||
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<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 testQueryStyleFormExplodeTrueArrayString(queryObject?: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter, _options?: Configuration): Promise<RequestContext> {
|
||||
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<RequestContext> {
|
||||
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<RequestContext> {
|
||||
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<HttpInfo<string >> {
|
||||
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<string | Buffer | undefined>(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<HttpInfo<string >> {
|
||||
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<string | Buffer | undefined>(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<HttpInfo<string >> {
|
||||
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<string | Buffer | undefined>(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<HttpInfo<string >> {
|
||||
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<string | Buffer | undefined>(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<HttpInfo<string >> {
|
||||
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<string | Buffer | undefined>(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<HttpInfo<string >> {
|
||||
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<string | Buffer | undefined>(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<HttpInfo<string >> {
|
||||
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<string | Buffer | undefined>(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<HttpInfo<string >> {
|
||||
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<string | Buffer | undefined>(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<HttpInfo<string >> {
|
||||
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<string | Buffer | undefined>(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<HttpInfo<string >> {
|
||||
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<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
|
||||
}
|
||||
|
||||
}
|
37
samples/client/echo_api/typescript/build/apis/baseapi.ts
generated
Normal file
37
samples/client/echo_api/typescript/build/apis/baseapi.ts
generated
Normal file
@ -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 + ".");
|
||||
}
|
||||
}
|
15
samples/client/echo_api/typescript/build/apis/exception.ts
generated
Normal file
15
samples/client/echo_api/typescript/build/apis/exception.ts
generated
Normal file
@ -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<T> 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))
|
||||
}
|
||||
}
|
114
samples/client/echo_api/typescript/build/auth/auth.ts
generated
Normal file
114
samples/client/echo_api/typescript/build/auth/auth.ts
generated
Normal file
@ -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<void>;
|
||||
}
|
||||
|
||||
export interface TokenProvider {
|
||||
getToken(): Promise<string> | 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;
|
||||
}
|
94
samples/client/echo_api/typescript/build/configuration.ts
generated
Normal file
94
samples/client/echo_api/typescript/build/configuration.ts
generated
Normal file
@ -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<M = Middleware> {
|
||||
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<M = Middleware> = Partial<Configuration<M>> & MiddlewareMergeOptions;
|
||||
|
||||
// aliases for convenience
|
||||
export type StandardConfigurationOptions = ConfigurationOptions<Middleware>;
|
||||
export type PromiseConfigurationOptions = ConfigurationOptions<PromiseMiddleware>;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
51
samples/client/echo_api/typescript/build/git_push.sh
generated
Normal file
51
samples/client/echo_api/typescript/build/git_push.sh
generated
Normal file
@ -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'
|
256
samples/client/echo_api/typescript/build/http/http.ts
generated
Normal file
256
samples/client/echo_api/typescript/build/http/http.ts
generated
Normal file
@ -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<string, string>;
|
||||
|
||||
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<string>;
|
||||
binary(): Promise<Buffer>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper class to generate a `ResponseBody` from binary data
|
||||
*/
|
||||
export class SelfDecodingBody implements ResponseBody {
|
||||
constructor(private dataSource: Promise<Buffer>) {}
|
||||
|
||||
binary(): Promise<Buffer> {
|
||||
return this.dataSource;
|
||||
}
|
||||
|
||||
async text(): Promise<string> {
|
||||
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<HttpFile> {
|
||||
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<string | Buffer | undefined> {
|
||||
try {
|
||||
return this.body.text();
|
||||
} catch {}
|
||||
|
||||
try {
|
||||
return this.body.binary();
|
||||
} catch {}
|
||||
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
export interface HttpLibrary {
|
||||
send(request: RequestContext): Observable<ResponseContext>;
|
||||
}
|
||||
|
||||
export interface PromiseHttpLibrary {
|
||||
send(request: RequestContext): Promise<ResponseContext>;
|
||||
}
|
||||
|
||||
export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLibrary {
|
||||
return {
|
||||
send(request: RequestContext): Observable<ResponseContext> {
|
||||
return from(promiseHttpLibrary.send(request));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class HttpInfo<T> extends ResponseContext {
|
||||
public constructor(
|
||||
httpStatusCode: number,
|
||||
headers: Headers,
|
||||
body: ResponseBody,
|
||||
public data: T,
|
||||
) {
|
||||
super(httpStatusCode, headers, body);
|
||||
}
|
||||
}
|
32
samples/client/echo_api/typescript/build/http/isomorphic-fetch.ts
generated
Normal file
32
samples/client/echo_api/typescript/build/http/isomorphic-fetch.ts
generated
Normal file
@ -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<ResponseContext> {
|
||||
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<Promise<ResponseContext>>(resultPromise);
|
||||
|
||||
}
|
||||
}
|
13
samples/client/echo_api/typescript/build/index.ts
generated
Normal file
13
samples/client/echo_api/typescript/build/index.ts
generated
Normal file
@ -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';
|
||||
|
66
samples/client/echo_api/typescript/build/middleware.ts
generated
Normal file
66
samples/client/echo_api/typescript/build/middleware.ts
generated
Normal file
@ -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<RequestContext>;
|
||||
/**
|
||||
* 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<ResponseContext>;
|
||||
}
|
||||
|
||||
export class PromiseMiddlewareWrapper implements Middleware {
|
||||
|
||||
public constructor(private middleware: PromiseMiddleware) {
|
||||
|
||||
}
|
||||
|
||||
pre(context: RequestContext): Observable<RequestContext> {
|
||||
return from(this.middleware.pre(context));
|
||||
}
|
||||
|
||||
post(context: ResponseContext): Observable<ResponseContext> {
|
||||
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<RequestContext>;
|
||||
/**
|
||||
* 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<ResponseContext>;
|
||||
}
|
43
samples/client/echo_api/typescript/build/models/Bird.ts
generated
Normal file
43
samples/client/echo_api/typescript/build/models/Bird.ts
generated
Normal file
@ -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() {
|
||||
}
|
||||
}
|
43
samples/client/echo_api/typescript/build/models/Category.ts
generated
Normal file
43
samples/client/echo_api/typescript/build/models/Category.ts
generated
Normal file
@ -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() {
|
||||
}
|
||||
}
|
63
samples/client/echo_api/typescript/build/models/DataQuery.ts
generated
Normal file
63
samples/client/echo_api/typescript/build/models/DataQuery.ts
generated
Normal file
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
96
samples/client/echo_api/typescript/build/models/DefaultValue.ts
generated
Normal file
96
samples/client/echo_api/typescript/build/models/DefaultValue.ts
generated
Normal file
@ -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<StringEnumRef>;
|
||||
'arrayStringEnumDefault'?: Array<DefaultValueArrayStringEnumDefaultEnum>;
|
||||
'arrayStringDefault'?: Array<string>;
|
||||
'arrayIntegerDefault'?: Array<number>;
|
||||
'arrayString'?: Array<string>;
|
||||
'arrayStringNullable'?: Array<string> | null;
|
||||
'arrayStringExtensionNullable'?: Array<string> | 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<StringEnumRef>",
|
||||
"format": ""
|
||||
},
|
||||
{
|
||||
"name": "arrayStringEnumDefault",
|
||||
"baseName": "array_string_enum_default",
|
||||
"type": "Array<DefaultValueArrayStringEnumDefaultEnum>",
|
||||
"format": ""
|
||||
},
|
||||
{
|
||||
"name": "arrayStringDefault",
|
||||
"baseName": "array_string_default",
|
||||
"type": "Array<string>",
|
||||
"format": ""
|
||||
},
|
||||
{
|
||||
"name": "arrayIntegerDefault",
|
||||
"baseName": "array_integer_default",
|
||||
"type": "Array<number>",
|
||||
"format": ""
|
||||
},
|
||||
{
|
||||
"name": "arrayString",
|
||||
"baseName": "array_string",
|
||||
"type": "Array<string>",
|
||||
"format": ""
|
||||
},
|
||||
{
|
||||
"name": "arrayStringNullable",
|
||||
"baseName": "array_string_nullable",
|
||||
"type": "Array<string>",
|
||||
"format": ""
|
||||
},
|
||||
{
|
||||
"name": "arrayStringExtensionNullable",
|
||||
"baseName": "array_string_extension_nullable",
|
||||
"type": "Array<string>",
|
||||
"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'
|
||||
}
|
||||
|
50
samples/client/echo_api/typescript/build/models/NumberPropertiesOnly.ts
generated
Normal file
50
samples/client/echo_api/typescript/build/models/NumberPropertiesOnly.ts
generated
Normal file
@ -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() {
|
||||
}
|
||||
}
|
344
samples/client/echo_api/typescript/build/models/ObjectSerializer.ts
generated
Normal file
344
samples/client/echo_api/typescript/build/models/ObjectSerializer.ts
generated
Normal file
@ -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<string> = new Set<string>([
|
||||
"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> => 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> => 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>): 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.");
|
||||
}
|
||||
}
|
83
samples/client/echo_api/typescript/build/models/Pet.ts
generated
Normal file
83
samples/client/echo_api/typescript/build/models/Pet.ts
generated
Normal file
@ -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<string>;
|
||||
'tags'?: Array<Tag>;
|
||||
/**
|
||||
* 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<string>",
|
||||
"format": ""
|
||||
},
|
||||
{
|
||||
"name": "tags",
|
||||
"baseName": "tags",
|
||||
"type": "Array<Tag>",
|
||||
"format": ""
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"baseName": "status",
|
||||
"type": "PetStatusEnum",
|
||||
"format": ""
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
return Pet.attributeTypeMap;
|
||||
}
|
||||
|
||||
public constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
export enum PetStatusEnum {
|
||||
Available = 'available',
|
||||
Pending = 'pending',
|
||||
Sold = 'sold'
|
||||
}
|
||||
|
53
samples/client/echo_api/typescript/build/models/Query.ts
generated
Normal file
53
samples/client/echo_api/typescript/build/models/Query.ts
generated
Normal file
@ -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<QueryOutcomesEnum>;
|
||||
|
||||
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<QueryOutcomesEnum>",
|
||||
"format": ""
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
return Query.attributeTypeMap;
|
||||
}
|
||||
|
||||
public constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
export enum QueryOutcomesEnum {
|
||||
Success = 'SUCCESS',
|
||||
Failure = 'FAILURE',
|
||||
Skipped = 'SKIPPED'
|
||||
}
|
||||
|
19
samples/client/echo_api/typescript/build/models/StringEnumRef.ts
generated
Normal file
19
samples/client/echo_api/typescript/build/models/StringEnumRef.ts
generated
Normal file
@ -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'
|
||||
}
|
43
samples/client/echo_api/typescript/build/models/Tag.ts
generated
Normal file
43
samples/client/echo_api/typescript/build/models/Tag.ts
generated
Normal file
@ -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() {
|
||||
}
|
||||
}
|
36
samples/client/echo_api/typescript/build/models/TestFormObjectMultipartRequestMarker.ts
generated
Normal file
36
samples/client/echo_api/typescript/build/models/TestFormObjectMultipartRequestMarker.ts
generated
Normal file
@ -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() {
|
||||
}
|
||||
}
|
@ -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() {
|
||||
}
|
||||
}
|
@ -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<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": "values",
|
||||
"baseName": "values",
|
||||
"type": "Array<string>",
|
||||
"format": ""
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
return TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.attributeTypeMap;
|
||||
}
|
||||
|
||||
public constructor() {
|
||||
}
|
||||
}
|
12
samples/client/echo_api/typescript/build/models/all.ts
generated
Normal file
12
samples/client/echo_api/typescript/build/models/all.ts
generated
Normal file
@ -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'
|
43
samples/client/echo_api/typescript/build/package.json
generated
Normal file
43
samples/client/echo_api/typescript/build/package.json
generated
Normal file
@ -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"
|
||||
}
|
||||
}
|
27
samples/client/echo_api/typescript/build/rxjsStub.ts
generated
Normal file
27
samples/client/echo_api/typescript/build/rxjsStub.ts
generated
Normal file
@ -0,0 +1,27 @@
|
||||
export class Observable<T> {
|
||||
constructor(private promise: Promise<T>) {}
|
||||
|
||||
toPromise() {
|
||||
return this.promise;
|
||||
}
|
||||
|
||||
pipe<S>(callback: (value: T) => S | Promise<S>): Observable<S> {
|
||||
return new Observable(this.promise.then(callback));
|
||||
}
|
||||
}
|
||||
|
||||
export function from<T>(promise: Promise<any>) {
|
||||
return new Observable(promise);
|
||||
}
|
||||
|
||||
export function of<T>(value: T) {
|
||||
return new Observable<T>(Promise.resolve(value));
|
||||
}
|
||||
|
||||
export function mergeMap<T, S>(callback: (value: T) => Observable<S>) {
|
||||
return (value: T) => callback(value).toPromise();
|
||||
}
|
||||
|
||||
export function map(callback: any) {
|
||||
return callback;
|
||||
}
|
54
samples/client/echo_api/typescript/build/servers.ts
generated
Normal file
54
samples/client/echo_api/typescript/build/servers.ts
generated
Normal file
@ -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<T extends { [key: string]: string }> 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<T>) {
|
||||
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];
|
35
samples/client/echo_api/typescript/build/tsconfig.json
generated
Normal file
35
samples/client/echo_api/typescript/build/tsconfig.json
generated
Normal file
@ -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",
|
||||
]
|
||||
}
|
949
samples/client/echo_api/typescript/build/types/ObjectParamAPI.ts
generated
Normal file
949
samples/client/echo_api/typescript/build/types/ObjectParamAPI.ts
generated
Normal file
@ -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<HttpInfo<string>> {
|
||||
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<string> {
|
||||
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<HttpInfo<string>> {
|
||||
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<string> {
|
||||
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<HttpFile>
|
||||
}
|
||||
|
||||
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<HttpInfo<HttpFile>> {
|
||||
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<HttpFile> {
|
||||
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<HttpInfo<string>> {
|
||||
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<string> {
|
||||
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<HttpInfo<string>> {
|
||||
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<string> {
|
||||
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<HttpInfo<string>> {
|
||||
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<string> {
|
||||
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<HttpInfo<Pet>> {
|
||||
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<Pet> {
|
||||
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<HttpInfo<string>> {
|
||||
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<string> {
|
||||
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<HttpInfo<Pet>> {
|
||||
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<Pet> {
|
||||
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<HttpInfo<string>> {
|
||||
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<string> {
|
||||
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<HttpInfo<StringEnumRef>> {
|
||||
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<StringEnumRef> {
|
||||
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<HttpInfo<string>> {
|
||||
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<string> {
|
||||
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<HttpInfo<string>> {
|
||||
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<string> {
|
||||
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<HttpInfo<string>> {
|
||||
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<string> {
|
||||
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<HttpInfo<string>> {
|
||||
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<string> {
|
||||
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<HttpInfo<string>> {
|
||||
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<string> {
|
||||
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<HttpInfo<string>> {
|
||||
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<string> {
|
||||
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<number>
|
||||
}
|
||||
|
||||
export interface QueryApiTestQueryStyleFormExplodeFalseArrayStringRequest {
|
||||
/**
|
||||
*
|
||||
* Defaults to: undefined
|
||||
* @type Array<string>
|
||||
* @memberof QueryApitestQueryStyleFormExplodeFalseArrayString
|
||||
*/
|
||||
queryObject?: Array<string>
|
||||
}
|
||||
|
||||
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<HttpInfo<string>> {
|
||||
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<string> {
|
||||
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<HttpInfo<string>> {
|
||||
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<string> {
|
||||
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<HttpInfo<string>> {
|
||||
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<string> {
|
||||
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<HttpInfo<string>> {
|
||||
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<string> {
|
||||
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<HttpInfo<string>> {
|
||||
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<string> {
|
||||
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<HttpInfo<string>> {
|
||||
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<string> {
|
||||
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<HttpInfo<string>> {
|
||||
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<string> {
|
||||
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<HttpInfo<string>> {
|
||||
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<string> {
|
||||
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<HttpInfo<string>> {
|
||||
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<string> {
|
||||
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<HttpInfo<string>> {
|
||||
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<string> {
|
||||
return this.api.testQueryStyleFormExplodeTrueObjectAllOf(param.queryObject, options).toPromise();
|
||||
}
|
||||
|
||||
}
|
1831
samples/client/echo_api/typescript/build/types/ObservableAPI.ts
generated
Normal file
1831
samples/client/echo_api/typescript/build/types/ObservableAPI.ts
generated
Normal file
File diff suppressed because it is too large
Load Diff
1350
samples/client/echo_api/typescript/build/types/PromiseAPI.ts
generated
Normal file
1350
samples/client/echo_api/typescript/build/types/PromiseAPI.ts
generated
Normal file
File diff suppressed because it is too large
Load Diff
37
samples/client/echo_api/typescript/build/util.ts
generated
Normal file
37
samples/client/echo_api/typescript/build/util.ts
generated
Normal file
@ -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
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user