forked from loafle/openapi-generator-original
[Kotlin][Tests]: Add test for kotlin-jvm-okhttp (#20338)
* feat(issue-20231): add echo_api client for kotlin okhttp * build(issue-20231): sync files
This commit is contained in:
parent
b01c8be47f
commit
9fec13af85
@ -19,6 +19,7 @@ jobs:
|
|||||||
# clients
|
# clients
|
||||||
- samples/client/echo_api/kotlin-jvm-spring-3-restclient
|
- samples/client/echo_api/kotlin-jvm-spring-3-restclient
|
||||||
- samples/client/echo_api/kotlin-model-prefix-type-mappings
|
- samples/client/echo_api/kotlin-model-prefix-type-mappings
|
||||||
|
- samples/client/echo_api/kotlin-jvm-okhttp
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-java@v4
|
- uses: actions/setup-java@v4
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -220,6 +220,7 @@ samples/client/petstore/kotlin*/src/main/kotlin/test/
|
|||||||
samples/client/petstore/kotlin*/build/
|
samples/client/petstore/kotlin*/build/
|
||||||
samples/server/others/kotlin-server/jaxrs-spec/build/
|
samples/server/others/kotlin-server/jaxrs-spec/build/
|
||||||
samples/client/echo_api/kotlin-jvm-spring-3-restclient/build/
|
samples/client/echo_api/kotlin-jvm-spring-3-restclient/build/
|
||||||
|
samples/client/echo_api/kotlin-jvm-okhttp/build/
|
||||||
|
|
||||||
# haskell
|
# haskell
|
||||||
.stack-work
|
.stack-work
|
||||||
|
8
bin/configs/kotlin-jvm-okhttp-echo-api.yaml
Normal file
8
bin/configs/kotlin-jvm-okhttp-echo-api.yaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
generatorName: kotlin
|
||||||
|
outputDir: samples/client/echo_api/kotlin-jvm-okhttp
|
||||||
|
inputSpec: modules/openapi-generator/src/test/resources/3_0/kotlin/echo_api.yaml
|
||||||
|
templateDir: modules/openapi-generator/src/main/resources/kotlin-client
|
||||||
|
modelNamePrefix: Api
|
||||||
|
additionalProperties:
|
||||||
|
library: jvm-okhttp4
|
||||||
|
artifactId: kotlin-jvm-okhttp-echo-api
|
@ -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
|
@ -0,0 +1,54 @@
|
|||||||
|
README.md
|
||||||
|
build.gradle
|
||||||
|
docs/AuthApi.md
|
||||||
|
docs/Bird.md
|
||||||
|
docs/BodyApi.md
|
||||||
|
docs/Category.md
|
||||||
|
docs/DefaultValue.md
|
||||||
|
docs/FormApi.md
|
||||||
|
docs/HeaderApi.md
|
||||||
|
docs/NumberPropertiesOnly.md
|
||||||
|
docs/PathApi.md
|
||||||
|
docs/Pet.md
|
||||||
|
docs/Query.md
|
||||||
|
docs/QueryApi.md
|
||||||
|
docs/StringEnumRef.md
|
||||||
|
docs/Tag.md
|
||||||
|
docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md
|
||||||
|
gradle/wrapper/gradle-wrapper.jar
|
||||||
|
gradle/wrapper/gradle-wrapper.properties
|
||||||
|
gradlew
|
||||||
|
gradlew.bat
|
||||||
|
settings.gradle
|
||||||
|
src/main/kotlin/org/openapitools/client/apis/AuthApi.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/apis/BodyApi.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/apis/FormApi.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/apis/HeaderApi.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/apis/PathApi.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/apis/QueryApi.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/models/ApiBird.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/models/ApiCategory.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/models/ApiDefaultValue.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/models/ApiNumberPropertiesOnly.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/models/ApiPet.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/models/ApiQuery.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/models/ApiStringEnumRef.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/models/ApiTag.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/models/ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.kt
|
@ -0,0 +1 @@
|
|||||||
|
7.11.0-SNAPSHOT
|
103
samples/client/echo_api/kotlin-jvm-okhttp/README.md
Normal file
103
samples/client/echo_api/kotlin-jvm-okhttp/README.md
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
# org.openapitools.client - Kotlin client library for Echo Server API
|
||||||
|
|
||||||
|
Echo Server API
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client.
|
||||||
|
|
||||||
|
- API version: 0.1.0
|
||||||
|
- Package version:
|
||||||
|
- Generator version: 7.11.0-SNAPSHOT
|
||||||
|
- Build package: org.openapitools.codegen.languages.KotlinClientCodegen
|
||||||
|
|
||||||
|
## Requires
|
||||||
|
|
||||||
|
* Kotlin 1.7.21
|
||||||
|
* Gradle 7.5
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
|
First, create the gradle wrapper script:
|
||||||
|
|
||||||
|
```
|
||||||
|
gradle wrapper
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, run:
|
||||||
|
|
||||||
|
```
|
||||||
|
./gradlew check assemble
|
||||||
|
```
|
||||||
|
|
||||||
|
This runs all tests and packages the library.
|
||||||
|
|
||||||
|
## Features/Implementation Notes
|
||||||
|
|
||||||
|
* Supports JSON inputs/outputs, File inputs, and Form inputs.
|
||||||
|
* Supports collection formats for query parameters: csv, tsv, ssv, pipes.
|
||||||
|
* Some Kotlin and Java types are fully qualified to avoid conflicts with types defined in OpenAPI definitions.
|
||||||
|
* Implementation of ApiClient is intended to reduce method counts, specifically to benefit Android targets.
|
||||||
|
|
||||||
|
<a id="documentation-for-api-endpoints"></a>
|
||||||
|
## Documentation for API Endpoints
|
||||||
|
|
||||||
|
All URIs are relative to *http://localhost:3000*
|
||||||
|
|
||||||
|
| Class | Method | HTTP request | Description |
|
||||||
|
| ------------ | ------------- | ------------- | ------------- |
|
||||||
|
| *AuthApi* | [**testAuthHttpBasic**](docs/AuthApi.md#testauthhttpbasic) | **POST** /auth/http/basic | To test HTTP basic authentication |
|
||||||
|
| *AuthApi* | [**testAuthHttpBearer**](docs/AuthApi.md#testauthhttpbearer) | **POST** /auth/http/bearer | To test HTTP bearer authentication |
|
||||||
|
| *BodyApi* | [**testBinaryGif**](docs/BodyApi.md#testbinarygif) | **POST** /binary/gif | Test binary (gif) response body |
|
||||||
|
| *BodyApi* | [**testBodyApplicationOctetstreamBinary**](docs/BodyApi.md#testbodyapplicationoctetstreambinary) | **POST** /body/application/octetstream/binary | Test body parameter(s) |
|
||||||
|
| *BodyApi* | [**testBodyMultipartFormdataArrayOfBinary**](docs/BodyApi.md#testbodymultipartformdataarrayofbinary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime |
|
||||||
|
| *BodyApi* | [**testBodyMultipartFormdataSingleBinary**](docs/BodyApi.md#testbodymultipartformdatasinglebinary) | **POST** /body/application/octetstream/single_binary | Test single binary in multipart mime |
|
||||||
|
| *BodyApi* | [**testEchoBodyFreeFormObjectResponseString**](docs/BodyApi.md#testechobodyfreeformobjectresponsestring) | **POST** /echo/body/FreeFormObject/response_string | Test free form object |
|
||||||
|
| *BodyApi* | [**testEchoBodyPet**](docs/BodyApi.md#testechobodypet) | **POST** /echo/body/Pet | Test body parameter(s) |
|
||||||
|
| *BodyApi* | [**testEchoBodyPetResponseString**](docs/BodyApi.md#testechobodypetresponsestring) | **POST** /echo/body/Pet/response_string | Test empty response body |
|
||||||
|
| *BodyApi* | [**testEchoBodyTagResponseString**](docs/BodyApi.md#testechobodytagresponsestring) | **POST** /echo/body/Tag/response_string | Test empty json (request body) |
|
||||||
|
| *FormApi* | [**testFormIntegerBooleanString**](docs/FormApi.md#testformintegerbooleanstring) | **POST** /form/integer/boolean/string | Test form parameter(s) |
|
||||||
|
| *FormApi* | [**testFormOneof**](docs/FormApi.md#testformoneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema |
|
||||||
|
| *HeaderApi* | [**testHeaderIntegerBooleanStringEnums**](docs/HeaderApi.md#testheaderintegerbooleanstringenums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s) |
|
||||||
|
| *PathApi* | [**testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath**](docs/PathApi.md#testspathstringpathstringintegerpathintegerenumnonrefstringpathenumrefstringpath) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s) |
|
||||||
|
| *QueryApi* | [**testEnumRefString**](docs/QueryApi.md#testenumrefstring) | **GET** /query/enum_ref_string | Test query parameter(s) |
|
||||||
|
| *QueryApi* | [**testQueryDatetimeDateString**](docs/QueryApi.md#testquerydatetimedatestring) | **GET** /query/datetime/date/string | Test query parameter(s) |
|
||||||
|
| *QueryApi* | [**testQueryIntegerBooleanString**](docs/QueryApi.md#testqueryintegerbooleanstring) | **GET** /query/integer/boolean/string | Test query parameter(s) |
|
||||||
|
| *QueryApi* | [**testQueryStyleDeepObjectExplodeTrueObject**](docs/QueryApi.md#testquerystyledeepobjectexplodetrueobject) | **GET** /query/style_deepObject/explode_true/object | Test query parameter(s) |
|
||||||
|
| *QueryApi* | [**testQueryStyleFormExplodeTrueArrayString**](docs/QueryApi.md#testquerystyleformexplodetruearraystring) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s) |
|
||||||
|
| *QueryApi* | [**testQueryStyleFormExplodeTrueObject**](docs/QueryApi.md#testquerystyleformexplodetrueobject) | **GET** /query/style_form/explode_true/object | Test query parameter(s) |
|
||||||
|
|
||||||
|
|
||||||
|
<a id="documentation-for-models"></a>
|
||||||
|
## Documentation for Models
|
||||||
|
|
||||||
|
- [org.openapitools.client.models.ApiBird](docs/ApiBird.md)
|
||||||
|
- [org.openapitools.client.models.ApiCategory](docs/ApiCategory.md)
|
||||||
|
- [org.openapitools.client.models.ApiDefaultValue](docs/ApiDefaultValue.md)
|
||||||
|
- [org.openapitools.client.models.ApiNumberPropertiesOnly](docs/ApiNumberPropertiesOnly.md)
|
||||||
|
- [org.openapitools.client.models.ApiPet](docs/ApiPet.md)
|
||||||
|
- [org.openapitools.client.models.ApiQuery](docs/ApiQuery.md)
|
||||||
|
- [org.openapitools.client.models.ApiStringEnumRef](docs/ApiStringEnumRef.md)
|
||||||
|
- [org.openapitools.client.models.ApiTag](docs/ApiTag.md)
|
||||||
|
- [org.openapitools.client.models.ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md)
|
||||||
|
|
||||||
|
|
||||||
|
<a id="documentation-for-authorization"></a>
|
||||||
|
## Documentation for Authorization
|
||||||
|
|
||||||
|
|
||||||
|
Authentication schemes defined for the API:
|
||||||
|
<a id="http_auth"></a>
|
||||||
|
### http_auth
|
||||||
|
|
||||||
|
- **Type**: HTTP basic authentication
|
||||||
|
|
||||||
|
<a id="http_bearer_auth"></a>
|
||||||
|
### http_bearer_auth
|
||||||
|
|
||||||
|
- **Type**: HTTP Bearer Token authentication
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Author
|
||||||
|
|
||||||
|
team@openapitools.org
|
62
samples/client/echo_api/kotlin-jvm-okhttp/build.gradle
Normal file
62
samples/client/echo_api/kotlin-jvm-okhttp/build.gradle
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
group 'org.openapitools'
|
||||||
|
version '1.0.0'
|
||||||
|
|
||||||
|
wrapper {
|
||||||
|
gradleVersion = '8.7'
|
||||||
|
distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
|
||||||
|
}
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
ext.kotlin_version = '1.9.23'
|
||||||
|
ext.spotless_version = "6.25.0"
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven { url "https://repo1.maven.org/maven2" }
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
|
classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: 'kotlin'
|
||||||
|
apply plugin: 'maven-publish'
|
||||||
|
apply plugin: 'com.diffplug.spotless'
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven { url "https://repo1.maven.org/maven2" }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use spotless plugin to automatically format code, remove unused import, etc
|
||||||
|
// To apply changes directly to the file, run `gradlew spotlessApply`
|
||||||
|
// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle
|
||||||
|
spotless {
|
||||||
|
// comment out below to run spotless as part of the `check` task
|
||||||
|
enforceCheck false
|
||||||
|
|
||||||
|
format 'misc', {
|
||||||
|
// define the files (e.g. '*.gradle', '*.md') to apply `misc` to
|
||||||
|
target '.gitignore'
|
||||||
|
|
||||||
|
// define the steps to apply to those files
|
||||||
|
trimTrailingWhitespace()
|
||||||
|
indentWithSpaces() // Takes an integer argument if you don't like 4
|
||||||
|
endWithNewline()
|
||||||
|
}
|
||||||
|
kotlin {
|
||||||
|
ktfmt()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||||
|
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||||
|
implementation "com.squareup.moshi:moshi-kotlin:1.15.1"
|
||||||
|
implementation "com.squareup.moshi:moshi-adapters:1.15.1"
|
||||||
|
implementation "com.squareup.okhttp3:okhttp:4.12.0"
|
||||||
|
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||||
|
}
|
101
samples/client/echo_api/kotlin-jvm-okhttp/docs/AuthApi.md
Normal file
101
samples/client/echo_api/kotlin-jvm-okhttp/docs/AuthApi.md
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
# 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 |
|
||||||
|
|
||||||
|
|
||||||
|
<a id="testAuthHttpBasic"></a>
|
||||||
|
# **testAuthHttpBasic**
|
||||||
|
> kotlin.String testAuthHttpBasic()
|
||||||
|
|
||||||
|
To test HTTP basic authentication
|
||||||
|
|
||||||
|
To test HTTP basic authentication
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiInstance = AuthApi()
|
||||||
|
try {
|
||||||
|
val result : kotlin.String = apiInstance.testAuthHttpBasic()
|
||||||
|
println(result)
|
||||||
|
} catch (e: ClientException) {
|
||||||
|
println("4xx response calling AuthApi#testAuthHttpBasic")
|
||||||
|
e.printStackTrace()
|
||||||
|
} catch (e: ServerException) {
|
||||||
|
println("5xx response calling AuthApi#testAuthHttpBasic")
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
This endpoint does not need any parameter.
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**kotlin.String**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
|
||||||
|
Configure http_auth:
|
||||||
|
ApiClient.username = ""
|
||||||
|
ApiClient.password = ""
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
||||||
|
<a id="testAuthHttpBearer"></a>
|
||||||
|
# **testAuthHttpBearer**
|
||||||
|
> kotlin.String testAuthHttpBearer()
|
||||||
|
|
||||||
|
To test HTTP bearer authentication
|
||||||
|
|
||||||
|
To test HTTP bearer authentication
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiInstance = AuthApi()
|
||||||
|
try {
|
||||||
|
val result : kotlin.String = apiInstance.testAuthHttpBearer()
|
||||||
|
println(result)
|
||||||
|
} catch (e: ClientException) {
|
||||||
|
println("4xx response calling AuthApi#testAuthHttpBearer")
|
||||||
|
e.printStackTrace()
|
||||||
|
} catch (e: ServerException) {
|
||||||
|
println("5xx response calling AuthApi#testAuthHttpBearer")
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
This endpoint does not need any parameter.
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**kotlin.String**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
|
||||||
|
Configure http_bearer_auth:
|
||||||
|
ApiClient.accessToken = ""
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
11
samples/client/echo_api/kotlin-jvm-okhttp/docs/Bird.md
Normal file
11
samples/client/echo_api/kotlin-jvm-okhttp/docs/Bird.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
# ApiBird
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
| ------------ | ------------- | ------------- | ------------- |
|
||||||
|
| **propertySize** | **kotlin.String** | | [optional] |
|
||||||
|
| **color** | **kotlin.String** | | [optional] |
|
||||||
|
|
||||||
|
|
||||||
|
|
381
samples/client/echo_api/kotlin-jvm-okhttp/docs/BodyApi.md
Normal file
381
samples/client/echo_api/kotlin-jvm-okhttp/docs/BodyApi.md
Normal file
@ -0,0 +1,381 @@
|
|||||||
|
# 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 |
|
||||||
|
| [**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 |
|
||||||
|
| [**testEchoBodyTagResponseString**](BodyApi.md#testEchoBodyTagResponseString) | **POST** /echo/body/Tag/response_string | Test empty json (request body) |
|
||||||
|
|
||||||
|
|
||||||
|
<a id="testBinaryGif"></a>
|
||||||
|
# **testBinaryGif**
|
||||||
|
> java.io.File testBinaryGif()
|
||||||
|
|
||||||
|
Test binary (gif) response body
|
||||||
|
|
||||||
|
Test binary (gif) response body
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiInstance = BodyApi()
|
||||||
|
try {
|
||||||
|
val result : java.io.File = apiInstance.testBinaryGif()
|
||||||
|
println(result)
|
||||||
|
} catch (e: ClientException) {
|
||||||
|
println("4xx response calling BodyApi#testBinaryGif")
|
||||||
|
e.printStackTrace()
|
||||||
|
} catch (e: ServerException) {
|
||||||
|
println("5xx response calling BodyApi#testBinaryGif")
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
This endpoint does not need any parameter.
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**java.io.File**](java.io.File.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
<a id="testBodyApplicationOctetstreamBinary"></a>
|
||||||
|
# **testBodyApplicationOctetstreamBinary**
|
||||||
|
> kotlin.String testBodyApplicationOctetstreamBinary(body)
|
||||||
|
|
||||||
|
Test body parameter(s)
|
||||||
|
|
||||||
|
Test body parameter(s)
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiInstance = BodyApi()
|
||||||
|
val body : java.io.File = BINARY_DATA_HERE // java.io.File |
|
||||||
|
try {
|
||||||
|
val result : kotlin.String = apiInstance.testBodyApplicationOctetstreamBinary(body)
|
||||||
|
println(result)
|
||||||
|
} catch (e: ClientException) {
|
||||||
|
println("4xx response calling BodyApi#testBodyApplicationOctetstreamBinary")
|
||||||
|
e.printStackTrace()
|
||||||
|
} catch (e: ServerException) {
|
||||||
|
println("5xx response calling BodyApi#testBodyApplicationOctetstreamBinary")
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
| ------------- | ------------- | ------------- | ------------- |
|
||||||
|
| **body** | **java.io.File**| | [optional] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**kotlin.String**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/octet-stream
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
||||||
|
<a id="testBodyMultipartFormdataArrayOfBinary"></a>
|
||||||
|
# **testBodyMultipartFormdataArrayOfBinary**
|
||||||
|
> kotlin.String testBodyMultipartFormdataArrayOfBinary(files)
|
||||||
|
|
||||||
|
Test array of binary in multipart mime
|
||||||
|
|
||||||
|
Test array of binary in multipart mime
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiInstance = BodyApi()
|
||||||
|
val files : kotlin.collections.List<java.io.File> = /path/to/file.txt // kotlin.collections.List<java.io.File> |
|
||||||
|
try {
|
||||||
|
val result : kotlin.String = apiInstance.testBodyMultipartFormdataArrayOfBinary(files)
|
||||||
|
println(result)
|
||||||
|
} catch (e: ClientException) {
|
||||||
|
println("4xx response calling BodyApi#testBodyMultipartFormdataArrayOfBinary")
|
||||||
|
e.printStackTrace()
|
||||||
|
} catch (e: ServerException) {
|
||||||
|
println("5xx response calling BodyApi#testBodyMultipartFormdataArrayOfBinary")
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
| ------------- | ------------- | ------------- | ------------- |
|
||||||
|
| **files** | **kotlin.collections.List<java.io.File>**| | |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**kotlin.String**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: multipart/form-data
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
||||||
|
<a id="testBodyMultipartFormdataSingleBinary"></a>
|
||||||
|
# **testBodyMultipartFormdataSingleBinary**
|
||||||
|
> kotlin.String testBodyMultipartFormdataSingleBinary(myFile)
|
||||||
|
|
||||||
|
Test single binary in multipart mime
|
||||||
|
|
||||||
|
Test single binary in multipart mime
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiInstance = BodyApi()
|
||||||
|
val myFile : java.io.File = BINARY_DATA_HERE // java.io.File |
|
||||||
|
try {
|
||||||
|
val result : kotlin.String = apiInstance.testBodyMultipartFormdataSingleBinary(myFile)
|
||||||
|
println(result)
|
||||||
|
} catch (e: ClientException) {
|
||||||
|
println("4xx response calling BodyApi#testBodyMultipartFormdataSingleBinary")
|
||||||
|
e.printStackTrace()
|
||||||
|
} catch (e: ServerException) {
|
||||||
|
println("5xx response calling BodyApi#testBodyMultipartFormdataSingleBinary")
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
| ------------- | ------------- | ------------- | ------------- |
|
||||||
|
| **myFile** | **java.io.File**| | [optional] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**kotlin.String**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: multipart/form-data
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
||||||
|
<a id="testEchoBodyFreeFormObjectResponseString"></a>
|
||||||
|
# **testEchoBodyFreeFormObjectResponseString**
|
||||||
|
> kotlin.String testEchoBodyFreeFormObjectResponseString(body)
|
||||||
|
|
||||||
|
Test free form object
|
||||||
|
|
||||||
|
Test free form object
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiInstance = BodyApi()
|
||||||
|
val body : kotlin.Any = Object // kotlin.Any | Free form object
|
||||||
|
try {
|
||||||
|
val result : kotlin.String = apiInstance.testEchoBodyFreeFormObjectResponseString(body)
|
||||||
|
println(result)
|
||||||
|
} catch (e: ClientException) {
|
||||||
|
println("4xx response calling BodyApi#testEchoBodyFreeFormObjectResponseString")
|
||||||
|
e.printStackTrace()
|
||||||
|
} catch (e: ServerException) {
|
||||||
|
println("5xx response calling BodyApi#testEchoBodyFreeFormObjectResponseString")
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
| ------------- | ------------- | ------------- | ------------- |
|
||||||
|
| **body** | **kotlin.Any**| Free form object | [optional] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**kotlin.String**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
||||||
|
<a id="testEchoBodyPet"></a>
|
||||||
|
# **testEchoBodyPet**
|
||||||
|
> ApiPet testEchoBodyPet(apiPet)
|
||||||
|
|
||||||
|
Test body parameter(s)
|
||||||
|
|
||||||
|
Test body parameter(s)
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiInstance = BodyApi()
|
||||||
|
val apiPet : ApiPet = // ApiPet | Pet object that needs to be added to the store
|
||||||
|
try {
|
||||||
|
val result : ApiPet = apiInstance.testEchoBodyPet(apiPet)
|
||||||
|
println(result)
|
||||||
|
} catch (e: ClientException) {
|
||||||
|
println("4xx response calling BodyApi#testEchoBodyPet")
|
||||||
|
e.printStackTrace()
|
||||||
|
} catch (e: ServerException) {
|
||||||
|
println("5xx response calling BodyApi#testEchoBodyPet")
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
| ------------- | ------------- | ------------- | ------------- |
|
||||||
|
| **apiPet** | [**ApiPet**](ApiPet.md)| Pet object that needs to be added to the store | [optional] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**ApiPet**](ApiPet.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
<a id="testEchoBodyPetResponseString"></a>
|
||||||
|
# **testEchoBodyPetResponseString**
|
||||||
|
> kotlin.String testEchoBodyPetResponseString(apiPet)
|
||||||
|
|
||||||
|
Test empty response body
|
||||||
|
|
||||||
|
Test empty response body
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiInstance = BodyApi()
|
||||||
|
val apiPet : ApiPet = // ApiPet | Pet object that needs to be added to the store
|
||||||
|
try {
|
||||||
|
val result : kotlin.String = apiInstance.testEchoBodyPetResponseString(apiPet)
|
||||||
|
println(result)
|
||||||
|
} catch (e: ClientException) {
|
||||||
|
println("4xx response calling BodyApi#testEchoBodyPetResponseString")
|
||||||
|
e.printStackTrace()
|
||||||
|
} catch (e: ServerException) {
|
||||||
|
println("5xx response calling BodyApi#testEchoBodyPetResponseString")
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
| ------------- | ------------- | ------------- | ------------- |
|
||||||
|
| **apiPet** | [**ApiPet**](ApiPet.md)| Pet object that needs to be added to the store | [optional] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**kotlin.String**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
||||||
|
<a id="testEchoBodyTagResponseString"></a>
|
||||||
|
# **testEchoBodyTagResponseString**
|
||||||
|
> kotlin.String testEchoBodyTagResponseString(apiTag)
|
||||||
|
|
||||||
|
Test empty json (request body)
|
||||||
|
|
||||||
|
Test empty json (request body)
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiInstance = BodyApi()
|
||||||
|
val apiTag : ApiTag = // ApiTag | Tag object
|
||||||
|
try {
|
||||||
|
val result : kotlin.String = apiInstance.testEchoBodyTagResponseString(apiTag)
|
||||||
|
println(result)
|
||||||
|
} catch (e: ClientException) {
|
||||||
|
println("4xx response calling BodyApi#testEchoBodyTagResponseString")
|
||||||
|
e.printStackTrace()
|
||||||
|
} catch (e: ServerException) {
|
||||||
|
println("5xx response calling BodyApi#testEchoBodyTagResponseString")
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
| ------------- | ------------- | ------------- | ------------- |
|
||||||
|
| **apiTag** | [**ApiTag**](ApiTag.md)| Tag object | [optional] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**kotlin.String**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
11
samples/client/echo_api/kotlin-jvm-okhttp/docs/Category.md
Normal file
11
samples/client/echo_api/kotlin-jvm-okhttp/docs/Category.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
# ApiCategory
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
| ------------ | ------------- | ------------- | ------------- |
|
||||||
|
| **id** | **kotlin.Long** | | [optional] |
|
||||||
|
| **name** | **kotlin.String** | | [optional] |
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
|||||||
|
|
||||||
|
# ApiDefaultValue
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
| ------------ | ------------- | ------------- | ------------- |
|
||||||
|
| **arrayStringEnumRefDefault** | [**kotlin.collections.List<ApiStringEnumRef>**](ApiStringEnumRef.md) | | [optional] |
|
||||||
|
| **arrayStringEnumDefault** | [**inline**](#kotlin.collections.List<ArrayStringEnumDefault>) | | [optional] |
|
||||||
|
| **arrayStringDefault** | **kotlin.collections.List<kotlin.String>** | | [optional] |
|
||||||
|
| **arrayIntegerDefault** | **kotlin.collections.List<kotlin.Int>** | | [optional] |
|
||||||
|
| **arrayString** | **kotlin.collections.List<kotlin.String>** | | [optional] |
|
||||||
|
| **arrayStringNullable** | **kotlin.collections.List<kotlin.String>** | | [optional] |
|
||||||
|
| **arrayStringExtensionNullable** | **kotlin.collections.List<kotlin.String>** | | [optional] |
|
||||||
|
| **stringNullable** | **kotlin.String** | | [optional] |
|
||||||
|
|
||||||
|
|
||||||
|
<a id="kotlin.collections.List<ArrayStringEnumDefault>"></a>
|
||||||
|
## Enum: array_string_enum_default
|
||||||
|
| Name | Value |
|
||||||
|
| ---- | ----- |
|
||||||
|
| arrayStringEnumDefault | success, failure, unclassified |
|
||||||
|
|
||||||
|
|
||||||
|
|
116
samples/client/echo_api/kotlin-jvm-okhttp/docs/FormApi.md
Normal file
116
samples/client/echo_api/kotlin-jvm-okhttp/docs/FormApi.md
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
# 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) |
|
||||||
|
| [**testFormOneof**](FormApi.md#testFormOneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema |
|
||||||
|
|
||||||
|
|
||||||
|
<a id="testFormIntegerBooleanString"></a>
|
||||||
|
# **testFormIntegerBooleanString**
|
||||||
|
> kotlin.String testFormIntegerBooleanString(integerForm, booleanForm, stringForm)
|
||||||
|
|
||||||
|
Test form parameter(s)
|
||||||
|
|
||||||
|
Test form parameter(s)
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiInstance = FormApi()
|
||||||
|
val integerForm : kotlin.Int = 56 // kotlin.Int |
|
||||||
|
val booleanForm : kotlin.Boolean = true // kotlin.Boolean |
|
||||||
|
val stringForm : kotlin.String = stringForm_example // kotlin.String |
|
||||||
|
try {
|
||||||
|
val result : kotlin.String = apiInstance.testFormIntegerBooleanString(integerForm, booleanForm, stringForm)
|
||||||
|
println(result)
|
||||||
|
} catch (e: ClientException) {
|
||||||
|
println("4xx response calling FormApi#testFormIntegerBooleanString")
|
||||||
|
e.printStackTrace()
|
||||||
|
} catch (e: ServerException) {
|
||||||
|
println("5xx response calling FormApi#testFormIntegerBooleanString")
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
| **integerForm** | **kotlin.Int**| | [optional] |
|
||||||
|
| **booleanForm** | **kotlin.Boolean**| | [optional] |
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
| ------------- | ------------- | ------------- | ------------- |
|
||||||
|
| **stringForm** | **kotlin.String**| | [optional] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**kotlin.String**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/x-www-form-urlencoded
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
||||||
|
<a id="testFormOneof"></a>
|
||||||
|
# **testFormOneof**
|
||||||
|
> kotlin.String testFormOneof(form1, form2, form3, form4, id, name)
|
||||||
|
|
||||||
|
Test form parameter(s) for oneOf schema
|
||||||
|
|
||||||
|
Test form parameter(s) for oneOf schema
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiInstance = FormApi()
|
||||||
|
val form1 : kotlin.String = form1_example // kotlin.String |
|
||||||
|
val form2 : kotlin.Int = 56 // kotlin.Int |
|
||||||
|
val form3 : kotlin.String = form3_example // kotlin.String |
|
||||||
|
val form4 : kotlin.Boolean = true // kotlin.Boolean |
|
||||||
|
val id : kotlin.Long = 789 // kotlin.Long |
|
||||||
|
val name : kotlin.String = name_example // kotlin.String |
|
||||||
|
try {
|
||||||
|
val result : kotlin.String = apiInstance.testFormOneof(form1, form2, form3, form4, id, name)
|
||||||
|
println(result)
|
||||||
|
} catch (e: ClientException) {
|
||||||
|
println("4xx response calling FormApi#testFormOneof")
|
||||||
|
e.printStackTrace()
|
||||||
|
} catch (e: ServerException) {
|
||||||
|
println("5xx response calling FormApi#testFormOneof")
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
| **form1** | **kotlin.String**| | [optional] |
|
||||||
|
| **form2** | **kotlin.Int**| | [optional] |
|
||||||
|
| **form3** | **kotlin.String**| | [optional] |
|
||||||
|
| **form4** | **kotlin.Boolean**| | [optional] |
|
||||||
|
| **id** | **kotlin.Long**| | [optional] |
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
| ------------- | ------------- | ------------- | ------------- |
|
||||||
|
| **name** | **kotlin.String**| | [optional] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**kotlin.String**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/x-www-form-urlencoded
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
63
samples/client/echo_api/kotlin-jvm-okhttp/docs/HeaderApi.md
Normal file
63
samples/client/echo_api/kotlin-jvm-okhttp/docs/HeaderApi.md
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
# 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) |
|
||||||
|
|
||||||
|
|
||||||
|
<a id="testHeaderIntegerBooleanStringEnums"></a>
|
||||||
|
# **testHeaderIntegerBooleanStringEnums**
|
||||||
|
> kotlin.String testHeaderIntegerBooleanStringEnums(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader)
|
||||||
|
|
||||||
|
Test header parameter(s)
|
||||||
|
|
||||||
|
Test header parameter(s)
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiInstance = HeaderApi()
|
||||||
|
val integerHeader : kotlin.Int = 56 // kotlin.Int |
|
||||||
|
val booleanHeader : kotlin.Boolean = true // kotlin.Boolean |
|
||||||
|
val stringHeader : kotlin.String = stringHeader_example // kotlin.String |
|
||||||
|
val enumNonrefStringHeader : kotlin.String = enumNonrefStringHeader_example // kotlin.String |
|
||||||
|
val enumRefStringHeader : ApiStringEnumRef = // ApiStringEnumRef |
|
||||||
|
try {
|
||||||
|
val result : kotlin.String = apiInstance.testHeaderIntegerBooleanStringEnums(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader)
|
||||||
|
println(result)
|
||||||
|
} catch (e: ClientException) {
|
||||||
|
println("4xx response calling HeaderApi#testHeaderIntegerBooleanStringEnums")
|
||||||
|
e.printStackTrace()
|
||||||
|
} catch (e: ServerException) {
|
||||||
|
println("5xx response calling HeaderApi#testHeaderIntegerBooleanStringEnums")
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
| **integerHeader** | **kotlin.Int**| | [optional] |
|
||||||
|
| **booleanHeader** | **kotlin.Boolean**| | [optional] |
|
||||||
|
| **stringHeader** | **kotlin.String**| | [optional] |
|
||||||
|
| **enumNonrefStringHeader** | **kotlin.String**| | [optional] [enum: success, failure, unclassified] |
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
| ------------- | ------------- | ------------- | ------------- |
|
||||||
|
| **enumRefStringHeader** | [**ApiStringEnumRef**](.md)| | [optional] [enum: success, failure, unclassified] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**kotlin.String**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
# ApiNumberPropertiesOnly
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
| ------------ | ------------- | ------------- | ------------- |
|
||||||
|
| **number** | [**java.math.BigDecimal**](java.math.BigDecimal.md) | | [optional] |
|
||||||
|
| **float** | **kotlin.Float** | | [optional] |
|
||||||
|
| **double** | **kotlin.Double** | | [optional] |
|
||||||
|
|
||||||
|
|
||||||
|
|
61
samples/client/echo_api/kotlin-jvm-okhttp/docs/PathApi.md
Normal file
61
samples/client/echo_api/kotlin-jvm-okhttp/docs/PathApi.md
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
# 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) |
|
||||||
|
|
||||||
|
|
||||||
|
<a id="testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath"></a>
|
||||||
|
# **testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath**
|
||||||
|
> kotlin.String testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath)
|
||||||
|
|
||||||
|
Test path parameter(s)
|
||||||
|
|
||||||
|
Test path parameter(s)
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiInstance = PathApi()
|
||||||
|
val pathString : kotlin.String = pathString_example // kotlin.String |
|
||||||
|
val pathInteger : kotlin.Int = 56 // kotlin.Int |
|
||||||
|
val enumNonrefStringPath : kotlin.String = enumNonrefStringPath_example // kotlin.String |
|
||||||
|
val enumRefStringPath : ApiStringEnumRef = // ApiStringEnumRef |
|
||||||
|
try {
|
||||||
|
val result : kotlin.String = apiInstance.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath)
|
||||||
|
println(result)
|
||||||
|
} catch (e: ClientException) {
|
||||||
|
println("4xx response calling PathApi#testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath")
|
||||||
|
e.printStackTrace()
|
||||||
|
} catch (e: ServerException) {
|
||||||
|
println("5xx response calling PathApi#testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath")
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
| **pathString** | **kotlin.String**| | |
|
||||||
|
| **pathInteger** | **kotlin.Int**| | |
|
||||||
|
| **enumNonrefStringPath** | **kotlin.String**| | [enum: success, failure, unclassified] |
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
| ------------- | ------------- | ------------- | ------------- |
|
||||||
|
| **enumRefStringPath** | [**ApiStringEnumRef**](.md)| | [enum: success, failure, unclassified] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**kotlin.String**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
22
samples/client/echo_api/kotlin-jvm-okhttp/docs/Pet.md
Normal file
22
samples/client/echo_api/kotlin-jvm-okhttp/docs/Pet.md
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
# ApiPet
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
| ------------ | ------------- | ------------- | ------------- |
|
||||||
|
| **name** | **kotlin.String** | | |
|
||||||
|
| **photoUrls** | **kotlin.collections.List<kotlin.String>** | | |
|
||||||
|
| **id** | **kotlin.Long** | | [optional] |
|
||||||
|
| **category** | [**ApiCategory**](ApiCategory.md) | | [optional] |
|
||||||
|
| **tags** | [**kotlin.collections.List<ApiTag>**](ApiTag.md) | | [optional] |
|
||||||
|
| **status** | [**inline**](#Status) | pet status in the store | [optional] |
|
||||||
|
|
||||||
|
|
||||||
|
<a id="Status"></a>
|
||||||
|
## Enum: status
|
||||||
|
| Name | Value |
|
||||||
|
| ---- | ----- |
|
||||||
|
| status | available, pending, sold |
|
||||||
|
|
||||||
|
|
||||||
|
|
18
samples/client/echo_api/kotlin-jvm-okhttp/docs/Query.md
Normal file
18
samples/client/echo_api/kotlin-jvm-okhttp/docs/Query.md
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
# ApiQuery
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
| ------------ | ------------- | ------------- | ------------- |
|
||||||
|
| **id** | **kotlin.Long** | Query | [optional] |
|
||||||
|
| **outcomes** | [**inline**](#kotlin.collections.List<Outcomes>) | | [optional] |
|
||||||
|
|
||||||
|
|
||||||
|
<a id="kotlin.collections.List<Outcomes>"></a>
|
||||||
|
## Enum: outcomes
|
||||||
|
| Name | Value |
|
||||||
|
| ---- | ----- |
|
||||||
|
| outcomes | SUCCESS, FAILURE, SKIPPED |
|
||||||
|
|
||||||
|
|
||||||
|
|
300
samples/client/echo_api/kotlin-jvm-okhttp/docs/QueryApi.md
Normal file
300
samples/client/echo_api/kotlin-jvm-okhttp/docs/QueryApi.md
Normal file
@ -0,0 +1,300 @@
|
|||||||
|
# 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) |
|
||||||
|
| [**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) |
|
||||||
|
|
||||||
|
|
||||||
|
<a id="testEnumRefString"></a>
|
||||||
|
# **testEnumRefString**
|
||||||
|
> kotlin.String testEnumRefString(enumNonrefStringQuery, enumRefStringQuery)
|
||||||
|
|
||||||
|
Test query parameter(s)
|
||||||
|
|
||||||
|
Test query parameter(s)
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiInstance = QueryApi()
|
||||||
|
val enumNonrefStringQuery : kotlin.String = enumNonrefStringQuery_example // kotlin.String |
|
||||||
|
val enumRefStringQuery : ApiStringEnumRef = // ApiStringEnumRef |
|
||||||
|
try {
|
||||||
|
val result : kotlin.String = apiInstance.testEnumRefString(enumNonrefStringQuery, enumRefStringQuery)
|
||||||
|
println(result)
|
||||||
|
} catch (e: ClientException) {
|
||||||
|
println("4xx response calling QueryApi#testEnumRefString")
|
||||||
|
e.printStackTrace()
|
||||||
|
} catch (e: ServerException) {
|
||||||
|
println("5xx response calling QueryApi#testEnumRefString")
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
| **enumNonrefStringQuery** | **kotlin.String**| | [optional] [enum: success, failure, unclassified] |
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
| ------------- | ------------- | ------------- | ------------- |
|
||||||
|
| **enumRefStringQuery** | [**ApiStringEnumRef**](.md)| | [optional] [enum: success, failure, unclassified] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**kotlin.String**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
||||||
|
<a id="testQueryDatetimeDateString"></a>
|
||||||
|
# **testQueryDatetimeDateString**
|
||||||
|
> kotlin.String testQueryDatetimeDateString(datetimeQuery, dateQuery, stringQuery)
|
||||||
|
|
||||||
|
Test query parameter(s)
|
||||||
|
|
||||||
|
Test query parameter(s)
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiInstance = QueryApi()
|
||||||
|
val datetimeQuery : java.time.OffsetDateTime = 2013-10-20T19:20:30+01:00 // java.time.OffsetDateTime |
|
||||||
|
val dateQuery : java.time.LocalDate = 2013-10-20 // java.time.LocalDate |
|
||||||
|
val stringQuery : kotlin.String = stringQuery_example // kotlin.String |
|
||||||
|
try {
|
||||||
|
val result : kotlin.String = apiInstance.testQueryDatetimeDateString(datetimeQuery, dateQuery, stringQuery)
|
||||||
|
println(result)
|
||||||
|
} catch (e: ClientException) {
|
||||||
|
println("4xx response calling QueryApi#testQueryDatetimeDateString")
|
||||||
|
e.printStackTrace()
|
||||||
|
} catch (e: ServerException) {
|
||||||
|
println("5xx response calling QueryApi#testQueryDatetimeDateString")
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
| **datetimeQuery** | **java.time.OffsetDateTime**| | [optional] |
|
||||||
|
| **dateQuery** | **java.time.LocalDate**| | [optional] |
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
| ------------- | ------------- | ------------- | ------------- |
|
||||||
|
| **stringQuery** | **kotlin.String**| | [optional] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**kotlin.String**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
||||||
|
<a id="testQueryIntegerBooleanString"></a>
|
||||||
|
# **testQueryIntegerBooleanString**
|
||||||
|
> kotlin.String testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery)
|
||||||
|
|
||||||
|
Test query parameter(s)
|
||||||
|
|
||||||
|
Test query parameter(s)
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiInstance = QueryApi()
|
||||||
|
val integerQuery : kotlin.Int = 56 // kotlin.Int |
|
||||||
|
val booleanQuery : kotlin.Boolean = true // kotlin.Boolean |
|
||||||
|
val stringQuery : kotlin.String = stringQuery_example // kotlin.String |
|
||||||
|
try {
|
||||||
|
val result : kotlin.String = apiInstance.testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery)
|
||||||
|
println(result)
|
||||||
|
} catch (e: ClientException) {
|
||||||
|
println("4xx response calling QueryApi#testQueryIntegerBooleanString")
|
||||||
|
e.printStackTrace()
|
||||||
|
} catch (e: ServerException) {
|
||||||
|
println("5xx response calling QueryApi#testQueryIntegerBooleanString")
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
| **integerQuery** | **kotlin.Int**| | [optional] |
|
||||||
|
| **booleanQuery** | **kotlin.Boolean**| | [optional] |
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
| ------------- | ------------- | ------------- | ------------- |
|
||||||
|
| **stringQuery** | **kotlin.String**| | [optional] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**kotlin.String**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
||||||
|
<a id="testQueryStyleDeepObjectExplodeTrueObject"></a>
|
||||||
|
# **testQueryStyleDeepObjectExplodeTrueObject**
|
||||||
|
> kotlin.String testQueryStyleDeepObjectExplodeTrueObject(queryObject)
|
||||||
|
|
||||||
|
Test query parameter(s)
|
||||||
|
|
||||||
|
Test query parameter(s)
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiInstance = QueryApi()
|
||||||
|
val queryObject : ApiPet = // ApiPet |
|
||||||
|
try {
|
||||||
|
val result : kotlin.String = apiInstance.testQueryStyleDeepObjectExplodeTrueObject(queryObject)
|
||||||
|
println(result)
|
||||||
|
} catch (e: ClientException) {
|
||||||
|
println("4xx response calling QueryApi#testQueryStyleDeepObjectExplodeTrueObject")
|
||||||
|
e.printStackTrace()
|
||||||
|
} catch (e: ServerException) {
|
||||||
|
println("5xx response calling QueryApi#testQueryStyleDeepObjectExplodeTrueObject")
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
| ------------- | ------------- | ------------- | ------------- |
|
||||||
|
| **queryObject** | [**ApiPet**](.md)| | [optional] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**kotlin.String**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
||||||
|
<a id="testQueryStyleFormExplodeTrueArrayString"></a>
|
||||||
|
# **testQueryStyleFormExplodeTrueArrayString**
|
||||||
|
> kotlin.String testQueryStyleFormExplodeTrueArrayString(queryObject)
|
||||||
|
|
||||||
|
Test query parameter(s)
|
||||||
|
|
||||||
|
Test query parameter(s)
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiInstance = QueryApi()
|
||||||
|
val queryObject : ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter = // ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter |
|
||||||
|
try {
|
||||||
|
val result : kotlin.String = apiInstance.testQueryStyleFormExplodeTrueArrayString(queryObject)
|
||||||
|
println(result)
|
||||||
|
} catch (e: ClientException) {
|
||||||
|
println("4xx response calling QueryApi#testQueryStyleFormExplodeTrueArrayString")
|
||||||
|
e.printStackTrace()
|
||||||
|
} catch (e: ServerException) {
|
||||||
|
println("5xx response calling QueryApi#testQueryStyleFormExplodeTrueArrayString")
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
| ------------- | ------------- | ------------- | ------------- |
|
||||||
|
| **queryObject** | [**ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter**](.md)| | [optional] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**kotlin.String**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
||||||
|
<a id="testQueryStyleFormExplodeTrueObject"></a>
|
||||||
|
# **testQueryStyleFormExplodeTrueObject**
|
||||||
|
> kotlin.String testQueryStyleFormExplodeTrueObject(queryObject)
|
||||||
|
|
||||||
|
Test query parameter(s)
|
||||||
|
|
||||||
|
Test query parameter(s)
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiInstance = QueryApi()
|
||||||
|
val queryObject : ApiPet = // ApiPet |
|
||||||
|
try {
|
||||||
|
val result : kotlin.String = apiInstance.testQueryStyleFormExplodeTrueObject(queryObject)
|
||||||
|
println(result)
|
||||||
|
} catch (e: ClientException) {
|
||||||
|
println("4xx response calling QueryApi#testQueryStyleFormExplodeTrueObject")
|
||||||
|
e.printStackTrace()
|
||||||
|
} catch (e: ServerException) {
|
||||||
|
println("5xx response calling QueryApi#testQueryStyleFormExplodeTrueObject")
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
| ------------- | ------------- | ------------- | ------------- |
|
||||||
|
| **queryObject** | [**ApiPet**](.md)| | [optional] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**kotlin.String**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
# ApiStringEnumRef
|
||||||
|
|
||||||
|
## Enum
|
||||||
|
|
||||||
|
|
||||||
|
* `success` (value: `"success"`)
|
||||||
|
|
||||||
|
* `failure` (value: `"failure"`)
|
||||||
|
|
||||||
|
* `unclassified` (value: `"unclassified"`)
|
||||||
|
|
||||||
|
|
||||||
|
|
11
samples/client/echo_api/kotlin-jvm-okhttp/docs/Tag.md
Normal file
11
samples/client/echo_api/kotlin-jvm-okhttp/docs/Tag.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
# ApiTag
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
| ------------ | ------------- | ------------- | ------------- |
|
||||||
|
| **id** | **kotlin.Long** | | [optional] |
|
||||||
|
| **name** | **kotlin.String** | | [optional] |
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
# ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
| ------------ | ------------- | ------------- | ------------- |
|
||||||
|
| **propertyValues** | **kotlin.collections.List<kotlin.String>** | | [optional] |
|
||||||
|
|
||||||
|
|
||||||
|
|
BIN
samples/client/echo_api/kotlin-jvm-okhttp/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
samples/client/echo_api/kotlin-jvm-okhttp/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
7
samples/client/echo_api/kotlin-jvm-okhttp/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
7
samples/client/echo_api/kotlin-jvm-okhttp/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
249
samples/client/echo_api/kotlin-jvm-okhttp/gradlew
vendored
Normal file
249
samples/client/echo_api/kotlin-jvm-okhttp/gradlew
vendored
Normal file
@ -0,0 +1,249 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015-2021 the original authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
app_path=$0
|
||||||
|
|
||||||
|
# Need this for daisy-chained symlinks.
|
||||||
|
while
|
||||||
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
|
[ -h "$app_path" ]
|
||||||
|
do
|
||||||
|
ls=$( ls -ld "$app_path" )
|
||||||
|
link=${ls#*' -> '}
|
||||||
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# This is normally unused
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
|
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD=maximum
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "$( uname )" in #(
|
||||||
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
|
Darwin* ) darwin=true ;; #(
|
||||||
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
|
NONSTOP* ) nonstop=true ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
|
else
|
||||||
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD=java
|
||||||
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
|
case $MAX_FD in #(
|
||||||
|
max*)
|
||||||
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
|
warn "Could not query maximum file descriptor limit"
|
||||||
|
esac
|
||||||
|
case $MAX_FD in #(
|
||||||
|
'' | soft) :;; #(
|
||||||
|
*)
|
||||||
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
|
# * args from the command line
|
||||||
|
# * the main class name
|
||||||
|
# * -classpath
|
||||||
|
# * -D...appname settings
|
||||||
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Collect all arguments for the java command:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
89
samples/client/echo_api/kotlin-jvm-okhttp/gradlew.bat
vendored
Normal file
89
samples/client/echo_api/kotlin-jvm-okhttp/gradlew.bat
vendored
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
@ -0,0 +1 @@
|
|||||||
|
rootProject.name = 'kotlin-jvm-okhttp-echo-api'
|
@ -0,0 +1,186 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.apis
|
||||||
|
|
||||||
|
import java.io.IOException
|
||||||
|
import okhttp3.Call
|
||||||
|
import okhttp3.HttpUrl
|
||||||
|
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
|
||||||
|
import org.openapitools.client.infrastructure.ApiClient
|
||||||
|
import org.openapitools.client.infrastructure.ApiResponse
|
||||||
|
import org.openapitools.client.infrastructure.ClientException
|
||||||
|
import org.openapitools.client.infrastructure.ClientError
|
||||||
|
import org.openapitools.client.infrastructure.ServerException
|
||||||
|
import org.openapitools.client.infrastructure.ServerError
|
||||||
|
import org.openapitools.client.infrastructure.MultiValueMap
|
||||||
|
import org.openapitools.client.infrastructure.PartConfig
|
||||||
|
import org.openapitools.client.infrastructure.RequestConfig
|
||||||
|
import org.openapitools.client.infrastructure.RequestMethod
|
||||||
|
import org.openapitools.client.infrastructure.ResponseType
|
||||||
|
import org.openapitools.client.infrastructure.Success
|
||||||
|
import org.openapitools.client.infrastructure.toMultiValue
|
||||||
|
|
||||||
|
class AuthApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) {
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
val defaultBasePath: String by lazy {
|
||||||
|
System.getProperties().getProperty(ApiClient.baseUrlKey, "http://localhost:3000")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To test HTTP basic authentication
|
||||||
|
* To test HTTP basic authentication
|
||||||
|
* @return kotlin.String
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||||
|
* @throws ClientException If the API returns a client error response
|
||||||
|
* @throws ServerException If the API returns a server error response
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||||
|
fun testAuthHttpBasic() : kotlin.String {
|
||||||
|
val localVarResponse = testAuthHttpBasicWithHttpInfo()
|
||||||
|
|
||||||
|
return when (localVarResponse.responseType) {
|
||||||
|
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||||
|
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||||
|
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||||
|
ResponseType.ClientError -> {
|
||||||
|
val localVarError = localVarResponse as ClientError<*>
|
||||||
|
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
ResponseType.ServerError -> {
|
||||||
|
val localVarError = localVarResponse as ServerError<*>
|
||||||
|
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To test HTTP basic authentication
|
||||||
|
* To test HTTP basic authentication
|
||||||
|
* @return ApiResponse<kotlin.String?>
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class)
|
||||||
|
fun testAuthHttpBasicWithHttpInfo() : ApiResponse<kotlin.String?> {
|
||||||
|
val localVariableConfig = testAuthHttpBasicRequestConfig()
|
||||||
|
|
||||||
|
return request<Unit, kotlin.String>(
|
||||||
|
localVariableConfig
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To obtain the request config of the operation testAuthHttpBasic
|
||||||
|
*
|
||||||
|
* @return RequestConfig
|
||||||
|
*/
|
||||||
|
fun testAuthHttpBasicRequestConfig() : RequestConfig<Unit> {
|
||||||
|
val localVariableBody = null
|
||||||
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
localVariableHeaders["Accept"] = "text/plain"
|
||||||
|
|
||||||
|
return RequestConfig(
|
||||||
|
method = RequestMethod.POST,
|
||||||
|
path = "/auth/http/basic",
|
||||||
|
query = localVariableQuery,
|
||||||
|
headers = localVariableHeaders,
|
||||||
|
requiresAuthentication = true,
|
||||||
|
body = localVariableBody
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To test HTTP bearer authentication
|
||||||
|
* To test HTTP bearer authentication
|
||||||
|
* @return kotlin.String
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||||
|
* @throws ClientException If the API returns a client error response
|
||||||
|
* @throws ServerException If the API returns a server error response
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||||
|
fun testAuthHttpBearer() : kotlin.String {
|
||||||
|
val localVarResponse = testAuthHttpBearerWithHttpInfo()
|
||||||
|
|
||||||
|
return when (localVarResponse.responseType) {
|
||||||
|
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||||
|
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||||
|
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||||
|
ResponseType.ClientError -> {
|
||||||
|
val localVarError = localVarResponse as ClientError<*>
|
||||||
|
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
ResponseType.ServerError -> {
|
||||||
|
val localVarError = localVarResponse as ServerError<*>
|
||||||
|
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To test HTTP bearer authentication
|
||||||
|
* To test HTTP bearer authentication
|
||||||
|
* @return ApiResponse<kotlin.String?>
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class)
|
||||||
|
fun testAuthHttpBearerWithHttpInfo() : ApiResponse<kotlin.String?> {
|
||||||
|
val localVariableConfig = testAuthHttpBearerRequestConfig()
|
||||||
|
|
||||||
|
return request<Unit, kotlin.String>(
|
||||||
|
localVariableConfig
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To obtain the request config of the operation testAuthHttpBearer
|
||||||
|
*
|
||||||
|
* @return RequestConfig
|
||||||
|
*/
|
||||||
|
fun testAuthHttpBearerRequestConfig() : RequestConfig<Unit> {
|
||||||
|
val localVariableBody = null
|
||||||
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
localVariableHeaders["Accept"] = "text/plain"
|
||||||
|
|
||||||
|
return RequestConfig(
|
||||||
|
method = RequestMethod.POST,
|
||||||
|
path = "/auth/http/bearer",
|
||||||
|
query = localVariableQuery,
|
||||||
|
headers = localVariableHeaders,
|
||||||
|
requiresAuthentication = true,
|
||||||
|
body = localVariableBody
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
|
||||||
|
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
|
||||||
|
}
|
@ -0,0 +1,623 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.apis
|
||||||
|
|
||||||
|
import java.io.IOException
|
||||||
|
import okhttp3.Call
|
||||||
|
import okhttp3.HttpUrl
|
||||||
|
|
||||||
|
import org.openapitools.client.models.ApiPet
|
||||||
|
import org.openapitools.client.models.ApiTag
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
|
||||||
|
import org.openapitools.client.infrastructure.ApiClient
|
||||||
|
import org.openapitools.client.infrastructure.ApiResponse
|
||||||
|
import org.openapitools.client.infrastructure.ClientException
|
||||||
|
import org.openapitools.client.infrastructure.ClientError
|
||||||
|
import org.openapitools.client.infrastructure.ServerException
|
||||||
|
import org.openapitools.client.infrastructure.ServerError
|
||||||
|
import org.openapitools.client.infrastructure.MultiValueMap
|
||||||
|
import org.openapitools.client.infrastructure.PartConfig
|
||||||
|
import org.openapitools.client.infrastructure.RequestConfig
|
||||||
|
import org.openapitools.client.infrastructure.RequestMethod
|
||||||
|
import org.openapitools.client.infrastructure.ResponseType
|
||||||
|
import org.openapitools.client.infrastructure.Success
|
||||||
|
import org.openapitools.client.infrastructure.toMultiValue
|
||||||
|
|
||||||
|
class BodyApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) {
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
val defaultBasePath: String by lazy {
|
||||||
|
System.getProperties().getProperty(ApiClient.baseUrlKey, "http://localhost:3000")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test binary (gif) response body
|
||||||
|
* Test binary (gif) response body
|
||||||
|
* @return java.io.File
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||||
|
* @throws ClientException If the API returns a client error response
|
||||||
|
* @throws ServerException If the API returns a server error response
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||||
|
fun testBinaryGif() : java.io.File {
|
||||||
|
val localVarResponse = testBinaryGifWithHttpInfo()
|
||||||
|
|
||||||
|
return when (localVarResponse.responseType) {
|
||||||
|
ResponseType.Success -> (localVarResponse as Success<*>).data as java.io.File
|
||||||
|
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||||
|
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||||
|
ResponseType.ClientError -> {
|
||||||
|
val localVarError = localVarResponse as ClientError<*>
|
||||||
|
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
ResponseType.ServerError -> {
|
||||||
|
val localVarError = localVarResponse as ServerError<*>
|
||||||
|
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test binary (gif) response body
|
||||||
|
* Test binary (gif) response body
|
||||||
|
* @return ApiResponse<java.io.File?>
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class)
|
||||||
|
fun testBinaryGifWithHttpInfo() : ApiResponse<java.io.File?> {
|
||||||
|
val localVariableConfig = testBinaryGifRequestConfig()
|
||||||
|
|
||||||
|
return request<Unit, java.io.File>(
|
||||||
|
localVariableConfig
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To obtain the request config of the operation testBinaryGif
|
||||||
|
*
|
||||||
|
* @return RequestConfig
|
||||||
|
*/
|
||||||
|
fun testBinaryGifRequestConfig() : RequestConfig<Unit> {
|
||||||
|
val localVariableBody = null
|
||||||
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
||||||
|
return RequestConfig(
|
||||||
|
method = RequestMethod.POST,
|
||||||
|
path = "/binary/gif",
|
||||||
|
query = localVariableQuery,
|
||||||
|
headers = localVariableHeaders,
|
||||||
|
requiresAuthentication = false,
|
||||||
|
body = localVariableBody
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test body parameter(s)
|
||||||
|
* Test body parameter(s)
|
||||||
|
* @param body (optional)
|
||||||
|
* @return kotlin.String
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||||
|
* @throws ClientException If the API returns a client error response
|
||||||
|
* @throws ServerException If the API returns a server error response
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||||
|
fun testBodyApplicationOctetstreamBinary(body: java.io.File? = null) : kotlin.String {
|
||||||
|
val localVarResponse = testBodyApplicationOctetstreamBinaryWithHttpInfo(body = body)
|
||||||
|
|
||||||
|
return when (localVarResponse.responseType) {
|
||||||
|
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||||
|
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||||
|
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||||
|
ResponseType.ClientError -> {
|
||||||
|
val localVarError = localVarResponse as ClientError<*>
|
||||||
|
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
ResponseType.ServerError -> {
|
||||||
|
val localVarError = localVarResponse as ServerError<*>
|
||||||
|
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test body parameter(s)
|
||||||
|
* Test body parameter(s)
|
||||||
|
* @param body (optional)
|
||||||
|
* @return ApiResponse<kotlin.String?>
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class)
|
||||||
|
fun testBodyApplicationOctetstreamBinaryWithHttpInfo(body: java.io.File?) : ApiResponse<kotlin.String?> {
|
||||||
|
val localVariableConfig = testBodyApplicationOctetstreamBinaryRequestConfig(body = body)
|
||||||
|
|
||||||
|
return request<java.io.File, kotlin.String>(
|
||||||
|
localVariableConfig
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To obtain the request config of the operation testBodyApplicationOctetstreamBinary
|
||||||
|
*
|
||||||
|
* @param body (optional)
|
||||||
|
* @return RequestConfig
|
||||||
|
*/
|
||||||
|
fun testBodyApplicationOctetstreamBinaryRequestConfig(body: java.io.File?) : RequestConfig<java.io.File> {
|
||||||
|
val localVariableBody = body
|
||||||
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
localVariableHeaders["Content-Type"] = "application/octet-stream"
|
||||||
|
localVariableHeaders["Accept"] = "text/plain"
|
||||||
|
|
||||||
|
return RequestConfig(
|
||||||
|
method = RequestMethod.POST,
|
||||||
|
path = "/body/application/octetstream/binary",
|
||||||
|
query = localVariableQuery,
|
||||||
|
headers = localVariableHeaders,
|
||||||
|
requiresAuthentication = false,
|
||||||
|
body = localVariableBody
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test array of binary in multipart mime
|
||||||
|
* Test array of binary in multipart mime
|
||||||
|
* @param files
|
||||||
|
* @return kotlin.String
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||||
|
* @throws ClientException If the API returns a client error response
|
||||||
|
* @throws ServerException If the API returns a server error response
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||||
|
fun testBodyMultipartFormdataArrayOfBinary(files: kotlin.collections.List<java.io.File>) : kotlin.String {
|
||||||
|
val localVarResponse = testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files = files)
|
||||||
|
|
||||||
|
return when (localVarResponse.responseType) {
|
||||||
|
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||||
|
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||||
|
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||||
|
ResponseType.ClientError -> {
|
||||||
|
val localVarError = localVarResponse as ClientError<*>
|
||||||
|
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
ResponseType.ServerError -> {
|
||||||
|
val localVarError = localVarResponse as ServerError<*>
|
||||||
|
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test array of binary in multipart mime
|
||||||
|
* Test array of binary in multipart mime
|
||||||
|
* @param files
|
||||||
|
* @return ApiResponse<kotlin.String?>
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class)
|
||||||
|
fun testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files: kotlin.collections.List<java.io.File>) : ApiResponse<kotlin.String?> {
|
||||||
|
val localVariableConfig = testBodyMultipartFormdataArrayOfBinaryRequestConfig(files = files)
|
||||||
|
|
||||||
|
return request<Map<String, PartConfig<*>>, kotlin.String>(
|
||||||
|
localVariableConfig
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To obtain the request config of the operation testBodyMultipartFormdataArrayOfBinary
|
||||||
|
*
|
||||||
|
* @param files
|
||||||
|
* @return RequestConfig
|
||||||
|
*/
|
||||||
|
fun testBodyMultipartFormdataArrayOfBinaryRequestConfig(files: kotlin.collections.List<java.io.File>) : RequestConfig<Map<String, PartConfig<*>>> {
|
||||||
|
val localVariableBody = mapOf(
|
||||||
|
"files" to PartConfig(body = files, headers = mutableMapOf()),)
|
||||||
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
|
||||||
|
localVariableHeaders["Accept"] = "text/plain"
|
||||||
|
|
||||||
|
return RequestConfig(
|
||||||
|
method = RequestMethod.POST,
|
||||||
|
path = "/body/application/octetstream/array_of_binary",
|
||||||
|
query = localVariableQuery,
|
||||||
|
headers = localVariableHeaders,
|
||||||
|
requiresAuthentication = false,
|
||||||
|
body = localVariableBody
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test single binary in multipart mime
|
||||||
|
* Test single binary in multipart mime
|
||||||
|
* @param myFile (optional)
|
||||||
|
* @return kotlin.String
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||||
|
* @throws ClientException If the API returns a client error response
|
||||||
|
* @throws ServerException If the API returns a server error response
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||||
|
fun testBodyMultipartFormdataSingleBinary(myFile: java.io.File? = null) : kotlin.String {
|
||||||
|
val localVarResponse = testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile = myFile)
|
||||||
|
|
||||||
|
return when (localVarResponse.responseType) {
|
||||||
|
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||||
|
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||||
|
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||||
|
ResponseType.ClientError -> {
|
||||||
|
val localVarError = localVarResponse as ClientError<*>
|
||||||
|
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
ResponseType.ServerError -> {
|
||||||
|
val localVarError = localVarResponse as ServerError<*>
|
||||||
|
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test single binary in multipart mime
|
||||||
|
* Test single binary in multipart mime
|
||||||
|
* @param myFile (optional)
|
||||||
|
* @return ApiResponse<kotlin.String?>
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class)
|
||||||
|
fun testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile: java.io.File?) : ApiResponse<kotlin.String?> {
|
||||||
|
val localVariableConfig = testBodyMultipartFormdataSingleBinaryRequestConfig(myFile = myFile)
|
||||||
|
|
||||||
|
return request<Map<String, PartConfig<*>>, kotlin.String>(
|
||||||
|
localVariableConfig
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To obtain the request config of the operation testBodyMultipartFormdataSingleBinary
|
||||||
|
*
|
||||||
|
* @param myFile (optional)
|
||||||
|
* @return RequestConfig
|
||||||
|
*/
|
||||||
|
fun testBodyMultipartFormdataSingleBinaryRequestConfig(myFile: java.io.File?) : RequestConfig<Map<String, PartConfig<*>>> {
|
||||||
|
val localVariableBody = mapOf(
|
||||||
|
"my-file" to PartConfig(body = myFile, headers = mutableMapOf()),)
|
||||||
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
|
||||||
|
localVariableHeaders["Accept"] = "text/plain"
|
||||||
|
|
||||||
|
return RequestConfig(
|
||||||
|
method = RequestMethod.POST,
|
||||||
|
path = "/body/application/octetstream/single_binary",
|
||||||
|
query = localVariableQuery,
|
||||||
|
headers = localVariableHeaders,
|
||||||
|
requiresAuthentication = false,
|
||||||
|
body = localVariableBody
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test free form object
|
||||||
|
* Test free form object
|
||||||
|
* @param body Free form object (optional)
|
||||||
|
* @return kotlin.String
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||||
|
* @throws ClientException If the API returns a client error response
|
||||||
|
* @throws ServerException If the API returns a server error response
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||||
|
fun testEchoBodyFreeFormObjectResponseString(body: kotlin.Any? = null) : kotlin.String {
|
||||||
|
val localVarResponse = testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body = body)
|
||||||
|
|
||||||
|
return when (localVarResponse.responseType) {
|
||||||
|
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||||
|
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||||
|
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||||
|
ResponseType.ClientError -> {
|
||||||
|
val localVarError = localVarResponse as ClientError<*>
|
||||||
|
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
ResponseType.ServerError -> {
|
||||||
|
val localVarError = localVarResponse as ServerError<*>
|
||||||
|
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test free form object
|
||||||
|
* Test free form object
|
||||||
|
* @param body Free form object (optional)
|
||||||
|
* @return ApiResponse<kotlin.String?>
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class)
|
||||||
|
fun testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body: kotlin.Any?) : ApiResponse<kotlin.String?> {
|
||||||
|
val localVariableConfig = testEchoBodyFreeFormObjectResponseStringRequestConfig(body = body)
|
||||||
|
|
||||||
|
return request<kotlin.Any, kotlin.String>(
|
||||||
|
localVariableConfig
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To obtain the request config of the operation testEchoBodyFreeFormObjectResponseString
|
||||||
|
*
|
||||||
|
* @param body Free form object (optional)
|
||||||
|
* @return RequestConfig
|
||||||
|
*/
|
||||||
|
fun testEchoBodyFreeFormObjectResponseStringRequestConfig(body: kotlin.Any?) : RequestConfig<kotlin.Any> {
|
||||||
|
val localVariableBody = body
|
||||||
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
localVariableHeaders["Content-Type"] = "application/json"
|
||||||
|
localVariableHeaders["Accept"] = "text/plain"
|
||||||
|
|
||||||
|
return RequestConfig(
|
||||||
|
method = RequestMethod.POST,
|
||||||
|
path = "/echo/body/FreeFormObject/response_string",
|
||||||
|
query = localVariableQuery,
|
||||||
|
headers = localVariableHeaders,
|
||||||
|
requiresAuthentication = false,
|
||||||
|
body = localVariableBody
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test body parameter(s)
|
||||||
|
* Test body parameter(s)
|
||||||
|
* @param apiPet Pet object that needs to be added to the store (optional)
|
||||||
|
* @return ApiPet
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||||
|
* @throws ClientException If the API returns a client error response
|
||||||
|
* @throws ServerException If the API returns a server error response
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||||
|
fun testEchoBodyPet(apiPet: ApiPet? = null) : ApiPet {
|
||||||
|
val localVarResponse = testEchoBodyPetWithHttpInfo(apiPet = apiPet)
|
||||||
|
|
||||||
|
return when (localVarResponse.responseType) {
|
||||||
|
ResponseType.Success -> (localVarResponse as Success<*>).data as ApiPet
|
||||||
|
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||||
|
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||||
|
ResponseType.ClientError -> {
|
||||||
|
val localVarError = localVarResponse as ClientError<*>
|
||||||
|
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
ResponseType.ServerError -> {
|
||||||
|
val localVarError = localVarResponse as ServerError<*>
|
||||||
|
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test body parameter(s)
|
||||||
|
* Test body parameter(s)
|
||||||
|
* @param apiPet Pet object that needs to be added to the store (optional)
|
||||||
|
* @return ApiResponse<ApiPet?>
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class)
|
||||||
|
fun testEchoBodyPetWithHttpInfo(apiPet: ApiPet?) : ApiResponse<ApiPet?> {
|
||||||
|
val localVariableConfig = testEchoBodyPetRequestConfig(apiPet = apiPet)
|
||||||
|
|
||||||
|
return request<ApiPet, ApiPet>(
|
||||||
|
localVariableConfig
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To obtain the request config of the operation testEchoBodyPet
|
||||||
|
*
|
||||||
|
* @param apiPet Pet object that needs to be added to the store (optional)
|
||||||
|
* @return RequestConfig
|
||||||
|
*/
|
||||||
|
fun testEchoBodyPetRequestConfig(apiPet: ApiPet?) : RequestConfig<ApiPet> {
|
||||||
|
val localVariableBody = apiPet
|
||||||
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
localVariableHeaders["Content-Type"] = "application/json"
|
||||||
|
localVariableHeaders["Accept"] = "application/json"
|
||||||
|
|
||||||
|
return RequestConfig(
|
||||||
|
method = RequestMethod.POST,
|
||||||
|
path = "/echo/body/Pet",
|
||||||
|
query = localVariableQuery,
|
||||||
|
headers = localVariableHeaders,
|
||||||
|
requiresAuthentication = false,
|
||||||
|
body = localVariableBody
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test empty response body
|
||||||
|
* Test empty response body
|
||||||
|
* @param apiPet Pet object that needs to be added to the store (optional)
|
||||||
|
* @return kotlin.String
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||||
|
* @throws ClientException If the API returns a client error response
|
||||||
|
* @throws ServerException If the API returns a server error response
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||||
|
fun testEchoBodyPetResponseString(apiPet: ApiPet? = null) : kotlin.String {
|
||||||
|
val localVarResponse = testEchoBodyPetResponseStringWithHttpInfo(apiPet = apiPet)
|
||||||
|
|
||||||
|
return when (localVarResponse.responseType) {
|
||||||
|
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||||
|
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||||
|
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||||
|
ResponseType.ClientError -> {
|
||||||
|
val localVarError = localVarResponse as ClientError<*>
|
||||||
|
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
ResponseType.ServerError -> {
|
||||||
|
val localVarError = localVarResponse as ServerError<*>
|
||||||
|
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test empty response body
|
||||||
|
* Test empty response body
|
||||||
|
* @param apiPet Pet object that needs to be added to the store (optional)
|
||||||
|
* @return ApiResponse<kotlin.String?>
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class)
|
||||||
|
fun testEchoBodyPetResponseStringWithHttpInfo(apiPet: ApiPet?) : ApiResponse<kotlin.String?> {
|
||||||
|
val localVariableConfig = testEchoBodyPetResponseStringRequestConfig(apiPet = apiPet)
|
||||||
|
|
||||||
|
return request<ApiPet, kotlin.String>(
|
||||||
|
localVariableConfig
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To obtain the request config of the operation testEchoBodyPetResponseString
|
||||||
|
*
|
||||||
|
* @param apiPet Pet object that needs to be added to the store (optional)
|
||||||
|
* @return RequestConfig
|
||||||
|
*/
|
||||||
|
fun testEchoBodyPetResponseStringRequestConfig(apiPet: ApiPet?) : RequestConfig<ApiPet> {
|
||||||
|
val localVariableBody = apiPet
|
||||||
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
localVariableHeaders["Content-Type"] = "application/json"
|
||||||
|
localVariableHeaders["Accept"] = "text/plain"
|
||||||
|
|
||||||
|
return RequestConfig(
|
||||||
|
method = RequestMethod.POST,
|
||||||
|
path = "/echo/body/Pet/response_string",
|
||||||
|
query = localVariableQuery,
|
||||||
|
headers = localVariableHeaders,
|
||||||
|
requiresAuthentication = false,
|
||||||
|
body = localVariableBody
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test empty json (request body)
|
||||||
|
* Test empty json (request body)
|
||||||
|
* @param apiTag Tag object (optional)
|
||||||
|
* @return kotlin.String
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||||
|
* @throws ClientException If the API returns a client error response
|
||||||
|
* @throws ServerException If the API returns a server error response
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||||
|
fun testEchoBodyTagResponseString(apiTag: ApiTag? = null) : kotlin.String {
|
||||||
|
val localVarResponse = testEchoBodyTagResponseStringWithHttpInfo(apiTag = apiTag)
|
||||||
|
|
||||||
|
return when (localVarResponse.responseType) {
|
||||||
|
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||||
|
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||||
|
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||||
|
ResponseType.ClientError -> {
|
||||||
|
val localVarError = localVarResponse as ClientError<*>
|
||||||
|
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
ResponseType.ServerError -> {
|
||||||
|
val localVarError = localVarResponse as ServerError<*>
|
||||||
|
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test empty json (request body)
|
||||||
|
* Test empty json (request body)
|
||||||
|
* @param apiTag Tag object (optional)
|
||||||
|
* @return ApiResponse<kotlin.String?>
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class)
|
||||||
|
fun testEchoBodyTagResponseStringWithHttpInfo(apiTag: ApiTag?) : ApiResponse<kotlin.String?> {
|
||||||
|
val localVariableConfig = testEchoBodyTagResponseStringRequestConfig(apiTag = apiTag)
|
||||||
|
|
||||||
|
return request<ApiTag, kotlin.String>(
|
||||||
|
localVariableConfig
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To obtain the request config of the operation testEchoBodyTagResponseString
|
||||||
|
*
|
||||||
|
* @param apiTag Tag object (optional)
|
||||||
|
* @return RequestConfig
|
||||||
|
*/
|
||||||
|
fun testEchoBodyTagResponseStringRequestConfig(apiTag: ApiTag?) : RequestConfig<ApiTag> {
|
||||||
|
val localVariableBody = apiTag
|
||||||
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
localVariableHeaders["Content-Type"] = "application/json"
|
||||||
|
localVariableHeaders["Accept"] = "text/plain"
|
||||||
|
|
||||||
|
return RequestConfig(
|
||||||
|
method = RequestMethod.POST,
|
||||||
|
path = "/echo/body/Tag/response_string",
|
||||||
|
query = localVariableQuery,
|
||||||
|
headers = localVariableHeaders,
|
||||||
|
requiresAuthentication = false,
|
||||||
|
body = localVariableBody
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
|
||||||
|
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
|
||||||
|
}
|
@ -0,0 +1,222 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.apis
|
||||||
|
|
||||||
|
import java.io.IOException
|
||||||
|
import okhttp3.Call
|
||||||
|
import okhttp3.HttpUrl
|
||||||
|
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
|
||||||
|
import org.openapitools.client.infrastructure.ApiClient
|
||||||
|
import org.openapitools.client.infrastructure.ApiResponse
|
||||||
|
import org.openapitools.client.infrastructure.ClientException
|
||||||
|
import org.openapitools.client.infrastructure.ClientError
|
||||||
|
import org.openapitools.client.infrastructure.ServerException
|
||||||
|
import org.openapitools.client.infrastructure.ServerError
|
||||||
|
import org.openapitools.client.infrastructure.MultiValueMap
|
||||||
|
import org.openapitools.client.infrastructure.PartConfig
|
||||||
|
import org.openapitools.client.infrastructure.RequestConfig
|
||||||
|
import org.openapitools.client.infrastructure.RequestMethod
|
||||||
|
import org.openapitools.client.infrastructure.ResponseType
|
||||||
|
import org.openapitools.client.infrastructure.Success
|
||||||
|
import org.openapitools.client.infrastructure.toMultiValue
|
||||||
|
|
||||||
|
class FormApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) {
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
val defaultBasePath: String by lazy {
|
||||||
|
System.getProperties().getProperty(ApiClient.baseUrlKey, "http://localhost:3000")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test form parameter(s)
|
||||||
|
* Test form parameter(s)
|
||||||
|
* @param integerForm (optional)
|
||||||
|
* @param booleanForm (optional)
|
||||||
|
* @param stringForm (optional)
|
||||||
|
* @return kotlin.String
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||||
|
* @throws ClientException If the API returns a client error response
|
||||||
|
* @throws ServerException If the API returns a server error response
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||||
|
fun testFormIntegerBooleanString(integerForm: kotlin.Int? = null, booleanForm: kotlin.Boolean? = null, stringForm: kotlin.String? = null) : kotlin.String {
|
||||||
|
val localVarResponse = testFormIntegerBooleanStringWithHttpInfo(integerForm = integerForm, booleanForm = booleanForm, stringForm = stringForm)
|
||||||
|
|
||||||
|
return when (localVarResponse.responseType) {
|
||||||
|
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||||
|
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||||
|
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||||
|
ResponseType.ClientError -> {
|
||||||
|
val localVarError = localVarResponse as ClientError<*>
|
||||||
|
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
ResponseType.ServerError -> {
|
||||||
|
val localVarError = localVarResponse as ServerError<*>
|
||||||
|
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test form parameter(s)
|
||||||
|
* Test form parameter(s)
|
||||||
|
* @param integerForm (optional)
|
||||||
|
* @param booleanForm (optional)
|
||||||
|
* @param stringForm (optional)
|
||||||
|
* @return ApiResponse<kotlin.String?>
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class)
|
||||||
|
fun testFormIntegerBooleanStringWithHttpInfo(integerForm: kotlin.Int?, booleanForm: kotlin.Boolean?, stringForm: kotlin.String?) : ApiResponse<kotlin.String?> {
|
||||||
|
val localVariableConfig = testFormIntegerBooleanStringRequestConfig(integerForm = integerForm, booleanForm = booleanForm, stringForm = stringForm)
|
||||||
|
|
||||||
|
return request<Map<String, PartConfig<*>>, kotlin.String>(
|
||||||
|
localVariableConfig
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To obtain the request config of the operation testFormIntegerBooleanString
|
||||||
|
*
|
||||||
|
* @param integerForm (optional)
|
||||||
|
* @param booleanForm (optional)
|
||||||
|
* @param stringForm (optional)
|
||||||
|
* @return RequestConfig
|
||||||
|
*/
|
||||||
|
fun testFormIntegerBooleanStringRequestConfig(integerForm: kotlin.Int?, booleanForm: kotlin.Boolean?, stringForm: kotlin.String?) : RequestConfig<Map<String, PartConfig<*>>> {
|
||||||
|
val localVariableBody = mapOf(
|
||||||
|
"integer_form" to PartConfig(body = integerForm, headers = mutableMapOf()),
|
||||||
|
"boolean_form" to PartConfig(body = booleanForm, headers = mutableMapOf()),
|
||||||
|
"string_form" to PartConfig(body = stringForm, headers = mutableMapOf()),)
|
||||||
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
|
||||||
|
localVariableHeaders["Accept"] = "text/plain"
|
||||||
|
|
||||||
|
return RequestConfig(
|
||||||
|
method = RequestMethod.POST,
|
||||||
|
path = "/form/integer/boolean/string",
|
||||||
|
query = localVariableQuery,
|
||||||
|
headers = localVariableHeaders,
|
||||||
|
requiresAuthentication = false,
|
||||||
|
body = localVariableBody
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test form parameter(s) for oneOf schema
|
||||||
|
* Test form parameter(s) for oneOf schema
|
||||||
|
* @param form1 (optional)
|
||||||
|
* @param form2 (optional)
|
||||||
|
* @param form3 (optional)
|
||||||
|
* @param form4 (optional)
|
||||||
|
* @param id (optional)
|
||||||
|
* @param name (optional)
|
||||||
|
* @return kotlin.String
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||||
|
* @throws ClientException If the API returns a client error response
|
||||||
|
* @throws ServerException If the API returns a server error response
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||||
|
fun testFormOneof(form1: kotlin.String? = null, form2: kotlin.Int? = null, form3: kotlin.String? = null, form4: kotlin.Boolean? = null, id: kotlin.Long? = null, name: kotlin.String? = null) : kotlin.String {
|
||||||
|
val localVarResponse = testFormOneofWithHttpInfo(form1 = form1, form2 = form2, form3 = form3, form4 = form4, id = id, name = name)
|
||||||
|
|
||||||
|
return when (localVarResponse.responseType) {
|
||||||
|
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||||
|
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||||
|
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||||
|
ResponseType.ClientError -> {
|
||||||
|
val localVarError = localVarResponse as ClientError<*>
|
||||||
|
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
ResponseType.ServerError -> {
|
||||||
|
val localVarError = localVarResponse as ServerError<*>
|
||||||
|
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test form parameter(s) for oneOf schema
|
||||||
|
* Test form parameter(s) for oneOf schema
|
||||||
|
* @param form1 (optional)
|
||||||
|
* @param form2 (optional)
|
||||||
|
* @param form3 (optional)
|
||||||
|
* @param form4 (optional)
|
||||||
|
* @param id (optional)
|
||||||
|
* @param name (optional)
|
||||||
|
* @return ApiResponse<kotlin.String?>
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class)
|
||||||
|
fun testFormOneofWithHttpInfo(form1: kotlin.String?, form2: kotlin.Int?, form3: kotlin.String?, form4: kotlin.Boolean?, id: kotlin.Long?, name: kotlin.String?) : ApiResponse<kotlin.String?> {
|
||||||
|
val localVariableConfig = testFormOneofRequestConfig(form1 = form1, form2 = form2, form3 = form3, form4 = form4, id = id, name = name)
|
||||||
|
|
||||||
|
return request<Map<String, PartConfig<*>>, kotlin.String>(
|
||||||
|
localVariableConfig
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To obtain the request config of the operation testFormOneof
|
||||||
|
*
|
||||||
|
* @param form1 (optional)
|
||||||
|
* @param form2 (optional)
|
||||||
|
* @param form3 (optional)
|
||||||
|
* @param form4 (optional)
|
||||||
|
* @param id (optional)
|
||||||
|
* @param name (optional)
|
||||||
|
* @return RequestConfig
|
||||||
|
*/
|
||||||
|
fun testFormOneofRequestConfig(form1: kotlin.String?, form2: kotlin.Int?, form3: kotlin.String?, form4: kotlin.Boolean?, id: kotlin.Long?, name: kotlin.String?) : RequestConfig<Map<String, PartConfig<*>>> {
|
||||||
|
val localVariableBody = mapOf(
|
||||||
|
"form1" to PartConfig(body = form1, headers = mutableMapOf()),
|
||||||
|
"form2" to PartConfig(body = form2, headers = mutableMapOf()),
|
||||||
|
"form3" to PartConfig(body = form3, headers = mutableMapOf()),
|
||||||
|
"form4" to PartConfig(body = form4, headers = mutableMapOf()),
|
||||||
|
"id" to PartConfig(body = id, headers = mutableMapOf()),
|
||||||
|
"name" to PartConfig(body = name, headers = mutableMapOf()),)
|
||||||
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
|
||||||
|
localVariableHeaders["Accept"] = "text/plain"
|
||||||
|
|
||||||
|
return RequestConfig(
|
||||||
|
method = RequestMethod.POST,
|
||||||
|
path = "/form/oneof",
|
||||||
|
query = localVariableQuery,
|
||||||
|
headers = localVariableHeaders,
|
||||||
|
requiresAuthentication = false,
|
||||||
|
body = localVariableBody
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
|
||||||
|
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
|
||||||
|
}
|
@ -0,0 +1,157 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.apis
|
||||||
|
|
||||||
|
import java.io.IOException
|
||||||
|
import okhttp3.Call
|
||||||
|
import okhttp3.HttpUrl
|
||||||
|
|
||||||
|
import org.openapitools.client.models.ApiStringEnumRef
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
|
||||||
|
import org.openapitools.client.infrastructure.ApiClient
|
||||||
|
import org.openapitools.client.infrastructure.ApiResponse
|
||||||
|
import org.openapitools.client.infrastructure.ClientException
|
||||||
|
import org.openapitools.client.infrastructure.ClientError
|
||||||
|
import org.openapitools.client.infrastructure.ServerException
|
||||||
|
import org.openapitools.client.infrastructure.ServerError
|
||||||
|
import org.openapitools.client.infrastructure.MultiValueMap
|
||||||
|
import org.openapitools.client.infrastructure.PartConfig
|
||||||
|
import org.openapitools.client.infrastructure.RequestConfig
|
||||||
|
import org.openapitools.client.infrastructure.RequestMethod
|
||||||
|
import org.openapitools.client.infrastructure.ResponseType
|
||||||
|
import org.openapitools.client.infrastructure.Success
|
||||||
|
import org.openapitools.client.infrastructure.toMultiValue
|
||||||
|
|
||||||
|
class HeaderApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) {
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
val defaultBasePath: String by lazy {
|
||||||
|
System.getProperties().getProperty(ApiClient.baseUrlKey, "http://localhost:3000")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* enum for parameter enumNonrefStringHeader
|
||||||
|
*/
|
||||||
|
enum class EnumNonrefStringHeaderTestHeaderIntegerBooleanStringEnums(val value: kotlin.String) {
|
||||||
|
@Json(name = "success") success("success"),
|
||||||
|
@Json(name = "failure") failure("failure"),
|
||||||
|
@Json(name = "unclassified") unclassified("unclassified");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override [toString()] to avoid using the enum variable name as the value, and instead use
|
||||||
|
* the actual value defined in the API spec file.
|
||||||
|
*
|
||||||
|
* This solves a problem when the variable name and its value are different, and ensures that
|
||||||
|
* the client sends the correct enum values to the server always.
|
||||||
|
*/
|
||||||
|
override fun toString(): kotlin.String = "$value"
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test header parameter(s)
|
||||||
|
* Test header parameter(s)
|
||||||
|
* @param integerHeader (optional)
|
||||||
|
* @param booleanHeader (optional)
|
||||||
|
* @param stringHeader (optional)
|
||||||
|
* @param enumNonrefStringHeader (optional)
|
||||||
|
* @param enumRefStringHeader (optional)
|
||||||
|
* @return kotlin.String
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||||
|
* @throws ClientException If the API returns a client error response
|
||||||
|
* @throws ServerException If the API returns a server error response
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||||
|
fun testHeaderIntegerBooleanStringEnums(integerHeader: kotlin.Int? = null, booleanHeader: kotlin.Boolean? = null, stringHeader: kotlin.String? = null, enumNonrefStringHeader: EnumNonrefStringHeaderTestHeaderIntegerBooleanStringEnums? = null, enumRefStringHeader: ApiStringEnumRef? = null) : kotlin.String {
|
||||||
|
val localVarResponse = testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader = integerHeader, booleanHeader = booleanHeader, stringHeader = stringHeader, enumNonrefStringHeader = enumNonrefStringHeader, enumRefStringHeader = enumRefStringHeader)
|
||||||
|
|
||||||
|
return when (localVarResponse.responseType) {
|
||||||
|
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||||
|
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||||
|
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||||
|
ResponseType.ClientError -> {
|
||||||
|
val localVarError = localVarResponse as ClientError<*>
|
||||||
|
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
ResponseType.ServerError -> {
|
||||||
|
val localVarError = localVarResponse as ServerError<*>
|
||||||
|
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test header parameter(s)
|
||||||
|
* Test header parameter(s)
|
||||||
|
* @param integerHeader (optional)
|
||||||
|
* @param booleanHeader (optional)
|
||||||
|
* @param stringHeader (optional)
|
||||||
|
* @param enumNonrefStringHeader (optional)
|
||||||
|
* @param enumRefStringHeader (optional)
|
||||||
|
* @return ApiResponse<kotlin.String?>
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class)
|
||||||
|
fun testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader: kotlin.Int?, booleanHeader: kotlin.Boolean?, stringHeader: kotlin.String?, enumNonrefStringHeader: EnumNonrefStringHeaderTestHeaderIntegerBooleanStringEnums?, enumRefStringHeader: ApiStringEnumRef?) : ApiResponse<kotlin.String?> {
|
||||||
|
val localVariableConfig = testHeaderIntegerBooleanStringEnumsRequestConfig(integerHeader = integerHeader, booleanHeader = booleanHeader, stringHeader = stringHeader, enumNonrefStringHeader = enumNonrefStringHeader, enumRefStringHeader = enumRefStringHeader)
|
||||||
|
|
||||||
|
return request<Unit, kotlin.String>(
|
||||||
|
localVariableConfig
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To obtain the request config of the operation testHeaderIntegerBooleanStringEnums
|
||||||
|
*
|
||||||
|
* @param integerHeader (optional)
|
||||||
|
* @param booleanHeader (optional)
|
||||||
|
* @param stringHeader (optional)
|
||||||
|
* @param enumNonrefStringHeader (optional)
|
||||||
|
* @param enumRefStringHeader (optional)
|
||||||
|
* @return RequestConfig
|
||||||
|
*/
|
||||||
|
fun testHeaderIntegerBooleanStringEnumsRequestConfig(integerHeader: kotlin.Int?, booleanHeader: kotlin.Boolean?, stringHeader: kotlin.String?, enumNonrefStringHeader: EnumNonrefStringHeaderTestHeaderIntegerBooleanStringEnums?, enumRefStringHeader: ApiStringEnumRef?) : RequestConfig<Unit> {
|
||||||
|
val localVariableBody = null
|
||||||
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
integerHeader?.apply { localVariableHeaders["integer_header"] = this.toString() }
|
||||||
|
booleanHeader?.apply { localVariableHeaders["boolean_header"] = this.toString() }
|
||||||
|
stringHeader?.apply { localVariableHeaders["string_header"] = this.toString() }
|
||||||
|
enumNonrefStringHeader?.apply { localVariableHeaders["enum_nonref_string_header"] = this.toString() }
|
||||||
|
enumRefStringHeader?.apply { localVariableHeaders["enum_ref_string_header"] = this.toString() }
|
||||||
|
localVariableHeaders["Accept"] = "text/plain"
|
||||||
|
|
||||||
|
return RequestConfig(
|
||||||
|
method = RequestMethod.GET,
|
||||||
|
path = "/header/integer/boolean/string/enums",
|
||||||
|
query = localVariableQuery,
|
||||||
|
headers = localVariableHeaders,
|
||||||
|
requiresAuthentication = false,
|
||||||
|
body = localVariableBody
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
|
||||||
|
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
|
||||||
|
}
|
@ -0,0 +1,149 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.apis
|
||||||
|
|
||||||
|
import java.io.IOException
|
||||||
|
import okhttp3.Call
|
||||||
|
import okhttp3.HttpUrl
|
||||||
|
|
||||||
|
import org.openapitools.client.models.ApiStringEnumRef
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
|
||||||
|
import org.openapitools.client.infrastructure.ApiClient
|
||||||
|
import org.openapitools.client.infrastructure.ApiResponse
|
||||||
|
import org.openapitools.client.infrastructure.ClientException
|
||||||
|
import org.openapitools.client.infrastructure.ClientError
|
||||||
|
import org.openapitools.client.infrastructure.ServerException
|
||||||
|
import org.openapitools.client.infrastructure.ServerError
|
||||||
|
import org.openapitools.client.infrastructure.MultiValueMap
|
||||||
|
import org.openapitools.client.infrastructure.PartConfig
|
||||||
|
import org.openapitools.client.infrastructure.RequestConfig
|
||||||
|
import org.openapitools.client.infrastructure.RequestMethod
|
||||||
|
import org.openapitools.client.infrastructure.ResponseType
|
||||||
|
import org.openapitools.client.infrastructure.Success
|
||||||
|
import org.openapitools.client.infrastructure.toMultiValue
|
||||||
|
|
||||||
|
class PathApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) {
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
val defaultBasePath: String by lazy {
|
||||||
|
System.getProperties().getProperty(ApiClient.baseUrlKey, "http://localhost:3000")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* enum for parameter enumNonrefStringPath
|
||||||
|
*/
|
||||||
|
enum class EnumNonrefStringPathTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(val value: kotlin.String) {
|
||||||
|
@Json(name = "success") success("success"),
|
||||||
|
@Json(name = "failure") failure("failure"),
|
||||||
|
@Json(name = "unclassified") unclassified("unclassified");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override [toString()] to avoid using the enum variable name as the value, and instead use
|
||||||
|
* the actual value defined in the API spec file.
|
||||||
|
*
|
||||||
|
* This solves a problem when the variable name and its value are different, and ensures that
|
||||||
|
* the client sends the correct enum values to the server always.
|
||||||
|
*/
|
||||||
|
override fun toString(): kotlin.String = "$value"
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test path parameter(s)
|
||||||
|
* Test path parameter(s)
|
||||||
|
* @param pathString
|
||||||
|
* @param pathInteger
|
||||||
|
* @param enumNonrefStringPath
|
||||||
|
* @param enumRefStringPath
|
||||||
|
* @return kotlin.String
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||||
|
* @throws ClientException If the API returns a client error response
|
||||||
|
* @throws ServerException If the API returns a server error response
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||||
|
fun testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString: kotlin.String, pathInteger: kotlin.Int, enumNonrefStringPath: EnumNonrefStringPathTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, enumRefStringPath: ApiStringEnumRef) : kotlin.String {
|
||||||
|
val localVarResponse = testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString = pathString, pathInteger = pathInteger, enumNonrefStringPath = enumNonrefStringPath, enumRefStringPath = enumRefStringPath)
|
||||||
|
|
||||||
|
return when (localVarResponse.responseType) {
|
||||||
|
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||||
|
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||||
|
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||||
|
ResponseType.ClientError -> {
|
||||||
|
val localVarError = localVarResponse as ClientError<*>
|
||||||
|
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
ResponseType.ServerError -> {
|
||||||
|
val localVarError = localVarResponse as ServerError<*>
|
||||||
|
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test path parameter(s)
|
||||||
|
* Test path parameter(s)
|
||||||
|
* @param pathString
|
||||||
|
* @param pathInteger
|
||||||
|
* @param enumNonrefStringPath
|
||||||
|
* @param enumRefStringPath
|
||||||
|
* @return ApiResponse<kotlin.String?>
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class)
|
||||||
|
fun testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString: kotlin.String, pathInteger: kotlin.Int, enumNonrefStringPath: EnumNonrefStringPathTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, enumRefStringPath: ApiStringEnumRef) : ApiResponse<kotlin.String?> {
|
||||||
|
val localVariableConfig = testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequestConfig(pathString = pathString, pathInteger = pathInteger, enumNonrefStringPath = enumNonrefStringPath, enumRefStringPath = enumRefStringPath)
|
||||||
|
|
||||||
|
return request<Unit, kotlin.String>(
|
||||||
|
localVariableConfig
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To obtain the request config of the operation testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath
|
||||||
|
*
|
||||||
|
* @param pathString
|
||||||
|
* @param pathInteger
|
||||||
|
* @param enumNonrefStringPath
|
||||||
|
* @param enumRefStringPath
|
||||||
|
* @return RequestConfig
|
||||||
|
*/
|
||||||
|
fun testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequestConfig(pathString: kotlin.String, pathInteger: kotlin.Int, enumNonrefStringPath: EnumNonrefStringPathTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, enumRefStringPath: ApiStringEnumRef) : RequestConfig<Unit> {
|
||||||
|
val localVariableBody = null
|
||||||
|
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||||
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
localVariableHeaders["Accept"] = "text/plain"
|
||||||
|
|
||||||
|
return RequestConfig(
|
||||||
|
method = RequestMethod.GET,
|
||||||
|
path = "/path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}".replace("{"+"path_string"+"}", encodeURIComponent(pathString.toString())).replace("{"+"path_integer"+"}", encodeURIComponent(pathInteger.toString())).replace("{"+"enum_nonref_string_path"+"}", encodeURIComponent(enumNonrefStringPath.value.toString())).replace("{"+"enum_ref_string_path"+"}", encodeURIComponent(enumRefStringPath.toString())),
|
||||||
|
query = localVariableQuery,
|
||||||
|
headers = localVariableHeaders,
|
||||||
|
requiresAuthentication = false,
|
||||||
|
body = localVariableBody
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
|
||||||
|
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
|
||||||
|
}
|
@ -0,0 +1,557 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.apis
|
||||||
|
|
||||||
|
import java.io.IOException
|
||||||
|
import okhttp3.Call
|
||||||
|
import okhttp3.HttpUrl
|
||||||
|
|
||||||
|
import org.openapitools.client.models.ApiPet
|
||||||
|
import org.openapitools.client.models.ApiStringEnumRef
|
||||||
|
import org.openapitools.client.models.ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
|
||||||
|
import org.openapitools.client.infrastructure.ApiClient
|
||||||
|
import org.openapitools.client.infrastructure.ApiResponse
|
||||||
|
import org.openapitools.client.infrastructure.ClientException
|
||||||
|
import org.openapitools.client.infrastructure.ClientError
|
||||||
|
import org.openapitools.client.infrastructure.ServerException
|
||||||
|
import org.openapitools.client.infrastructure.ServerError
|
||||||
|
import org.openapitools.client.infrastructure.MultiValueMap
|
||||||
|
import org.openapitools.client.infrastructure.PartConfig
|
||||||
|
import org.openapitools.client.infrastructure.RequestConfig
|
||||||
|
import org.openapitools.client.infrastructure.RequestMethod
|
||||||
|
import org.openapitools.client.infrastructure.ResponseType
|
||||||
|
import org.openapitools.client.infrastructure.Success
|
||||||
|
import org.openapitools.client.infrastructure.toMultiValue
|
||||||
|
|
||||||
|
class QueryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) {
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
val defaultBasePath: String by lazy {
|
||||||
|
System.getProperties().getProperty(ApiClient.baseUrlKey, "http://localhost:3000")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* enum for parameter enumNonrefStringQuery
|
||||||
|
*/
|
||||||
|
enum class EnumNonrefStringQueryTestEnumRefString(val value: kotlin.String) {
|
||||||
|
@Json(name = "success") success("success"),
|
||||||
|
@Json(name = "failure") failure("failure"),
|
||||||
|
@Json(name = "unclassified") unclassified("unclassified");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override [toString()] to avoid using the enum variable name as the value, and instead use
|
||||||
|
* the actual value defined in the API spec file.
|
||||||
|
*
|
||||||
|
* This solves a problem when the variable name and its value are different, and ensures that
|
||||||
|
* the client sends the correct enum values to the server always.
|
||||||
|
*/
|
||||||
|
override fun toString(): kotlin.String = "$value"
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test query parameter(s)
|
||||||
|
* Test query parameter(s)
|
||||||
|
* @param enumNonrefStringQuery (optional)
|
||||||
|
* @param enumRefStringQuery (optional)
|
||||||
|
* @return kotlin.String
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||||
|
* @throws ClientException If the API returns a client error response
|
||||||
|
* @throws ServerException If the API returns a server error response
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||||
|
fun testEnumRefString(enumNonrefStringQuery: EnumNonrefStringQueryTestEnumRefString? = null, enumRefStringQuery: ApiStringEnumRef? = null) : kotlin.String {
|
||||||
|
val localVarResponse = testEnumRefStringWithHttpInfo(enumNonrefStringQuery = enumNonrefStringQuery, enumRefStringQuery = enumRefStringQuery)
|
||||||
|
|
||||||
|
return when (localVarResponse.responseType) {
|
||||||
|
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||||
|
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||||
|
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||||
|
ResponseType.ClientError -> {
|
||||||
|
val localVarError = localVarResponse as ClientError<*>
|
||||||
|
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
ResponseType.ServerError -> {
|
||||||
|
val localVarError = localVarResponse as ServerError<*>
|
||||||
|
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test query parameter(s)
|
||||||
|
* Test query parameter(s)
|
||||||
|
* @param enumNonrefStringQuery (optional)
|
||||||
|
* @param enumRefStringQuery (optional)
|
||||||
|
* @return ApiResponse<kotlin.String?>
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class)
|
||||||
|
fun testEnumRefStringWithHttpInfo(enumNonrefStringQuery: EnumNonrefStringQueryTestEnumRefString?, enumRefStringQuery: ApiStringEnumRef?) : ApiResponse<kotlin.String?> {
|
||||||
|
val localVariableConfig = testEnumRefStringRequestConfig(enumNonrefStringQuery = enumNonrefStringQuery, enumRefStringQuery = enumRefStringQuery)
|
||||||
|
|
||||||
|
return request<Unit, kotlin.String>(
|
||||||
|
localVariableConfig
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To obtain the request config of the operation testEnumRefString
|
||||||
|
*
|
||||||
|
* @param enumNonrefStringQuery (optional)
|
||||||
|
* @param enumRefStringQuery (optional)
|
||||||
|
* @return RequestConfig
|
||||||
|
*/
|
||||||
|
fun testEnumRefStringRequestConfig(enumNonrefStringQuery: EnumNonrefStringQueryTestEnumRefString?, enumRefStringQuery: ApiStringEnumRef?) : RequestConfig<Unit> {
|
||||||
|
val localVariableBody = null
|
||||||
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, kotlin.collections.List<kotlin.String>>()
|
||||||
|
.apply {
|
||||||
|
if (enumNonrefStringQuery != null) {
|
||||||
|
put("enum_nonref_string_query", listOf(enumNonrefStringQuery.value))
|
||||||
|
}
|
||||||
|
if (enumRefStringQuery != null) {
|
||||||
|
put("enum_ref_string_query", listOf(enumRefStringQuery.toString()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
localVariableHeaders["Accept"] = "text/plain"
|
||||||
|
|
||||||
|
return RequestConfig(
|
||||||
|
method = RequestMethod.GET,
|
||||||
|
path = "/query/enum_ref_string",
|
||||||
|
query = localVariableQuery,
|
||||||
|
headers = localVariableHeaders,
|
||||||
|
requiresAuthentication = false,
|
||||||
|
body = localVariableBody
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test query parameter(s)
|
||||||
|
* Test query parameter(s)
|
||||||
|
* @param datetimeQuery (optional)
|
||||||
|
* @param dateQuery (optional)
|
||||||
|
* @param stringQuery (optional)
|
||||||
|
* @return kotlin.String
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||||
|
* @throws ClientException If the API returns a client error response
|
||||||
|
* @throws ServerException If the API returns a server error response
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||||
|
fun testQueryDatetimeDateString(datetimeQuery: java.time.OffsetDateTime? = null, dateQuery: java.time.LocalDate? = null, stringQuery: kotlin.String? = null) : kotlin.String {
|
||||||
|
val localVarResponse = testQueryDatetimeDateStringWithHttpInfo(datetimeQuery = datetimeQuery, dateQuery = dateQuery, stringQuery = stringQuery)
|
||||||
|
|
||||||
|
return when (localVarResponse.responseType) {
|
||||||
|
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||||
|
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||||
|
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||||
|
ResponseType.ClientError -> {
|
||||||
|
val localVarError = localVarResponse as ClientError<*>
|
||||||
|
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
ResponseType.ServerError -> {
|
||||||
|
val localVarError = localVarResponse as ServerError<*>
|
||||||
|
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test query parameter(s)
|
||||||
|
* Test query parameter(s)
|
||||||
|
* @param datetimeQuery (optional)
|
||||||
|
* @param dateQuery (optional)
|
||||||
|
* @param stringQuery (optional)
|
||||||
|
* @return ApiResponse<kotlin.String?>
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class)
|
||||||
|
fun testQueryDatetimeDateStringWithHttpInfo(datetimeQuery: java.time.OffsetDateTime?, dateQuery: java.time.LocalDate?, stringQuery: kotlin.String?) : ApiResponse<kotlin.String?> {
|
||||||
|
val localVariableConfig = testQueryDatetimeDateStringRequestConfig(datetimeQuery = datetimeQuery, dateQuery = dateQuery, stringQuery = stringQuery)
|
||||||
|
|
||||||
|
return request<Unit, kotlin.String>(
|
||||||
|
localVariableConfig
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To obtain the request config of the operation testQueryDatetimeDateString
|
||||||
|
*
|
||||||
|
* @param datetimeQuery (optional)
|
||||||
|
* @param dateQuery (optional)
|
||||||
|
* @param stringQuery (optional)
|
||||||
|
* @return RequestConfig
|
||||||
|
*/
|
||||||
|
fun testQueryDatetimeDateStringRequestConfig(datetimeQuery: java.time.OffsetDateTime?, dateQuery: java.time.LocalDate?, stringQuery: kotlin.String?) : RequestConfig<Unit> {
|
||||||
|
val localVariableBody = null
|
||||||
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, kotlin.collections.List<kotlin.String>>()
|
||||||
|
.apply {
|
||||||
|
if (datetimeQuery != null) {
|
||||||
|
put("datetime_query", listOf(parseDateToQueryString(datetimeQuery)))
|
||||||
|
}
|
||||||
|
if (dateQuery != null) {
|
||||||
|
put("date_query", listOf(parseDateToQueryString(dateQuery)))
|
||||||
|
}
|
||||||
|
if (stringQuery != null) {
|
||||||
|
put("string_query", listOf(stringQuery.toString()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
localVariableHeaders["Accept"] = "text/plain"
|
||||||
|
|
||||||
|
return RequestConfig(
|
||||||
|
method = RequestMethod.GET,
|
||||||
|
path = "/query/datetime/date/string",
|
||||||
|
query = localVariableQuery,
|
||||||
|
headers = localVariableHeaders,
|
||||||
|
requiresAuthentication = false,
|
||||||
|
body = localVariableBody
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test query parameter(s)
|
||||||
|
* Test query parameter(s)
|
||||||
|
* @param integerQuery (optional)
|
||||||
|
* @param booleanQuery (optional)
|
||||||
|
* @param stringQuery (optional)
|
||||||
|
* @return kotlin.String
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||||
|
* @throws ClientException If the API returns a client error response
|
||||||
|
* @throws ServerException If the API returns a server error response
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||||
|
fun testQueryIntegerBooleanString(integerQuery: kotlin.Int? = null, booleanQuery: kotlin.Boolean? = null, stringQuery: kotlin.String? = null) : kotlin.String {
|
||||||
|
val localVarResponse = testQueryIntegerBooleanStringWithHttpInfo(integerQuery = integerQuery, booleanQuery = booleanQuery, stringQuery = stringQuery)
|
||||||
|
|
||||||
|
return when (localVarResponse.responseType) {
|
||||||
|
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||||
|
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||||
|
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||||
|
ResponseType.ClientError -> {
|
||||||
|
val localVarError = localVarResponse as ClientError<*>
|
||||||
|
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
ResponseType.ServerError -> {
|
||||||
|
val localVarError = localVarResponse as ServerError<*>
|
||||||
|
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test query parameter(s)
|
||||||
|
* Test query parameter(s)
|
||||||
|
* @param integerQuery (optional)
|
||||||
|
* @param booleanQuery (optional)
|
||||||
|
* @param stringQuery (optional)
|
||||||
|
* @return ApiResponse<kotlin.String?>
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class)
|
||||||
|
fun testQueryIntegerBooleanStringWithHttpInfo(integerQuery: kotlin.Int?, booleanQuery: kotlin.Boolean?, stringQuery: kotlin.String?) : ApiResponse<kotlin.String?> {
|
||||||
|
val localVariableConfig = testQueryIntegerBooleanStringRequestConfig(integerQuery = integerQuery, booleanQuery = booleanQuery, stringQuery = stringQuery)
|
||||||
|
|
||||||
|
return request<Unit, kotlin.String>(
|
||||||
|
localVariableConfig
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To obtain the request config of the operation testQueryIntegerBooleanString
|
||||||
|
*
|
||||||
|
* @param integerQuery (optional)
|
||||||
|
* @param booleanQuery (optional)
|
||||||
|
* @param stringQuery (optional)
|
||||||
|
* @return RequestConfig
|
||||||
|
*/
|
||||||
|
fun testQueryIntegerBooleanStringRequestConfig(integerQuery: kotlin.Int?, booleanQuery: kotlin.Boolean?, stringQuery: kotlin.String?) : RequestConfig<Unit> {
|
||||||
|
val localVariableBody = null
|
||||||
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, kotlin.collections.List<kotlin.String>>()
|
||||||
|
.apply {
|
||||||
|
if (integerQuery != null) {
|
||||||
|
put("integer_query", listOf(integerQuery.toString()))
|
||||||
|
}
|
||||||
|
if (booleanQuery != null) {
|
||||||
|
put("boolean_query", listOf(booleanQuery.toString()))
|
||||||
|
}
|
||||||
|
if (stringQuery != null) {
|
||||||
|
put("string_query", listOf(stringQuery.toString()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
localVariableHeaders["Accept"] = "text/plain"
|
||||||
|
|
||||||
|
return RequestConfig(
|
||||||
|
method = RequestMethod.GET,
|
||||||
|
path = "/query/integer/boolean/string",
|
||||||
|
query = localVariableQuery,
|
||||||
|
headers = localVariableHeaders,
|
||||||
|
requiresAuthentication = false,
|
||||||
|
body = localVariableBody
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test query parameter(s)
|
||||||
|
* Test query parameter(s)
|
||||||
|
* @param queryObject (optional)
|
||||||
|
* @return kotlin.String
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||||
|
* @throws ClientException If the API returns a client error response
|
||||||
|
* @throws ServerException If the API returns a server error response
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||||
|
fun testQueryStyleDeepObjectExplodeTrueObject(queryObject: ApiPet? = null) : kotlin.String {
|
||||||
|
val localVarResponse = testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject = queryObject)
|
||||||
|
|
||||||
|
return when (localVarResponse.responseType) {
|
||||||
|
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||||
|
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||||
|
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||||
|
ResponseType.ClientError -> {
|
||||||
|
val localVarError = localVarResponse as ClientError<*>
|
||||||
|
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
ResponseType.ServerError -> {
|
||||||
|
val localVarError = localVarResponse as ServerError<*>
|
||||||
|
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test query parameter(s)
|
||||||
|
* Test query parameter(s)
|
||||||
|
* @param queryObject (optional)
|
||||||
|
* @return ApiResponse<kotlin.String?>
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class)
|
||||||
|
fun testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject: ApiPet?) : ApiResponse<kotlin.String?> {
|
||||||
|
val localVariableConfig = testQueryStyleDeepObjectExplodeTrueObjectRequestConfig(queryObject = queryObject)
|
||||||
|
|
||||||
|
return request<Unit, kotlin.String>(
|
||||||
|
localVariableConfig
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To obtain the request config of the operation testQueryStyleDeepObjectExplodeTrueObject
|
||||||
|
*
|
||||||
|
* @param queryObject (optional)
|
||||||
|
* @return RequestConfig
|
||||||
|
*/
|
||||||
|
fun testQueryStyleDeepObjectExplodeTrueObjectRequestConfig(queryObject: ApiPet?) : RequestConfig<Unit> {
|
||||||
|
val localVariableBody = null
|
||||||
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, kotlin.collections.List<kotlin.String>>()
|
||||||
|
.apply {
|
||||||
|
if (queryObject != null) {
|
||||||
|
put("query_object", listOf(queryObject.toString()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
localVariableHeaders["Accept"] = "text/plain"
|
||||||
|
|
||||||
|
return RequestConfig(
|
||||||
|
method = RequestMethod.GET,
|
||||||
|
path = "/query/style_deepObject/explode_true/object",
|
||||||
|
query = localVariableQuery,
|
||||||
|
headers = localVariableHeaders,
|
||||||
|
requiresAuthentication = false,
|
||||||
|
body = localVariableBody
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test query parameter(s)
|
||||||
|
* Test query parameter(s)
|
||||||
|
* @param queryObject (optional)
|
||||||
|
* @return kotlin.String
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||||
|
* @throws ClientException If the API returns a client error response
|
||||||
|
* @throws ServerException If the API returns a server error response
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||||
|
fun testQueryStyleFormExplodeTrueArrayString(queryObject: ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter? = null) : kotlin.String {
|
||||||
|
val localVarResponse = testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject = queryObject)
|
||||||
|
|
||||||
|
return when (localVarResponse.responseType) {
|
||||||
|
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||||
|
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||||
|
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||||
|
ResponseType.ClientError -> {
|
||||||
|
val localVarError = localVarResponse as ClientError<*>
|
||||||
|
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
ResponseType.ServerError -> {
|
||||||
|
val localVarError = localVarResponse as ServerError<*>
|
||||||
|
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test query parameter(s)
|
||||||
|
* Test query parameter(s)
|
||||||
|
* @param queryObject (optional)
|
||||||
|
* @return ApiResponse<kotlin.String?>
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class)
|
||||||
|
fun testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject: ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter?) : ApiResponse<kotlin.String?> {
|
||||||
|
val localVariableConfig = testQueryStyleFormExplodeTrueArrayStringRequestConfig(queryObject = queryObject)
|
||||||
|
|
||||||
|
return request<Unit, kotlin.String>(
|
||||||
|
localVariableConfig
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To obtain the request config of the operation testQueryStyleFormExplodeTrueArrayString
|
||||||
|
*
|
||||||
|
* @param queryObject (optional)
|
||||||
|
* @return RequestConfig
|
||||||
|
*/
|
||||||
|
fun testQueryStyleFormExplodeTrueArrayStringRequestConfig(queryObject: ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter?) : RequestConfig<Unit> {
|
||||||
|
val localVariableBody = null
|
||||||
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, kotlin.collections.List<kotlin.String>>()
|
||||||
|
.apply {
|
||||||
|
if (queryObject != null) {
|
||||||
|
put("query_object", listOf(queryObject.toString()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
localVariableHeaders["Accept"] = "text/plain"
|
||||||
|
|
||||||
|
return RequestConfig(
|
||||||
|
method = RequestMethod.GET,
|
||||||
|
path = "/query/style_form/explode_true/array_string",
|
||||||
|
query = localVariableQuery,
|
||||||
|
headers = localVariableHeaders,
|
||||||
|
requiresAuthentication = false,
|
||||||
|
body = localVariableBody
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test query parameter(s)
|
||||||
|
* Test query parameter(s)
|
||||||
|
* @param queryObject (optional)
|
||||||
|
* @return kotlin.String
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||||
|
* @throws ClientException If the API returns a client error response
|
||||||
|
* @throws ServerException If the API returns a server error response
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||||
|
fun testQueryStyleFormExplodeTrueObject(queryObject: ApiPet? = null) : kotlin.String {
|
||||||
|
val localVarResponse = testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject = queryObject)
|
||||||
|
|
||||||
|
return when (localVarResponse.responseType) {
|
||||||
|
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||||
|
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||||
|
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||||
|
ResponseType.ClientError -> {
|
||||||
|
val localVarError = localVarResponse as ClientError<*>
|
||||||
|
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
ResponseType.ServerError -> {
|
||||||
|
val localVarError = localVarResponse as ServerError<*>
|
||||||
|
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test query parameter(s)
|
||||||
|
* Test query parameter(s)
|
||||||
|
* @param queryObject (optional)
|
||||||
|
* @return ApiResponse<kotlin.String?>
|
||||||
|
* @throws IllegalStateException If the request is not correctly configured
|
||||||
|
* @throws IOException Rethrows the OkHttp execute method exception
|
||||||
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@Throws(IllegalStateException::class, IOException::class)
|
||||||
|
fun testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject: ApiPet?) : ApiResponse<kotlin.String?> {
|
||||||
|
val localVariableConfig = testQueryStyleFormExplodeTrueObjectRequestConfig(queryObject = queryObject)
|
||||||
|
|
||||||
|
return request<Unit, kotlin.String>(
|
||||||
|
localVariableConfig
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To obtain the request config of the operation testQueryStyleFormExplodeTrueObject
|
||||||
|
*
|
||||||
|
* @param queryObject (optional)
|
||||||
|
* @return RequestConfig
|
||||||
|
*/
|
||||||
|
fun testQueryStyleFormExplodeTrueObjectRequestConfig(queryObject: ApiPet?) : RequestConfig<Unit> {
|
||||||
|
val localVariableBody = null
|
||||||
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, kotlin.collections.List<kotlin.String>>()
|
||||||
|
.apply {
|
||||||
|
if (queryObject != null) {
|
||||||
|
put("query_object", listOf(queryObject.toString()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||||
|
localVariableHeaders["Accept"] = "text/plain"
|
||||||
|
|
||||||
|
return RequestConfig(
|
||||||
|
method = RequestMethod.GET,
|
||||||
|
path = "/query/style_form/explode_true/object",
|
||||||
|
query = localVariableQuery,
|
||||||
|
headers = localVariableHeaders,
|
||||||
|
requiresAuthentication = false,
|
||||||
|
body = localVariableBody
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
|
||||||
|
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
typealias MultiValueMap = MutableMap<String,List<String>>
|
||||||
|
|
||||||
|
fun collectionDelimiter(collectionFormat: String): String = when(collectionFormat) {
|
||||||
|
"csv" -> ","
|
||||||
|
"tsv" -> "\t"
|
||||||
|
"pipe" -> "|"
|
||||||
|
"space" -> " "
|
||||||
|
else -> ""
|
||||||
|
}
|
||||||
|
|
||||||
|
val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" }
|
||||||
|
|
||||||
|
fun <T : Any?> toMultiValue(items: Array<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List<String>
|
||||||
|
= toMultiValue(items.asIterable(), collectionFormat, map)
|
||||||
|
|
||||||
|
fun <T : Any?> toMultiValue(items: Iterable<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List<String> {
|
||||||
|
return when(collectionFormat) {
|
||||||
|
"multi" -> items.map(map)
|
||||||
|
else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map))
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,375 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
|
import okhttp3.RequestBody
|
||||||
|
import okhttp3.RequestBody.Companion.asRequestBody
|
||||||
|
import okhttp3.RequestBody.Companion.toRequestBody
|
||||||
|
import okhttp3.FormBody
|
||||||
|
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
||||||
|
import okhttp3.ResponseBody
|
||||||
|
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||||
|
import okhttp3.Request
|
||||||
|
import okhttp3.Headers
|
||||||
|
import okhttp3.Headers.Builder
|
||||||
|
import okhttp3.Headers.Companion.toHeaders
|
||||||
|
import okhttp3.MultipartBody
|
||||||
|
import okhttp3.Call
|
||||||
|
import okhttp3.Callback
|
||||||
|
import okhttp3.Response
|
||||||
|
import java.io.BufferedWriter
|
||||||
|
import java.io.File
|
||||||
|
import java.io.FileWriter
|
||||||
|
import java.io.IOException
|
||||||
|
import java.net.URLConnection
|
||||||
|
import java.time.LocalDate
|
||||||
|
import java.time.LocalDateTime
|
||||||
|
import java.time.LocalTime
|
||||||
|
import java.time.OffsetDateTime
|
||||||
|
import java.time.OffsetTime
|
||||||
|
import java.util.Locale
|
||||||
|
import java.util.regex.Pattern
|
||||||
|
import com.squareup.moshi.adapter
|
||||||
|
|
||||||
|
val EMPTY_REQUEST: RequestBody = ByteArray(0).toRequestBody()
|
||||||
|
|
||||||
|
open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClient) {
|
||||||
|
companion object {
|
||||||
|
protected const val ContentType: String = "Content-Type"
|
||||||
|
protected const val Accept: String = "Accept"
|
||||||
|
protected const val Authorization: String = "Authorization"
|
||||||
|
protected const val JsonMediaType: String = "application/json"
|
||||||
|
protected const val FormDataMediaType: String = "multipart/form-data"
|
||||||
|
protected const val FormUrlEncMediaType: String = "application/x-www-form-urlencoded"
|
||||||
|
protected const val XmlMediaType: String = "application/xml"
|
||||||
|
protected const val OctetMediaType: String = "application/octet-stream"
|
||||||
|
protected const val TextMediaType: String = "text/plain"
|
||||||
|
|
||||||
|
val apiKey: MutableMap<String, String> = mutableMapOf()
|
||||||
|
val apiKeyPrefix: MutableMap<String, String> = mutableMapOf()
|
||||||
|
var username: String? = null
|
||||||
|
var password: String? = null
|
||||||
|
var accessToken: String? = null
|
||||||
|
const val baseUrlKey: String = "org.openapitools.client.baseUrl"
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
val defaultClient: OkHttpClient by lazy {
|
||||||
|
builder.build()
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
val builder: OkHttpClient.Builder = OkHttpClient.Builder()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Guess Content-Type header from the given byteArray (defaults to "application/octet-stream").
|
||||||
|
*
|
||||||
|
* @param byteArray The given file
|
||||||
|
* @return The guessed Content-Type
|
||||||
|
*/
|
||||||
|
protected fun guessContentTypeFromByteArray(byteArray: ByteArray): String {
|
||||||
|
val contentType = try {
|
||||||
|
URLConnection.guessContentTypeFromStream(byteArray.inputStream())
|
||||||
|
} catch (io: IOException) {
|
||||||
|
"application/octet-stream"
|
||||||
|
}
|
||||||
|
return contentType
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Guess Content-Type header from the given file (defaults to "application/octet-stream").
|
||||||
|
*
|
||||||
|
* @param file The given file
|
||||||
|
* @return The guessed Content-Type
|
||||||
|
*/
|
||||||
|
protected fun guessContentTypeFromFile(file: File): String {
|
||||||
|
val contentType = URLConnection.guessContentTypeFromName(file.name)
|
||||||
|
return contentType ?: "application/octet-stream"
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a File to a MultipartBody.Builder
|
||||||
|
* Defined a helper in the requestBody method to not duplicate code
|
||||||
|
* It will be used when the content is a FormDataMediaType and the body of the PartConfig is a File
|
||||||
|
*
|
||||||
|
* @param name The field name to add in the request
|
||||||
|
* @param headers The headers that are in the PartConfig
|
||||||
|
* @param file The file that will be added as the field value
|
||||||
|
* @return The method returns Unit but the new Part is added to the Builder that the extension function is applying on
|
||||||
|
* @see requestBody
|
||||||
|
*/
|
||||||
|
protected fun MultipartBody.Builder.addPartToMultiPart(name: String, headers: Map<String, String>, file: File) {
|
||||||
|
val partHeaders = headers.toMutableMap() +
|
||||||
|
("Content-Disposition" to "form-data; name=\"$name\"; filename=\"${file.name}\"")
|
||||||
|
val fileMediaType = guessContentTypeFromFile(file).toMediaTypeOrNull()
|
||||||
|
addPart(
|
||||||
|
partHeaders.toHeaders(),
|
||||||
|
file.asRequestBody(fileMediaType)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds any type to a MultipartBody.Builder
|
||||||
|
* Defined a helper in the requestBody method to not duplicate code
|
||||||
|
* It will be used when the content is a FormDataMediaType and the body of the PartConfig is not a File.
|
||||||
|
*
|
||||||
|
* @param name The field name to add in the request
|
||||||
|
* @param headers The headers that are in the PartConfig
|
||||||
|
* @param obj The field name to add in the request
|
||||||
|
* @return The method returns Unit but the new Part is added to the Builder that the extension function is applying on
|
||||||
|
* @see requestBody
|
||||||
|
*/
|
||||||
|
protected fun <T> MultipartBody.Builder.addPartToMultiPart(name: String, headers: Map<String, String>, obj: T?) {
|
||||||
|
val partHeaders = headers.toMutableMap() +
|
||||||
|
("Content-Disposition" to "form-data; name=\"$name\"")
|
||||||
|
addPart(
|
||||||
|
partHeaders.toHeaders(),
|
||||||
|
parameterToString(obj).toRequestBody(null)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
protected inline fun <reified T> requestBody(content: T, mediaType: String?): RequestBody =
|
||||||
|
when {
|
||||||
|
content is ByteArray -> content.toRequestBody((mediaType ?: guessContentTypeFromByteArray(content)).toMediaTypeOrNull())
|
||||||
|
content is File -> content.asRequestBody((mediaType ?: guessContentTypeFromFile(content)).toMediaTypeOrNull())
|
||||||
|
mediaType == FormDataMediaType ->
|
||||||
|
MultipartBody.Builder()
|
||||||
|
.setType(MultipartBody.FORM)
|
||||||
|
.apply {
|
||||||
|
// content's type *must* be Map<String, PartConfig<*>>
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
(content as Map<String, PartConfig<*>>).forEach { (name, part) ->
|
||||||
|
when (part.body) {
|
||||||
|
is File -> addPartToMultiPart(name, part.headers, part.body)
|
||||||
|
is List<*> -> {
|
||||||
|
part.body.forEach {
|
||||||
|
if (it is File) {
|
||||||
|
addPartToMultiPart(name, part.headers, it)
|
||||||
|
} else {
|
||||||
|
addPartToMultiPart(name, part.headers, it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else -> addPartToMultiPart(name, part.headers, part.body)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.build()
|
||||||
|
mediaType == FormUrlEncMediaType -> {
|
||||||
|
FormBody.Builder().apply {
|
||||||
|
// content's type *must* be Map<String, PartConfig<*>>
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
(content as Map<String, PartConfig<*>>).forEach { (name, part) ->
|
||||||
|
add(name, parameterToString(part.body))
|
||||||
|
}
|
||||||
|
}.build()
|
||||||
|
}
|
||||||
|
mediaType == null || mediaType.startsWith("application/") && mediaType.endsWith("json") ->
|
||||||
|
if (content == null) {
|
||||||
|
EMPTY_REQUEST
|
||||||
|
} else {
|
||||||
|
Serializer.moshi.adapter(T::class.java).toJson(content)
|
||||||
|
.toRequestBody((mediaType ?: JsonMediaType).toMediaTypeOrNull())
|
||||||
|
}
|
||||||
|
mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.")
|
||||||
|
mediaType == TextMediaType && content is String ->
|
||||||
|
content.toRequestBody(TextMediaType.toMediaTypeOrNull())
|
||||||
|
// TODO: this should be extended with other serializers
|
||||||
|
else -> throw UnsupportedOperationException("requestBody currently only supports JSON body, text body, byte body and File body.")
|
||||||
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalStdlibApi::class)
|
||||||
|
protected inline fun <reified T: Any?> responseBody(response: Response, mediaType: String? = JsonMediaType): T? {
|
||||||
|
val body = response.body
|
||||||
|
if(body == null) {
|
||||||
|
return null
|
||||||
|
} else if (T::class.java == Unit::class.java) {
|
||||||
|
// No need to parse the body when we're not interested in the body
|
||||||
|
// Useful when API is returning other Content-Type
|
||||||
|
return null
|
||||||
|
} else if (T::class.java == File::class.java) {
|
||||||
|
// return tempFile
|
||||||
|
val contentDisposition = response.header("Content-Disposition")
|
||||||
|
|
||||||
|
val fileName = if (contentDisposition != null) {
|
||||||
|
// Get filename from the Content-Disposition header.
|
||||||
|
val pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?")
|
||||||
|
val matcher = pattern.matcher(contentDisposition)
|
||||||
|
if (matcher.find()) {
|
||||||
|
matcher.group(1)
|
||||||
|
?.replace(".*[/\\\\]", "")
|
||||||
|
?.replace(";", "")
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
|
||||||
|
var prefix: String?
|
||||||
|
val suffix: String?
|
||||||
|
if (fileName == null) {
|
||||||
|
prefix = "download"
|
||||||
|
suffix = ""
|
||||||
|
} else {
|
||||||
|
val pos = fileName.lastIndexOf(".")
|
||||||
|
if (pos == -1) {
|
||||||
|
prefix = fileName
|
||||||
|
suffix = null
|
||||||
|
} else {
|
||||||
|
prefix = fileName.substring(0, pos)
|
||||||
|
suffix = fileName.substring(pos)
|
||||||
|
}
|
||||||
|
// Files.createTempFile requires the prefix to be at least three characters long
|
||||||
|
if (prefix.length < 3) {
|
||||||
|
prefix = "download"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attention: if you are developing an android app that supports API Level 25 and below, please check flag supportAndroidApiLevel25AndBelow in https://openapi-generator.tech/docs/generators/kotlin#config-options
|
||||||
|
val tempFile = java.nio.file.Files.createTempFile(prefix, suffix).toFile()
|
||||||
|
tempFile.deleteOnExit()
|
||||||
|
body.byteStream().use { inputStream ->
|
||||||
|
tempFile.outputStream().use { tempFileOutputStream ->
|
||||||
|
inputStream.copyTo(tempFileOutputStream)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tempFile as T
|
||||||
|
}
|
||||||
|
|
||||||
|
return when {
|
||||||
|
mediaType == null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> {
|
||||||
|
val bodyContent = body.string()
|
||||||
|
if (bodyContent.isEmpty()) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
Serializer.moshi.adapter<T>().fromJson(bodyContent)
|
||||||
|
}
|
||||||
|
mediaType == OctetMediaType -> body.bytes() as? T
|
||||||
|
mediaType == TextMediaType -> body.string() as? T
|
||||||
|
else -> throw UnsupportedOperationException("responseBody currently only supports JSON body, text body and byte body.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected fun <T> updateAuthParams(requestConfig: RequestConfig<T>) {
|
||||||
|
if (requestConfig.headers[Authorization].isNullOrEmpty()) {
|
||||||
|
username?.let { username ->
|
||||||
|
password?.let { password ->
|
||||||
|
requestConfig.headers[Authorization] = okhttp3.Credentials.basic(username, password)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (requestConfig.headers[Authorization].isNullOrEmpty()) {
|
||||||
|
accessToken?.let { accessToken ->
|
||||||
|
requestConfig.headers[Authorization] = "Bearer $accessToken"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected inline fun <reified I, reified T: Any?> request(requestConfig: RequestConfig<I>): ApiResponse<T?> {
|
||||||
|
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
|
||||||
|
|
||||||
|
// take authMethod from operation
|
||||||
|
updateAuthParams(requestConfig)
|
||||||
|
|
||||||
|
val url = httpUrl.newBuilder()
|
||||||
|
.addEncodedPathSegments(requestConfig.path.trimStart('/'))
|
||||||
|
.apply {
|
||||||
|
requestConfig.query.forEach { query ->
|
||||||
|
query.value.forEach { queryValue ->
|
||||||
|
addQueryParameter(query.key, queryValue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.build()
|
||||||
|
|
||||||
|
// take content-type/accept from spec or set to default (application/json) if not defined
|
||||||
|
if (requestConfig.body != null && requestConfig.headers[ContentType].isNullOrEmpty()) {
|
||||||
|
requestConfig.headers[ContentType] = JsonMediaType
|
||||||
|
}
|
||||||
|
if (requestConfig.headers[Accept].isNullOrEmpty()) {
|
||||||
|
requestConfig.headers[Accept] = JsonMediaType
|
||||||
|
}
|
||||||
|
val headers = requestConfig.headers
|
||||||
|
|
||||||
|
if (headers[Accept].isNullOrEmpty()) {
|
||||||
|
throw kotlin.IllegalStateException("Missing Accept header. This is required.")
|
||||||
|
}
|
||||||
|
|
||||||
|
val contentType = if (headers[ContentType] != null) {
|
||||||
|
// TODO: support multiple contentType options here.
|
||||||
|
(headers[ContentType] as String).substringBefore(";").lowercase(Locale.US)
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
|
||||||
|
val request = when (requestConfig.method) {
|
||||||
|
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
|
||||||
|
RequestMethod.GET -> Request.Builder().url(url)
|
||||||
|
RequestMethod.HEAD -> Request.Builder().url(url).head()
|
||||||
|
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType))
|
||||||
|
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType))
|
||||||
|
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType))
|
||||||
|
RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null)
|
||||||
|
}.apply {
|
||||||
|
val headersBuilder = Headers.Builder()
|
||||||
|
headers.forEach { header ->
|
||||||
|
headersBuilder.add(header.key, header.value)
|
||||||
|
}
|
||||||
|
this.headers(headersBuilder.build())
|
||||||
|
}.build()
|
||||||
|
|
||||||
|
val response = client.newCall(request).execute()
|
||||||
|
|
||||||
|
val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.US)
|
||||||
|
|
||||||
|
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
||||||
|
@Suppress("UNNECESSARY_SAFE_CALL")
|
||||||
|
return response.use {
|
||||||
|
when {
|
||||||
|
it.isRedirect -> Redirection(
|
||||||
|
it.code,
|
||||||
|
it.headers.toMultimap()
|
||||||
|
)
|
||||||
|
it.isInformational -> Informational(
|
||||||
|
it.message,
|
||||||
|
it.code,
|
||||||
|
it.headers.toMultimap()
|
||||||
|
)
|
||||||
|
it.isSuccessful -> Success(
|
||||||
|
responseBody(it, accept),
|
||||||
|
it.code,
|
||||||
|
it.headers.toMultimap()
|
||||||
|
)
|
||||||
|
it.isClientError -> ClientError(
|
||||||
|
it.message,
|
||||||
|
it.body?.string(),
|
||||||
|
it.code,
|
||||||
|
it.headers.toMultimap()
|
||||||
|
)
|
||||||
|
else -> ServerError(
|
||||||
|
it.message,
|
||||||
|
it.body?.string(),
|
||||||
|
it.code,
|
||||||
|
it.headers.toMultimap()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected fun parameterToString(value: Any?): String = when (value) {
|
||||||
|
null -> ""
|
||||||
|
is Array<*> -> toMultiValue(value, "csv").toString()
|
||||||
|
is Iterable<*> -> toMultiValue(value, "csv").toString()
|
||||||
|
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime ->
|
||||||
|
parseDateToQueryString(value)
|
||||||
|
else -> value.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
protected inline fun <reified T: Any> parseDateToQueryString(value : T): String {
|
||||||
|
/*
|
||||||
|
.replace("\"", "") converts the json object string to an actual string for the query parameter.
|
||||||
|
The moshi or gson adapter allows a more generic solution instead of trying to use a native
|
||||||
|
formatter. It also easily allows to provide a simple way to define a custom date format pattern
|
||||||
|
inside a gson/moshi adapter.
|
||||||
|
*/
|
||||||
|
return Serializer.moshi.adapter(T::class.java).toJson(value).replace("\"", "")
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
enum class ResponseType {
|
||||||
|
Success, Informational, Redirection, ClientError, ServerError
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Response
|
||||||
|
|
||||||
|
abstract class ApiResponse<T>(val responseType: ResponseType): Response {
|
||||||
|
abstract val statusCode: Int
|
||||||
|
abstract val headers: Map<String,List<String>>
|
||||||
|
}
|
||||||
|
|
||||||
|
class Success<T>(
|
||||||
|
val data: T,
|
||||||
|
override val statusCode: Int = -1,
|
||||||
|
override val headers: Map<String, List<String>> = mapOf()
|
||||||
|
): ApiResponse<T>(ResponseType.Success)
|
||||||
|
|
||||||
|
class Informational<T>(
|
||||||
|
val statusText: String,
|
||||||
|
override val statusCode: Int = -1,
|
||||||
|
override val headers: Map<String, List<String>> = mapOf()
|
||||||
|
) : ApiResponse<T>(ResponseType.Informational)
|
||||||
|
|
||||||
|
class Redirection<T>(
|
||||||
|
override val statusCode: Int = -1,
|
||||||
|
override val headers: Map<String, List<String>> = mapOf()
|
||||||
|
) : ApiResponse<T>(ResponseType.Redirection)
|
||||||
|
|
||||||
|
class ClientError<T>(
|
||||||
|
val message: String? = null,
|
||||||
|
val body: Any? = null,
|
||||||
|
override val statusCode: Int = -1,
|
||||||
|
override val headers: Map<String, List<String>> = mapOf()
|
||||||
|
) : ApiResponse<T>(ResponseType.ClientError)
|
||||||
|
|
||||||
|
class ServerError<T>(
|
||||||
|
val message: String? = null,
|
||||||
|
val body: Any? = null,
|
||||||
|
override val statusCode: Int = -1,
|
||||||
|
override val headers: Map<String, List<String>> = mapOf()
|
||||||
|
): ApiResponse<T>(ResponseType.ServerError)
|
@ -0,0 +1,17 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.math.BigDecimal
|
||||||
|
|
||||||
|
class BigDecimalAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: BigDecimal): String {
|
||||||
|
return value.toPlainString()
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): BigDecimal {
|
||||||
|
return BigDecimal(value)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.math.BigInteger
|
||||||
|
|
||||||
|
class BigIntegerAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: BigInteger): String {
|
||||||
|
return value.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): BigInteger {
|
||||||
|
return BigInteger(value)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
|
||||||
|
class ByteArrayAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(data: ByteArray): String = String(data)
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(data: String): ByteArray = data.toByteArray()
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import java.lang.RuntimeException
|
||||||
|
|
||||||
|
open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val serialVersionUID: Long = 123L
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val serialVersionUID: Long = 456L
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.time.LocalDate
|
||||||
|
import java.time.format.DateTimeFormatter
|
||||||
|
|
||||||
|
class LocalDateAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: LocalDate): String {
|
||||||
|
return DateTimeFormatter.ISO_LOCAL_DATE.format(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): LocalDate {
|
||||||
|
return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.time.LocalDateTime
|
||||||
|
import java.time.format.DateTimeFormatter
|
||||||
|
|
||||||
|
class LocalDateTimeAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: LocalDateTime): String {
|
||||||
|
return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): LocalDateTime {
|
||||||
|
return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.time.OffsetDateTime
|
||||||
|
import java.time.format.DateTimeFormatter
|
||||||
|
|
||||||
|
class OffsetDateTimeAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: OffsetDateTime): String {
|
||||||
|
return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): OffsetDateTime {
|
||||||
|
return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a config object for a given part of a multi-part request.
|
||||||
|
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
||||||
|
* multi-valued headers as csv-only.
|
||||||
|
*/
|
||||||
|
data class PartConfig<T>(
|
||||||
|
val headers: MutableMap<String, String> = mutableMapOf(),
|
||||||
|
val body: T? = null
|
||||||
|
)
|
@ -0,0 +1,19 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a config object for a given request.
|
||||||
|
* NOTE: This object doesn't include 'body' because it
|
||||||
|
* allows for caching of the constructed object
|
||||||
|
* for many request definitions.
|
||||||
|
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
||||||
|
* multi-valued headers as csv-only.
|
||||||
|
*/
|
||||||
|
data class RequestConfig<T>(
|
||||||
|
val method: RequestMethod,
|
||||||
|
val path: String,
|
||||||
|
val headers: MutableMap<String, String> = mutableMapOf(),
|
||||||
|
val params: MutableMap<String, Any> = mutableMapOf(),
|
||||||
|
val query: MutableMap<String, List<String>> = mutableMapOf(),
|
||||||
|
val requiresAuthentication: Boolean,
|
||||||
|
val body: T? = null
|
||||||
|
)
|
@ -0,0 +1,8 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides enumerated HTTP verbs
|
||||||
|
*/
|
||||||
|
enum class RequestMethod {
|
||||||
|
GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import okhttp3.Response
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides an extension to evaluation whether the response is a 1xx code
|
||||||
|
*/
|
||||||
|
val Response.isInformational : Boolean get() = this.code in 100..199
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides an extension to evaluation whether the response is a 3xx code
|
||||||
|
*/
|
||||||
|
@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
|
||||||
|
val Response.isRedirect : Boolean get() = this.code in 300..399
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides an extension to evaluation whether the response is a 4xx code
|
||||||
|
*/
|
||||||
|
val Response.isClientError : Boolean get() = this.code in 400..499
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code
|
||||||
|
*/
|
||||||
|
val Response.isServerError : Boolean get() = this.code in 500..999
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.Moshi
|
||||||
|
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
|
||||||
|
|
||||||
|
object Serializer {
|
||||||
|
@JvmStatic
|
||||||
|
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
||||||
|
.add(OffsetDateTimeAdapter())
|
||||||
|
.add(LocalDateTimeAdapter())
|
||||||
|
.add(LocalDateAdapter())
|
||||||
|
.add(UUIDAdapter())
|
||||||
|
.add(ByteArrayAdapter())
|
||||||
|
.add(URIAdapter())
|
||||||
|
.add(KotlinJsonAdapterFactory())
|
||||||
|
.add(BigDecimalAdapter())
|
||||||
|
.add(BigIntegerAdapter())
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
val moshi: Moshi by lazy {
|
||||||
|
moshiBuilder.build()
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.net.URI
|
||||||
|
|
||||||
|
class URIAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(uri: URI): String = uri.toString()
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(s: String): URI = URI.create(s)
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.util.UUID
|
||||||
|
|
||||||
|
class UUIDAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(uuid: UUID): String = uuid.toString()
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(s: String): UUID = UUID.fromString(s)
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.models
|
||||||
|
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
import com.squareup.moshi.JsonClass
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param propertySize
|
||||||
|
* @param color
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
data class ApiBird (
|
||||||
|
|
||||||
|
@Json(name = "size")
|
||||||
|
val propertySize: kotlin.String? = null,
|
||||||
|
|
||||||
|
@Json(name = "color")
|
||||||
|
val color: kotlin.String? = null
|
||||||
|
|
||||||
|
) {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,42 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.models
|
||||||
|
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
import com.squareup.moshi.JsonClass
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @param name
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
data class ApiCategory (
|
||||||
|
|
||||||
|
@Json(name = "id")
|
||||||
|
val id: kotlin.Long? = null,
|
||||||
|
|
||||||
|
@Json(name = "name")
|
||||||
|
val name: kotlin.String? = null
|
||||||
|
|
||||||
|
) {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,78 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.models
|
||||||
|
|
||||||
|
import org.openapitools.client.models.ApiStringEnumRef
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
import com.squareup.moshi.JsonClass
|
||||||
|
|
||||||
|
/**
|
||||||
|
* to test the default value of properties
|
||||||
|
*
|
||||||
|
* @param arrayStringEnumRefDefault
|
||||||
|
* @param arrayStringEnumDefault
|
||||||
|
* @param arrayStringDefault
|
||||||
|
* @param arrayIntegerDefault
|
||||||
|
* @param arrayString
|
||||||
|
* @param arrayStringNullable
|
||||||
|
* @param arrayStringExtensionNullable
|
||||||
|
* @param stringNullable
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
data class ApiDefaultValue (
|
||||||
|
|
||||||
|
@Json(name = "array_string_enum_ref_default")
|
||||||
|
val arrayStringEnumRefDefault: kotlin.collections.List<ApiStringEnumRef>? = null,
|
||||||
|
|
||||||
|
@Json(name = "array_string_enum_default")
|
||||||
|
val arrayStringEnumDefault: kotlin.collections.List<ApiDefaultValue.ArrayStringEnumDefault>? = null,
|
||||||
|
|
||||||
|
@Json(name = "array_string_default")
|
||||||
|
val arrayStringDefault: kotlin.collections.List<kotlin.String>? = arrayListOf("failure","skipped"),
|
||||||
|
|
||||||
|
@Json(name = "array_integer_default")
|
||||||
|
val arrayIntegerDefault: kotlin.collections.List<kotlin.Int>? = arrayListOf(1,3),
|
||||||
|
|
||||||
|
@Json(name = "array_string")
|
||||||
|
val arrayString: kotlin.collections.List<kotlin.String>? = null,
|
||||||
|
|
||||||
|
@Json(name = "array_string_nullable")
|
||||||
|
val arrayStringNullable: kotlin.collections.List<kotlin.String>? = null,
|
||||||
|
|
||||||
|
@Json(name = "array_string_extension_nullable")
|
||||||
|
val arrayStringExtensionNullable: kotlin.collections.List<kotlin.String>? = null,
|
||||||
|
|
||||||
|
@Json(name = "string_nullable")
|
||||||
|
val stringNullable: kotlin.String? = null
|
||||||
|
|
||||||
|
) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Values: success,failure,unclassified
|
||||||
|
*/
|
||||||
|
@JsonClass(generateAdapter = false)
|
||||||
|
enum class ArrayStringEnumDefault(val value: kotlin.String) {
|
||||||
|
@Json(name = "success") success("success"),
|
||||||
|
@Json(name = "failure") failure("failure"),
|
||||||
|
@Json(name = "unclassified") unclassified("unclassified");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,46 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.models
|
||||||
|
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
import com.squareup.moshi.JsonClass
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param number
|
||||||
|
* @param float
|
||||||
|
* @param double
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
data class ApiNumberPropertiesOnly (
|
||||||
|
|
||||||
|
@Json(name = "number")
|
||||||
|
val number: java.math.BigDecimal? = null,
|
||||||
|
|
||||||
|
@Json(name = "float")
|
||||||
|
val float: kotlin.Float? = null,
|
||||||
|
|
||||||
|
@Json(name = "double")
|
||||||
|
val double: kotlin.Double? = null
|
||||||
|
|
||||||
|
) {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,72 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.models
|
||||||
|
|
||||||
|
import org.openapitools.client.models.ApiCategory
|
||||||
|
import org.openapitools.client.models.ApiTag
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
import com.squareup.moshi.JsonClass
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* @param photoUrls
|
||||||
|
* @param id
|
||||||
|
* @param category
|
||||||
|
* @param tags
|
||||||
|
* @param status pet status in the store
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
data class ApiPet (
|
||||||
|
|
||||||
|
@Json(name = "name")
|
||||||
|
val name: kotlin.String,
|
||||||
|
|
||||||
|
@Json(name = "photoUrls")
|
||||||
|
val photoUrls: kotlin.collections.List<kotlin.String>,
|
||||||
|
|
||||||
|
@Json(name = "id")
|
||||||
|
val id: kotlin.Long? = null,
|
||||||
|
|
||||||
|
@Json(name = "category")
|
||||||
|
val category: ApiCategory? = null,
|
||||||
|
|
||||||
|
@Json(name = "tags")
|
||||||
|
val tags: kotlin.collections.List<ApiTag>? = null,
|
||||||
|
|
||||||
|
/* pet status in the store */
|
||||||
|
@Json(name = "status")
|
||||||
|
val status: ApiPet.Status? = null
|
||||||
|
|
||||||
|
) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pet status in the store
|
||||||
|
*
|
||||||
|
* Values: available,pending,sold
|
||||||
|
*/
|
||||||
|
@JsonClass(generateAdapter = false)
|
||||||
|
enum class Status(val value: kotlin.String) {
|
||||||
|
@Json(name = "available") available("available"),
|
||||||
|
@Json(name = "pending") pending("pending"),
|
||||||
|
@Json(name = "sold") sold("sold");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,54 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.models
|
||||||
|
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
import com.squareup.moshi.JsonClass
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param id Query
|
||||||
|
* @param outcomes
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
data class ApiQuery (
|
||||||
|
|
||||||
|
/* Query */
|
||||||
|
@Json(name = "id")
|
||||||
|
val id: kotlin.Long? = null,
|
||||||
|
|
||||||
|
@Json(name = "outcomes")
|
||||||
|
val outcomes: kotlin.collections.List<ApiQuery.Outcomes>? = null
|
||||||
|
|
||||||
|
) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Values: SUCCESS,FAILURE,SKIPPED
|
||||||
|
*/
|
||||||
|
@JsonClass(generateAdapter = false)
|
||||||
|
enum class Outcomes(val value: kotlin.String) {
|
||||||
|
@Json(name = "SUCCESS") SUCCESS("SUCCESS"),
|
||||||
|
@Json(name = "FAILURE") FAILURE("FAILURE"),
|
||||||
|
@Json(name = "SKIPPED") SKIPPED("SKIPPED");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,66 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.models
|
||||||
|
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
import com.squareup.moshi.JsonClass
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Values: success,failure,unclassified
|
||||||
|
*/
|
||||||
|
|
||||||
|
@JsonClass(generateAdapter = false)
|
||||||
|
enum class ApiStringEnumRef(val value: kotlin.String) {
|
||||||
|
|
||||||
|
@Json(name = "success")
|
||||||
|
success("success"),
|
||||||
|
|
||||||
|
@Json(name = "failure")
|
||||||
|
failure("failure"),
|
||||||
|
|
||||||
|
@Json(name = "unclassified")
|
||||||
|
unclassified("unclassified");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override [toString()] to avoid using the enum variable name as the value, and instead use
|
||||||
|
* the actual value defined in the API spec file.
|
||||||
|
*
|
||||||
|
* This solves a problem when the variable name and its value are different, and ensures that
|
||||||
|
* the client sends the correct enum values to the server always.
|
||||||
|
*/
|
||||||
|
override fun toString(): kotlin.String = value
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
/**
|
||||||
|
* Converts the provided [data] to a [String] on success, null otherwise.
|
||||||
|
*/
|
||||||
|
fun encode(data: kotlin.Any?): kotlin.String? = if (data is ApiStringEnumRef) "$data" else null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a valid [ApiStringEnumRef] for [data], null otherwise.
|
||||||
|
*/
|
||||||
|
fun decode(data: kotlin.Any?): ApiStringEnumRef? = data?.let {
|
||||||
|
val normalizedData = "$it".lowercase()
|
||||||
|
values().firstOrNull { value ->
|
||||||
|
it == value || normalizedData == "$value".lowercase()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,42 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.models
|
||||||
|
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
import com.squareup.moshi.JsonClass
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @param name
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
data class ApiTag (
|
||||||
|
|
||||||
|
@Json(name = "id")
|
||||||
|
val id: kotlin.Long? = null,
|
||||||
|
|
||||||
|
@Json(name = "name")
|
||||||
|
val name: kotlin.String? = null
|
||||||
|
|
||||||
|
) {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,38 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.models
|
||||||
|
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
import com.squareup.moshi.JsonClass
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param propertyValues
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
data class ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter (
|
||||||
|
|
||||||
|
@Json(name = "values")
|
||||||
|
val propertyValues: kotlin.collections.List<kotlin.String>? = null
|
||||||
|
|
||||||
|
) {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,80 @@
|
|||||||
|
package org.openapitools.client
|
||||||
|
|
||||||
|
import io.kotlintest.matchers.string.shouldContain
|
||||||
|
import io.kotlintest.specs.ShouldSpec
|
||||||
|
import org.junit.jupiter.api.Assertions
|
||||||
|
import org.openapitools.client.apis.BodyApi
|
||||||
|
import java.io.File
|
||||||
|
import java.io.FileWriter
|
||||||
|
|
||||||
|
class CustomTests : ShouldSpec({
|
||||||
|
val bodyApi = BodyApi()
|
||||||
|
|
||||||
|
should("send a single file as null") {
|
||||||
|
val result = bodyApi.testBodyMultipartFormdataSingleBinary(null)
|
||||||
|
val parsedResult = EchoServerResponseParser(result)
|
||||||
|
|
||||||
|
parsedResult.body shouldContain """
|
||||||
|
Content-Disposition: form-data; name="my-file"
|
||||||
|
Content-Length: 0
|
||||||
|
""".trimIndent()
|
||||||
|
}
|
||||||
|
|
||||||
|
should("send a single file") {
|
||||||
|
val result = bodyApi.testBodyMultipartFormdataSingleBinary(createTestFile())
|
||||||
|
val parsedResult = EchoServerResponseParser(result)
|
||||||
|
|
||||||
|
parsedResult.body shouldContain """
|
||||||
|
Content-Disposition: form-data; name="my-file"; filename="test.txt"
|
||||||
|
Content-Type: text/plain
|
||||||
|
Content-Length: 12
|
||||||
|
|
||||||
|
testing only
|
||||||
|
""".trimIndent()
|
||||||
|
}
|
||||||
|
|
||||||
|
should("send several files") {
|
||||||
|
val result = bodyApi.testBodyMultipartFormdataArrayOfBinary(listOf(createTestFile(), createOtherTestFile()))
|
||||||
|
val parsedResult = EchoServerResponseParser(result)
|
||||||
|
|
||||||
|
parsedResult.body shouldContain """
|
||||||
|
Content-Disposition: form-data; name="files"; filename="test.txt"
|
||||||
|
Content-Type: text/plain
|
||||||
|
Content-Length: 12
|
||||||
|
|
||||||
|
testing only
|
||||||
|
""".trimIndent()
|
||||||
|
|
||||||
|
parsedResult.body shouldContain """
|
||||||
|
Content-Disposition: form-data; name="files"; filename="otherTestFile.txt"
|
||||||
|
Content-Type: text/plain
|
||||||
|
Content-Length: 17
|
||||||
|
|
||||||
|
Another test file
|
||||||
|
""".trimIndent()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
private fun createTestFile(): File {
|
||||||
|
val myFile = File("test.txt")
|
||||||
|
if (!myFile.exists()) {
|
||||||
|
Assertions.assertTrue(myFile.createNewFile())
|
||||||
|
}
|
||||||
|
val fw = FileWriter(myFile)
|
||||||
|
fw.write("testing only")
|
||||||
|
fw.close()
|
||||||
|
myFile.deleteOnExit()
|
||||||
|
return myFile
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun createOtherTestFile(): File {
|
||||||
|
val myFile = File("otherTestFile.txt")
|
||||||
|
if (!myFile.exists()) {
|
||||||
|
Assertions.assertTrue(myFile.createNewFile())
|
||||||
|
}
|
||||||
|
val fw = FileWriter(myFile)
|
||||||
|
fw.write("Another test file")
|
||||||
|
fw.close()
|
||||||
|
myFile.deleteOnExit()
|
||||||
|
return myFile
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package org.openapitools.client
|
||||||
|
|
||||||
|
class EchoServerResponseParser(response: String) {
|
||||||
|
lateinit var method: String
|
||||||
|
lateinit var path: String
|
||||||
|
lateinit var protocol: String
|
||||||
|
val headers = hashMapOf<String, String>()
|
||||||
|
val body: String
|
||||||
|
|
||||||
|
init {
|
||||||
|
require(response.isNotEmpty()) { "Echo server response cannot be null" }
|
||||||
|
|
||||||
|
val lines = response.lineSequence().iterator()
|
||||||
|
var firstLine = true
|
||||||
|
var bodyStart = false
|
||||||
|
val bodyBuilder = StringBuilder()
|
||||||
|
for (line in lines) {
|
||||||
|
if (firstLine) {
|
||||||
|
val items = line.split(" ")
|
||||||
|
method = items[0]
|
||||||
|
path = items[1]
|
||||||
|
protocol = items[2]
|
||||||
|
firstLine = false
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if (bodyStart) {
|
||||||
|
bodyBuilder.append(line)
|
||||||
|
bodyBuilder.append("\n")
|
||||||
|
}
|
||||||
|
if (line.isEmpty()) {
|
||||||
|
bodyStart = true
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
val keyValue = line.split(": ")
|
||||||
|
if (keyValue.size == 2) {
|
||||||
|
headers[keyValue[0]] = keyValue[1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
body = bodyBuilder.toString().trimEnd()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,43 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.apis
|
||||||
|
|
||||||
|
import io.kotlintest.shouldBe
|
||||||
|
import io.kotlintest.specs.ShouldSpec
|
||||||
|
|
||||||
|
import org.openapitools.client.apis.AuthApi
|
||||||
|
|
||||||
|
class AuthApiTest : ShouldSpec() {
|
||||||
|
init {
|
||||||
|
// uncomment below to create an instance of AuthApi
|
||||||
|
//val apiInstance = AuthApi()
|
||||||
|
|
||||||
|
// to test testAuthHttpBasic
|
||||||
|
should("test testAuthHttpBasic") {
|
||||||
|
// uncomment below to test testAuthHttpBasic
|
||||||
|
//val result : kotlin.String = apiInstance.testAuthHttpBasic()
|
||||||
|
//result shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test testAuthHttpBearer
|
||||||
|
should("test testAuthHttpBearer") {
|
||||||
|
// uncomment below to test testAuthHttpBearer
|
||||||
|
//val result : kotlin.String = apiInstance.testAuthHttpBearer()
|
||||||
|
//result shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,94 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.apis
|
||||||
|
|
||||||
|
import io.kotlintest.shouldBe
|
||||||
|
import io.kotlintest.specs.ShouldSpec
|
||||||
|
|
||||||
|
import org.openapitools.client.apis.BodyApi
|
||||||
|
import org.openapitools.client.models.ApiPet
|
||||||
|
import org.openapitools.client.models.ApiTag
|
||||||
|
|
||||||
|
class BodyApiTest : ShouldSpec() {
|
||||||
|
init {
|
||||||
|
// uncomment below to create an instance of BodyApi
|
||||||
|
//val apiInstance = BodyApi()
|
||||||
|
|
||||||
|
// to test testBinaryGif
|
||||||
|
should("test testBinaryGif") {
|
||||||
|
// uncomment below to test testBinaryGif
|
||||||
|
//val result : java.io.File = apiInstance.testBinaryGif()
|
||||||
|
//result shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test testBodyApplicationOctetstreamBinary
|
||||||
|
should("test testBodyApplicationOctetstreamBinary") {
|
||||||
|
// uncomment below to test testBodyApplicationOctetstreamBinary
|
||||||
|
//val body : java.io.File = BINARY_DATA_HERE // java.io.File |
|
||||||
|
//val result : kotlin.String = apiInstance.testBodyApplicationOctetstreamBinary(body)
|
||||||
|
//result shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test testBodyMultipartFormdataArrayOfBinary
|
||||||
|
should("test testBodyMultipartFormdataArrayOfBinary") {
|
||||||
|
// uncomment below to test testBodyMultipartFormdataArrayOfBinary
|
||||||
|
//val files : kotlin.collections.List<java.io.File> = /path/to/file.txt // kotlin.collections.List<java.io.File> |
|
||||||
|
//val result : kotlin.String = apiInstance.testBodyMultipartFormdataArrayOfBinary(files)
|
||||||
|
//result shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test testBodyMultipartFormdataSingleBinary
|
||||||
|
should("test testBodyMultipartFormdataSingleBinary") {
|
||||||
|
// uncomment below to test testBodyMultipartFormdataSingleBinary
|
||||||
|
//val myFile : java.io.File = BINARY_DATA_HERE // java.io.File |
|
||||||
|
//val result : kotlin.String = apiInstance.testBodyMultipartFormdataSingleBinary(myFile)
|
||||||
|
//result shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test testEchoBodyFreeFormObjectResponseString
|
||||||
|
should("test testEchoBodyFreeFormObjectResponseString") {
|
||||||
|
// uncomment below to test testEchoBodyFreeFormObjectResponseString
|
||||||
|
//val body : kotlin.Any = Object // kotlin.Any | Free form object
|
||||||
|
//val result : kotlin.String = apiInstance.testEchoBodyFreeFormObjectResponseString(body)
|
||||||
|
//result shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test testEchoBodyPet
|
||||||
|
should("test testEchoBodyPet") {
|
||||||
|
// uncomment below to test testEchoBodyPet
|
||||||
|
//val apiPet : ApiPet = // ApiPet | Pet object that needs to be added to the store
|
||||||
|
//val result : ApiPet = apiInstance.testEchoBodyPet(apiPet)
|
||||||
|
//result shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test testEchoBodyPetResponseString
|
||||||
|
should("test testEchoBodyPetResponseString") {
|
||||||
|
// uncomment below to test testEchoBodyPetResponseString
|
||||||
|
//val apiPet : ApiPet = // ApiPet | Pet object that needs to be added to the store
|
||||||
|
//val result : kotlin.String = apiInstance.testEchoBodyPetResponseString(apiPet)
|
||||||
|
//result shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test testEchoBodyTagResponseString
|
||||||
|
should("test testEchoBodyTagResponseString") {
|
||||||
|
// uncomment below to test testEchoBodyTagResponseString
|
||||||
|
//val apiTag : ApiTag = // ApiTag | Tag object
|
||||||
|
//val result : kotlin.String = apiInstance.testEchoBodyTagResponseString(apiTag)
|
||||||
|
//result shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.apis
|
||||||
|
|
||||||
|
import io.kotlintest.shouldBe
|
||||||
|
import io.kotlintest.specs.ShouldSpec
|
||||||
|
|
||||||
|
import org.openapitools.client.apis.FormApi
|
||||||
|
|
||||||
|
class FormApiTest : ShouldSpec() {
|
||||||
|
init {
|
||||||
|
// uncomment below to create an instance of FormApi
|
||||||
|
//val apiInstance = FormApi()
|
||||||
|
|
||||||
|
// to test testFormIntegerBooleanString
|
||||||
|
should("test testFormIntegerBooleanString") {
|
||||||
|
// uncomment below to test testFormIntegerBooleanString
|
||||||
|
//val integerForm : kotlin.Int = 56 // kotlin.Int |
|
||||||
|
//val booleanForm : kotlin.Boolean = true // kotlin.Boolean |
|
||||||
|
//val stringForm : kotlin.String = stringForm_example // kotlin.String |
|
||||||
|
//val result : kotlin.String = apiInstance.testFormIntegerBooleanString(integerForm, booleanForm, stringForm)
|
||||||
|
//result shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test testFormOneof
|
||||||
|
should("test testFormOneof") {
|
||||||
|
// uncomment below to test testFormOneof
|
||||||
|
//val form1 : kotlin.String = form1_example // kotlin.String |
|
||||||
|
//val form2 : kotlin.Int = 56 // kotlin.Int |
|
||||||
|
//val form3 : kotlin.String = form3_example // kotlin.String |
|
||||||
|
//val form4 : kotlin.Boolean = true // kotlin.Boolean |
|
||||||
|
//val id : kotlin.Long = 789 // kotlin.Long |
|
||||||
|
//val name : kotlin.String = name_example // kotlin.String |
|
||||||
|
//val result : kotlin.String = apiInstance.testFormOneof(form1, form2, form3, form4, id, name)
|
||||||
|
//result shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.apis
|
||||||
|
|
||||||
|
import io.kotlintest.shouldBe
|
||||||
|
import io.kotlintest.specs.ShouldSpec
|
||||||
|
|
||||||
|
import org.openapitools.client.apis.HeaderApi
|
||||||
|
import org.openapitools.client.models.ApiStringEnumRef
|
||||||
|
|
||||||
|
class HeaderApiTest : ShouldSpec() {
|
||||||
|
init {
|
||||||
|
// uncomment below to create an instance of HeaderApi
|
||||||
|
//val apiInstance = HeaderApi()
|
||||||
|
|
||||||
|
// to test testHeaderIntegerBooleanStringEnums
|
||||||
|
should("test testHeaderIntegerBooleanStringEnums") {
|
||||||
|
// uncomment below to test testHeaderIntegerBooleanStringEnums
|
||||||
|
//val integerHeader : kotlin.Int = 56 // kotlin.Int |
|
||||||
|
//val booleanHeader : kotlin.Boolean = true // kotlin.Boolean |
|
||||||
|
//val stringHeader : kotlin.String = stringHeader_example // kotlin.String |
|
||||||
|
//val enumNonrefStringHeader : kotlin.String = enumNonrefStringHeader_example // kotlin.String |
|
||||||
|
//val enumRefStringHeader : ApiStringEnumRef = // ApiStringEnumRef |
|
||||||
|
//val result : kotlin.String = apiInstance.testHeaderIntegerBooleanStringEnums(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader)
|
||||||
|
//result shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.apis
|
||||||
|
|
||||||
|
import io.kotlintest.shouldBe
|
||||||
|
import io.kotlintest.specs.ShouldSpec
|
||||||
|
|
||||||
|
import org.openapitools.client.apis.PathApi
|
||||||
|
import org.openapitools.client.models.ApiStringEnumRef
|
||||||
|
|
||||||
|
class PathApiTest : ShouldSpec() {
|
||||||
|
init {
|
||||||
|
// uncomment below to create an instance of PathApi
|
||||||
|
//val apiInstance = PathApi()
|
||||||
|
|
||||||
|
// to test testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath
|
||||||
|
should("test testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath") {
|
||||||
|
// uncomment below to test testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath
|
||||||
|
//val pathString : kotlin.String = pathString_example // kotlin.String |
|
||||||
|
//val pathInteger : kotlin.Int = 56 // kotlin.Int |
|
||||||
|
//val enumNonrefStringPath : kotlin.String = enumNonrefStringPath_example // kotlin.String |
|
||||||
|
//val enumRefStringPath : ApiStringEnumRef = // ApiStringEnumRef |
|
||||||
|
//val result : kotlin.String = apiInstance.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath)
|
||||||
|
//result shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,85 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.apis
|
||||||
|
|
||||||
|
import io.kotlintest.shouldBe
|
||||||
|
import io.kotlintest.specs.ShouldSpec
|
||||||
|
|
||||||
|
import org.openapitools.client.apis.QueryApi
|
||||||
|
import org.openapitools.client.models.ApiPet
|
||||||
|
import org.openapitools.client.models.ApiStringEnumRef
|
||||||
|
import org.openapitools.client.models.ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||||
|
|
||||||
|
class QueryApiTest : ShouldSpec() {
|
||||||
|
init {
|
||||||
|
// uncomment below to create an instance of QueryApi
|
||||||
|
//val apiInstance = QueryApi()
|
||||||
|
|
||||||
|
// to test testEnumRefString
|
||||||
|
should("test testEnumRefString") {
|
||||||
|
// uncomment below to test testEnumRefString
|
||||||
|
//val enumNonrefStringQuery : kotlin.String = enumNonrefStringQuery_example // kotlin.String |
|
||||||
|
//val enumRefStringQuery : ApiStringEnumRef = // ApiStringEnumRef |
|
||||||
|
//val result : kotlin.String = apiInstance.testEnumRefString(enumNonrefStringQuery, enumRefStringQuery)
|
||||||
|
//result shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test testQueryDatetimeDateString
|
||||||
|
should("test testQueryDatetimeDateString") {
|
||||||
|
// uncomment below to test testQueryDatetimeDateString
|
||||||
|
//val datetimeQuery : java.time.OffsetDateTime = 2013-10-20T19:20:30+01:00 // java.time.OffsetDateTime |
|
||||||
|
//val dateQuery : java.time.LocalDate = 2013-10-20 // java.time.LocalDate |
|
||||||
|
//val stringQuery : kotlin.String = stringQuery_example // kotlin.String |
|
||||||
|
//val result : kotlin.String = apiInstance.testQueryDatetimeDateString(datetimeQuery, dateQuery, stringQuery)
|
||||||
|
//result shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test testQueryIntegerBooleanString
|
||||||
|
should("test testQueryIntegerBooleanString") {
|
||||||
|
// uncomment below to test testQueryIntegerBooleanString
|
||||||
|
//val integerQuery : kotlin.Int = 56 // kotlin.Int |
|
||||||
|
//val booleanQuery : kotlin.Boolean = true // kotlin.Boolean |
|
||||||
|
//val stringQuery : kotlin.String = stringQuery_example // kotlin.String |
|
||||||
|
//val result : kotlin.String = apiInstance.testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery)
|
||||||
|
//result shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test testQueryStyleDeepObjectExplodeTrueObject
|
||||||
|
should("test testQueryStyleDeepObjectExplodeTrueObject") {
|
||||||
|
// uncomment below to test testQueryStyleDeepObjectExplodeTrueObject
|
||||||
|
//val queryObject : ApiPet = // ApiPet |
|
||||||
|
//val result : kotlin.String = apiInstance.testQueryStyleDeepObjectExplodeTrueObject(queryObject)
|
||||||
|
//result shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test testQueryStyleFormExplodeTrueArrayString
|
||||||
|
should("test testQueryStyleFormExplodeTrueArrayString") {
|
||||||
|
// uncomment below to test testQueryStyleFormExplodeTrueArrayString
|
||||||
|
//val queryObject : ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter = // ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter |
|
||||||
|
//val result : kotlin.String = apiInstance.testQueryStyleFormExplodeTrueArrayString(queryObject)
|
||||||
|
//result shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test testQueryStyleFormExplodeTrueObject
|
||||||
|
should("test testQueryStyleFormExplodeTrueObject") {
|
||||||
|
// uncomment below to test testQueryStyleFormExplodeTrueObject
|
||||||
|
//val queryObject : ApiPet = // ApiPet |
|
||||||
|
//val result : kotlin.String = apiInstance.testQueryStyleFormExplodeTrueObject(queryObject)
|
||||||
|
//result shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.models
|
||||||
|
|
||||||
|
import io.kotlintest.shouldBe
|
||||||
|
import io.kotlintest.specs.ShouldSpec
|
||||||
|
|
||||||
|
import org.openapitools.client.models.ApiBird
|
||||||
|
|
||||||
|
class ApiBirdTest : ShouldSpec() {
|
||||||
|
init {
|
||||||
|
// uncomment below to create an instance of ApiBird
|
||||||
|
//val modelInstance = ApiBird()
|
||||||
|
|
||||||
|
// to test the property `propertySize`
|
||||||
|
should("test propertySize") {
|
||||||
|
// uncomment below to test the property
|
||||||
|
//modelInstance.propertySize shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test the property `color`
|
||||||
|
should("test color") {
|
||||||
|
// uncomment below to test the property
|
||||||
|
//modelInstance.color shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.models
|
||||||
|
|
||||||
|
import io.kotlintest.shouldBe
|
||||||
|
import io.kotlintest.specs.ShouldSpec
|
||||||
|
|
||||||
|
import org.openapitools.client.models.ApiCategory
|
||||||
|
|
||||||
|
class ApiCategoryTest : ShouldSpec() {
|
||||||
|
init {
|
||||||
|
// uncomment below to create an instance of ApiCategory
|
||||||
|
//val modelInstance = ApiCategory()
|
||||||
|
|
||||||
|
// to test the property `id`
|
||||||
|
should("test id") {
|
||||||
|
// uncomment below to test the property
|
||||||
|
//modelInstance.id shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test the property `name`
|
||||||
|
should("test name") {
|
||||||
|
// uncomment below to test the property
|
||||||
|
//modelInstance.name shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,78 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.models
|
||||||
|
|
||||||
|
import io.kotlintest.shouldBe
|
||||||
|
import io.kotlintest.specs.ShouldSpec
|
||||||
|
|
||||||
|
import org.openapitools.client.models.ApiDefaultValue
|
||||||
|
import org.openapitools.client.models.ApiStringEnumRef
|
||||||
|
|
||||||
|
class ApiDefaultValueTest : ShouldSpec() {
|
||||||
|
init {
|
||||||
|
// uncomment below to create an instance of ApiDefaultValue
|
||||||
|
//val modelInstance = ApiDefaultValue()
|
||||||
|
|
||||||
|
// to test the property `arrayStringEnumRefDefault`
|
||||||
|
should("test arrayStringEnumRefDefault") {
|
||||||
|
// uncomment below to test the property
|
||||||
|
//modelInstance.arrayStringEnumRefDefault shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test the property `arrayStringEnumDefault`
|
||||||
|
should("test arrayStringEnumDefault") {
|
||||||
|
// uncomment below to test the property
|
||||||
|
//modelInstance.arrayStringEnumDefault shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test the property `arrayStringDefault`
|
||||||
|
should("test arrayStringDefault") {
|
||||||
|
// uncomment below to test the property
|
||||||
|
//modelInstance.arrayStringDefault shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test the property `arrayIntegerDefault`
|
||||||
|
should("test arrayIntegerDefault") {
|
||||||
|
// uncomment below to test the property
|
||||||
|
//modelInstance.arrayIntegerDefault shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test the property `arrayString`
|
||||||
|
should("test arrayString") {
|
||||||
|
// uncomment below to test the property
|
||||||
|
//modelInstance.arrayString shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test the property `arrayStringNullable`
|
||||||
|
should("test arrayStringNullable") {
|
||||||
|
// uncomment below to test the property
|
||||||
|
//modelInstance.arrayStringNullable shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test the property `arrayStringExtensionNullable`
|
||||||
|
should("test arrayStringExtensionNullable") {
|
||||||
|
// uncomment below to test the property
|
||||||
|
//modelInstance.arrayStringExtensionNullable shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test the property `stringNullable`
|
||||||
|
should("test stringNullable") {
|
||||||
|
// uncomment below to test the property
|
||||||
|
//modelInstance.stringNullable shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.models
|
||||||
|
|
||||||
|
import io.kotlintest.shouldBe
|
||||||
|
import io.kotlintest.specs.ShouldSpec
|
||||||
|
|
||||||
|
import org.openapitools.client.models.ApiNumberPropertiesOnly
|
||||||
|
|
||||||
|
class ApiNumberPropertiesOnlyTest : ShouldSpec() {
|
||||||
|
init {
|
||||||
|
// uncomment below to create an instance of ApiNumberPropertiesOnly
|
||||||
|
//val modelInstance = ApiNumberPropertiesOnly()
|
||||||
|
|
||||||
|
// to test the property `number`
|
||||||
|
should("test number") {
|
||||||
|
// uncomment below to test the property
|
||||||
|
//modelInstance.number shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test the property `float`
|
||||||
|
should("test float") {
|
||||||
|
// uncomment below to test the property
|
||||||
|
//modelInstance.float shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test the property `double`
|
||||||
|
should("test double") {
|
||||||
|
// uncomment below to test the property
|
||||||
|
//modelInstance.double shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,67 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.models
|
||||||
|
|
||||||
|
import io.kotlintest.shouldBe
|
||||||
|
import io.kotlintest.specs.ShouldSpec
|
||||||
|
|
||||||
|
import org.openapitools.client.models.ApiPet
|
||||||
|
import org.openapitools.client.models.ApiCategory
|
||||||
|
import org.openapitools.client.models.ApiTag
|
||||||
|
|
||||||
|
class ApiPetTest : ShouldSpec() {
|
||||||
|
init {
|
||||||
|
// uncomment below to create an instance of ApiPet
|
||||||
|
//val modelInstance = ApiPet()
|
||||||
|
|
||||||
|
// to test the property `name`
|
||||||
|
should("test name") {
|
||||||
|
// uncomment below to test the property
|
||||||
|
//modelInstance.name shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test the property `photoUrls`
|
||||||
|
should("test photoUrls") {
|
||||||
|
// uncomment below to test the property
|
||||||
|
//modelInstance.photoUrls shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test the property `id`
|
||||||
|
should("test id") {
|
||||||
|
// uncomment below to test the property
|
||||||
|
//modelInstance.id shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test the property `category`
|
||||||
|
should("test category") {
|
||||||
|
// uncomment below to test the property
|
||||||
|
//modelInstance.category shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test the property `tags`
|
||||||
|
should("test tags") {
|
||||||
|
// uncomment below to test the property
|
||||||
|
//modelInstance.tags shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test the property `status` - pet status in the store
|
||||||
|
should("test status") {
|
||||||
|
// uncomment below to test the property
|
||||||
|
//modelInstance.status shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.models
|
||||||
|
|
||||||
|
import io.kotlintest.shouldBe
|
||||||
|
import io.kotlintest.specs.ShouldSpec
|
||||||
|
|
||||||
|
import org.openapitools.client.models.ApiQuery
|
||||||
|
|
||||||
|
class ApiQueryTest : ShouldSpec() {
|
||||||
|
init {
|
||||||
|
// uncomment below to create an instance of ApiQuery
|
||||||
|
//val modelInstance = ApiQuery()
|
||||||
|
|
||||||
|
// to test the property `id` - Query
|
||||||
|
should("test id") {
|
||||||
|
// uncomment below to test the property
|
||||||
|
//modelInstance.id shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test the property `outcomes`
|
||||||
|
should("test outcomes") {
|
||||||
|
// uncomment below to test the property
|
||||||
|
//modelInstance.outcomes shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.models
|
||||||
|
|
||||||
|
import io.kotlintest.shouldBe
|
||||||
|
import io.kotlintest.specs.ShouldSpec
|
||||||
|
|
||||||
|
import org.openapitools.client.models.ApiStringEnumRef
|
||||||
|
|
||||||
|
class ApiStringEnumRefTest : ShouldSpec() {
|
||||||
|
init {
|
||||||
|
// uncomment below to create an instance of ApiStringEnumRef
|
||||||
|
//val modelInstance = ApiStringEnumRef()
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.models
|
||||||
|
|
||||||
|
import io.kotlintest.shouldBe
|
||||||
|
import io.kotlintest.specs.ShouldSpec
|
||||||
|
|
||||||
|
import org.openapitools.client.models.ApiTag
|
||||||
|
|
||||||
|
class ApiTagTest : ShouldSpec() {
|
||||||
|
init {
|
||||||
|
// uncomment below to create an instance of ApiTag
|
||||||
|
//val modelInstance = ApiTag()
|
||||||
|
|
||||||
|
// to test the property `id`
|
||||||
|
should("test id") {
|
||||||
|
// uncomment below to test the property
|
||||||
|
//modelInstance.id shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
// to test the property `name`
|
||||||
|
should("test name") {
|
||||||
|
// uncomment below to test the property
|
||||||
|
//modelInstance.name shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Please note:
|
||||||
|
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* Do not edit this file manually.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress(
|
||||||
|
"ArrayInDataClass",
|
||||||
|
"EnumEntryName",
|
||||||
|
"RemoveRedundantQualifierName",
|
||||||
|
"UnusedImport"
|
||||||
|
)
|
||||||
|
|
||||||
|
package org.openapitools.client.models
|
||||||
|
|
||||||
|
import io.kotlintest.shouldBe
|
||||||
|
import io.kotlintest.specs.ShouldSpec
|
||||||
|
|
||||||
|
import org.openapitools.client.models.ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||||
|
|
||||||
|
class ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTest : ShouldSpec() {
|
||||||
|
init {
|
||||||
|
// uncomment below to create an instance of ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||||
|
//val modelInstance = ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter()
|
||||||
|
|
||||||
|
// to test the property `propertyValues`
|
||||||
|
should("test propertyValues") {
|
||||||
|
// uncomment below to test the property
|
||||||
|
//modelInstance.propertyValues shouldBe ("TODO")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user