forked from loafle/openapi-generator-original
Fix Retrofit template with Jackson for Kotlin (#14239)
* Fix Retrofit template with Jackson (Fix #8147) This commit amends the `ApiClient` template for Retrofit. It fixes a bug where the Retrofit client uses Jackson as the serialization library. Until now, the `ApiClient` could not be compiled when using the Jackson library (default in SpringBoot applications), as the constructor of the class had the following parameter: `private val serializerBuilder: Builder = Serializer.Builder,` The change done in the commit, is to ensure that in case of Jackson, the right property of the `Serializer` class is assigned * Add sample code for `kotlin-jvm-jackson` This commit adds a sample code for the `kotlin-jvm-jackson` generated code to test the changes on CI * Update kotlin code samples for CI This commit only runs the command `bin/generate-samples.sh bin/configs/kotlin-*` to ensure that all code samples are up-to-date and CI can pass successfully.
This commit is contained in:
parent
2ef888845d
commit
83af019603
1
.github/workflows/samples-kotlin-client.yaml
vendored
1
.github/workflows/samples-kotlin-client.yaml
vendored
@ -51,6 +51,7 @@ jobs:
|
|||||||
- samples/client/petstore/kotlin-array-simple-string-multiplatform
|
- samples/client/petstore/kotlin-array-simple-string-multiplatform
|
||||||
- samples/client/petstore/kotlin-bigdecimal-default-multiplatform
|
- samples/client/petstore/kotlin-bigdecimal-default-multiplatform
|
||||||
- samples/client/petstore/kotlin-bigdecimal-default-okhttp4
|
- samples/client/petstore/kotlin-bigdecimal-default-okhttp4
|
||||||
|
- samples/client/petstore/kotlin-jvm-jackson
|
||||||
- samples/client/petstore/kotlin-jvm-ktor-jackson
|
- samples/client/petstore/kotlin-jvm-ktor-jackson
|
||||||
- samples/client/petstore/kotlin-jvm-ktor-gson
|
- samples/client/petstore/kotlin-jvm-ktor-gson
|
||||||
- samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization
|
- samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization
|
||||||
|
9
bin/configs/kotlin-jvm-jackson.yaml
Normal file
9
bin/configs/kotlin-jvm-jackson.yaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
generatorName: kotlin
|
||||||
|
outputDir: samples/client/petstore/kotlin-jvm-jackson
|
||||||
|
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||||
|
templateDir: modules/openapi-generator/src/main/resources/kotlin-client
|
||||||
|
additionalProperties:
|
||||||
|
artifactId: kotlin-petstore-jvm-jackson
|
||||||
|
enumUnknownDefaultCase: true
|
||||||
|
serializationLibrary: jackson
|
||||||
|
library: jvm-retrofit2
|
@ -49,6 +49,9 @@ import retrofit2.converter.gson.GsonConverterFactory
|
|||||||
import com.squareup.moshi.Moshi
|
import com.squareup.moshi.Moshi
|
||||||
import retrofit2.converter.moshi.MoshiConverterFactory
|
import retrofit2.converter.moshi.MoshiConverterFactory
|
||||||
{{/moshi}}
|
{{/moshi}}
|
||||||
|
{{#jackson}}
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper
|
||||||
|
{{/jackson}}
|
||||||
|
|
||||||
{{#kotlinx_serialization}}
|
{{#kotlinx_serialization}}
|
||||||
import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory
|
import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory
|
||||||
@ -59,7 +62,7 @@ import okhttp3.MediaType.Companion.toMediaType
|
|||||||
{{#nonPublicApi}}internal {{/nonPublicApi}}class ApiClient(
|
{{#nonPublicApi}}internal {{/nonPublicApi}}class ApiClient(
|
||||||
private var baseUrl: String = defaultBasePath,
|
private var baseUrl: String = defaultBasePath,
|
||||||
private val okHttpClientBuilder: OkHttpClient.Builder? = null{{^kotlinx_serialization}},
|
private val okHttpClientBuilder: OkHttpClient.Builder? = null{{^kotlinx_serialization}},
|
||||||
private val serializerBuilder: {{#gson}}Gson{{/gson}}{{#moshi}}Moshi.{{/moshi}}Builder = Serializer.{{#gson}}gson{{/gson}}{{#moshi}}moshi{{/moshi}}Builder{{/kotlinx_serialization}},
|
private val serializerBuilder: {{#gson}}GsonBuilder{{/gson}}{{#moshi}}Moshi.Builder{{/moshi}}{{#jackson}}ObjectMapper{{/jackson}} = Serializer.{{#gson}}gsonBuilder{{/gson}}{{#moshi}}moshiBuilder{{/moshi}}{{#jackson}}jacksonObjectMapper{{/jackson}},{{/kotlinx_serialization}}
|
||||||
private val callFactory : Call.Factory? = null,
|
private val callFactory : Call.Factory? = null,
|
||||||
private val callAdapterFactories: List<CallAdapter.Factory> = listOf(
|
private val callAdapterFactories: List<CallAdapter.Factory> = listOf(
|
||||||
{{#useRxJava}}
|
{{#useRxJava}}
|
||||||
@ -123,7 +126,7 @@ import okhttp3.MediaType.Companion.toMediaType
|
|||||||
constructor(
|
constructor(
|
||||||
baseUrl: String = defaultBasePath,
|
baseUrl: String = defaultBasePath,
|
||||||
okHttpClientBuilder: OkHttpClient.Builder? = null,
|
okHttpClientBuilder: OkHttpClient.Builder? = null,
|
||||||
{{^kotlinx_serialization}}serializerBuilder: {{#gson}}Gson{{/gson}}{{#moshi}}Moshi.{{/moshi}}Builder = Serializer.{{#gson}}gson{{/gson}}{{#moshi}}moshi{{/moshi}}Builder,{{/kotlinx_serialization}}
|
{{^kotlinx_serialization}}serializerBuilder: {{#gson}}GsonBuilder{{/gson}}{{#moshi}}Moshi.Builder{{/moshi}}{{#jackson}}ObjectMapper{{/jackson}} = Serializer.{{#gson}}gsonBuilder{{/gson}}{{#moshi}}moshiBuilder{{/moshi}}{{#jackson}}jacksonObjectMapper{{/jackson}},{{/kotlinx_serialization}}
|
||||||
authNames: Array<String>
|
authNames: Array<String>
|
||||||
) : this(baseUrl, okHttpClientBuilder{{^kotlinx_serialization}}, serializerBuilder{{/kotlinx_serialization}}) {
|
) : this(baseUrl, okHttpClientBuilder{{^kotlinx_serialization}}, serializerBuilder{{/kotlinx_serialization}}) {
|
||||||
authNames.forEach { authName ->
|
authNames.forEach { authName ->
|
||||||
@ -147,7 +150,7 @@ import okhttp3.MediaType.Companion.toMediaType
|
|||||||
constructor(
|
constructor(
|
||||||
baseUrl: String = defaultBasePath,
|
baseUrl: String = defaultBasePath,
|
||||||
okHttpClientBuilder: OkHttpClient.Builder? = null,
|
okHttpClientBuilder: OkHttpClient.Builder? = null,
|
||||||
{{^kotlinx_serialization}}serializerBuilder: {{#gson}}Gson{{/gson}}{{#moshi}}Moshi.{{/moshi}}Builder = Serializer.{{#gson}}gson{{/gson}}{{#moshi}}moshi{{/moshi}}Builder,{{/kotlinx_serialization}}
|
{{^kotlinx_serialization}}serializerBuilder: {{#gson}}GsonBuilder{{/gson}}{{#moshi}}Moshi.Builder{{/moshi}}{{#jackson}}ObjectMapper{{/jackson}} = Serializer.{{#gson}}gsonBuilder{{/gson}}{{#moshi}}moshiBuilder{{/moshi}}{{#jackson}}jacksonObjectMapper{{/jackson}},{{/kotlinx_serialization}}
|
||||||
authName: String,
|
authName: String,
|
||||||
username: String,
|
username: String,
|
||||||
password: String
|
password: String
|
||||||
@ -160,7 +163,7 @@ import okhttp3.MediaType.Companion.toMediaType
|
|||||||
constructor(
|
constructor(
|
||||||
baseUrl: String = defaultBasePath,
|
baseUrl: String = defaultBasePath,
|
||||||
okHttpClientBuilder: OkHttpClient.Builder? = null,
|
okHttpClientBuilder: OkHttpClient.Builder? = null,
|
||||||
{{^kotlinx_serialization}}serializerBuilder: {{#gson}}Gson{{/gson}}{{#moshi}}Moshi.{{/moshi}}Builder = Serializer.{{#gson}}gson{{/gson}}{{#moshi}}moshi{{/moshi}}Builder,{{/kotlinx_serialization}}
|
{{^kotlinx_serialization}}serializerBuilder: {{#gson}}GsonBuilder{{/gson}}{{#moshi}}Moshi.Builder{{/moshi}}{{#jackson}}ObjectMapper{{/jackson}} = Serializer.{{#gson}}gsonBuilder{{/gson}}{{#moshi}}moshiBuilder{{/moshi}}{{#jackson}}jacksonObjectMapper{{/jackson}},{{/kotlinx_serialization}}
|
||||||
authName: String,
|
authName: String,
|
||||||
bearerToken: String
|
bearerToken: String
|
||||||
) : this(baseUrl, okHttpClientBuilder, {{^kotlinx_serialization}}serializerBuilder, {{/kotlinx_serialization}}arrayOf(authName)) {
|
) : this(baseUrl, okHttpClientBuilder, {{^kotlinx_serialization}}serializerBuilder, {{/kotlinx_serialization}}arrayOf(authName)) {
|
||||||
@ -174,7 +177,7 @@ import okhttp3.MediaType.Companion.toMediaType
|
|||||||
constructor(
|
constructor(
|
||||||
baseUrl: String = defaultBasePath,
|
baseUrl: String = defaultBasePath,
|
||||||
okHttpClientBuilder: OkHttpClient.Builder? = null,
|
okHttpClientBuilder: OkHttpClient.Builder? = null,
|
||||||
{{^kotlinx_serialization}}serializerBuilder: {{#gson}}Gson{{/gson}}{{#moshi}}Moshi.{{/moshi}}Builder = Serializer.{{#gson}}gson{{/gson}}{{#moshi}}moshi{{/moshi}}Builder,{{/kotlinx_serialization}}
|
{{^kotlinx_serialization}}serializerBuilder: {{#gson}}GsonBuilder{{/gson}}{{#moshi}}Moshi.Builder{{/moshi}}{{#jackson}}ObjectMapper{{/jackson}} = Serializer.{{#gson}}gsonBuilder{{/gson}}{{#moshi}}moshiBuilder{{/moshi}}{{#jackson}}jacksonObjectMapper{{/jackson}},{{/kotlinx_serialization}}
|
||||||
authName: String,
|
authName: String,
|
||||||
clientId: String,
|
clientId: String,
|
||||||
secret: String,
|
secret: String,
|
||||||
|
@ -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,33 @@
|
|||||||
|
README.md
|
||||||
|
build.gradle
|
||||||
|
docs/ApiResponse.md
|
||||||
|
docs/Category.md
|
||||||
|
docs/Order.md
|
||||||
|
docs/Pet.md
|
||||||
|
docs/PetApi.md
|
||||||
|
docs/StoreApi.md
|
||||||
|
docs/Tag.md
|
||||||
|
docs/User.md
|
||||||
|
docs/UserApi.md
|
||||||
|
gradle/wrapper/gradle-wrapper.jar
|
||||||
|
gradle/wrapper/gradle-wrapper.properties
|
||||||
|
gradlew
|
||||||
|
gradlew.bat
|
||||||
|
settings.gradle
|
||||||
|
src/main/kotlin/org/openapitools/client/apis/PetApi.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/apis/StoreApi.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/apis/UserApi.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/auth/ApiKeyAuth.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/auth/OAuth.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/auth/OAuthFlow.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/auth/OAuthOkHttpClient.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/infrastructure/CollectionFormats.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/infrastructure/ResponseExt.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/models/Category.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/models/Order.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/models/Pet.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/models/Tag.kt
|
||||||
|
src/main/kotlin/org/openapitools/client/models/User.kt
|
@ -0,0 +1 @@
|
|||||||
|
7.0.0-SNAPSHOT
|
101
samples/client/petstore/kotlin-jvm-jackson/README.md
Normal file
101
samples/client/petstore/kotlin-jvm-jackson/README.md
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
# org.openapitools.client - Kotlin client library for OpenAPI Petstore
|
||||||
|
|
||||||
|
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
|
|
||||||
|
## 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: 1.0.0
|
||||||
|
- Package version:
|
||||||
|
- 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://petstore.swagger.io/v2*
|
||||||
|
|
||||||
|
Class | Method | HTTP request | Description
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
*PetApi* | [**addPet**](docs/PetApi.md#addpet) | **POST** pet | Add a new pet to the store
|
||||||
|
*PetApi* | [**deletePet**](docs/PetApi.md#deletepet) | **DELETE** pet/{petId} | Deletes a pet
|
||||||
|
*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** pet/findByStatus | Finds Pets by status
|
||||||
|
*PetApi* | [**findPetsByTags**](docs/PetApi.md#findpetsbytags) | **GET** pet/findByTags | Finds Pets by tags
|
||||||
|
*PetApi* | [**getPetById**](docs/PetApi.md#getpetbyid) | **GET** pet/{petId} | Find pet by ID
|
||||||
|
*PetApi* | [**updatePet**](docs/PetApi.md#updatepet) | **PUT** pet | Update an existing pet
|
||||||
|
*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** pet/{petId} | Updates a pet in the store with form data
|
||||||
|
*PetApi* | [**uploadFile**](docs/PetApi.md#uploadfile) | **POST** pet/{petId}/uploadImage | uploads an image
|
||||||
|
*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** store/order/{orderId} | Delete purchase order by ID
|
||||||
|
*StoreApi* | [**getInventory**](docs/StoreApi.md#getinventory) | **GET** store/inventory | Returns pet inventories by status
|
||||||
|
*StoreApi* | [**getOrderById**](docs/StoreApi.md#getorderbyid) | **GET** store/order/{orderId} | Find purchase order by ID
|
||||||
|
*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeorder) | **POST** store/order | Place an order for a pet
|
||||||
|
*UserApi* | [**createUser**](docs/UserApi.md#createuser) | **POST** user | Create user
|
||||||
|
*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **POST** user/createWithArray | Creates list of users with given input array
|
||||||
|
*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **POST** user/createWithList | Creates list of users with given input array
|
||||||
|
*UserApi* | [**deleteUser**](docs/UserApi.md#deleteuser) | **DELETE** user/{username} | Delete user
|
||||||
|
*UserApi* | [**getUserByName**](docs/UserApi.md#getuserbyname) | **GET** user/{username} | Get user by user name
|
||||||
|
*UserApi* | [**loginUser**](docs/UserApi.md#loginuser) | **GET** user/login | Logs user into the system
|
||||||
|
*UserApi* | [**logoutUser**](docs/UserApi.md#logoutuser) | **GET** user/logout | Logs out current logged in user session
|
||||||
|
*UserApi* | [**updateUser**](docs/UserApi.md#updateuser) | **PUT** user/{username} | Updated user
|
||||||
|
|
||||||
|
|
||||||
|
<a id="documentation-for-models"></a>
|
||||||
|
## Documentation for Models
|
||||||
|
|
||||||
|
- [org.openapitools.client.models.Category](docs/Category.md)
|
||||||
|
- [org.openapitools.client.models.ModelApiResponse](docs/ModelApiResponse.md)
|
||||||
|
- [org.openapitools.client.models.Order](docs/Order.md)
|
||||||
|
- [org.openapitools.client.models.Pet](docs/Pet.md)
|
||||||
|
- [org.openapitools.client.models.Tag](docs/Tag.md)
|
||||||
|
- [org.openapitools.client.models.User](docs/User.md)
|
||||||
|
|
||||||
|
|
||||||
|
<a id="documentation-for-authorization"></a>
|
||||||
|
## Documentation for Authorization
|
||||||
|
|
||||||
|
|
||||||
|
Authentication schemes defined for the API:
|
||||||
|
<a id="petstore_auth"></a>
|
||||||
|
### petstore_auth
|
||||||
|
|
||||||
|
- **Type**: OAuth
|
||||||
|
- **Flow**: implicit
|
||||||
|
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
|
||||||
|
- **Scopes**:
|
||||||
|
- write:pets: modify pets in your account
|
||||||
|
- read:pets: read your pets
|
||||||
|
|
||||||
|
<a id="api_key"></a>
|
||||||
|
### api_key
|
||||||
|
|
||||||
|
- **Type**: API key
|
||||||
|
- **API key parameter name**: api_key
|
||||||
|
- **Location**: HTTP header
|
||||||
|
|
42
samples/client/petstore/kotlin-jvm-jackson/build.gradle
Normal file
42
samples/client/petstore/kotlin-jvm-jackson/build.gradle
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
group 'org.openapitools'
|
||||||
|
version '1.0.0'
|
||||||
|
|
||||||
|
wrapper {
|
||||||
|
gradleVersion = '7.5'
|
||||||
|
distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
|
||||||
|
}
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
ext.kotlin_version = '1.8.10'
|
||||||
|
ext.retrofitVersion = '2.9.0'
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven { url "https://repo1.maven.org/maven2" }
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: 'kotlin'
|
||||||
|
apply plugin: 'maven-publish'
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven { url "https://repo1.maven.org/maven2" }
|
||||||
|
}
|
||||||
|
|
||||||
|
test {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||||
|
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||||
|
implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.14.3"
|
||||||
|
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.14.3"
|
||||||
|
implementation "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.2"
|
||||||
|
implementation "com.squareup.okhttp3:logging-interceptor:4.10.0"
|
||||||
|
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
|
||||||
|
implementation "com.squareup.retrofit2:converter-scalars:$retrofitVersion"
|
||||||
|
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
# ModelApiResponse
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**code** | **kotlin.Int** | | [optional]
|
||||||
|
**type** | **kotlin.String** | | [optional]
|
||||||
|
**message** | **kotlin.String** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
11
samples/client/petstore/kotlin-jvm-jackson/docs/Category.md
Normal file
11
samples/client/petstore/kotlin-jvm-jackson/docs/Category.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
# Category
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**id** | **kotlin.Long** | | [optional]
|
||||||
|
**name** | **kotlin.String** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
22
samples/client/petstore/kotlin-jvm-jackson/docs/Order.md
Normal file
22
samples/client/petstore/kotlin-jvm-jackson/docs/Order.md
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
# Order
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**id** | **kotlin.Long** | | [optional]
|
||||||
|
**petId** | **kotlin.Long** | | [optional]
|
||||||
|
**quantity** | **kotlin.Int** | | [optional]
|
||||||
|
**shipDate** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional]
|
||||||
|
**status** | [**inline**](#Status) | Order Status | [optional]
|
||||||
|
**complete** | **kotlin.Boolean** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
<a id="Status"></a>
|
||||||
|
## Enum: status
|
||||||
|
Name | Value
|
||||||
|
---- | -----
|
||||||
|
status | placed, approved, delivered
|
||||||
|
|
||||||
|
|
||||||
|
|
22
samples/client/petstore/kotlin-jvm-jackson/docs/Pet.md
Normal file
22
samples/client/petstore/kotlin-jvm-jackson/docs/Pet.md
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
# Pet
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**name** | **kotlin.String** | |
|
||||||
|
**photoUrls** | **kotlin.collections.List<kotlin.String>** | |
|
||||||
|
**id** | **kotlin.Long** | | [optional]
|
||||||
|
**category** | [**Category**](Category.md) | | [optional]
|
||||||
|
**tags** | [**kotlin.collections.List<Tag>**](Tag.md) | | [optional]
|
||||||
|
**status** | [**inline**](#Status) | pet status in the store | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
<a id="Status"></a>
|
||||||
|
## Enum: status
|
||||||
|
Name | Value
|
||||||
|
---- | -----
|
||||||
|
status | available, pending, sold
|
||||||
|
|
||||||
|
|
||||||
|
|
330
samples/client/petstore/kotlin-jvm-jackson/docs/PetApi.md
Normal file
330
samples/client/petstore/kotlin-jvm-jackson/docs/PetApi.md
Normal file
@ -0,0 +1,330 @@
|
|||||||
|
# PetApi
|
||||||
|
|
||||||
|
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||||
|
|
||||||
|
Method | HTTP request | Description
|
||||||
|
------------- | ------------- | -------------
|
||||||
|
[**addPet**](PetApi.md#addPet) | **POST** pet | Add a new pet to the store
|
||||||
|
[**deletePet**](PetApi.md#deletePet) | **DELETE** pet/{petId} | Deletes a pet
|
||||||
|
[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** pet/findByStatus | Finds Pets by status
|
||||||
|
[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** pet/findByTags | Finds Pets by tags
|
||||||
|
[**getPetById**](PetApi.md#getPetById) | **GET** pet/{petId} | Find pet by ID
|
||||||
|
[**updatePet**](PetApi.md#updatePet) | **PUT** pet | Update an existing pet
|
||||||
|
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** pet/{petId} | Updates a pet in the store with form data
|
||||||
|
[**uploadFile**](PetApi.md#uploadFile) | **POST** pet/{petId}/uploadImage | uploads an image
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Add a new pet to the store
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.*
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiClient = ApiClient()
|
||||||
|
val webService = apiClient.createWebservice(PetApi::class.java)
|
||||||
|
val pet : Pet = // Pet | Pet object that needs to be added to the store
|
||||||
|
|
||||||
|
val result : Pet = webService.addPet(pet)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**Pet**](Pet.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json, application/xml
|
||||||
|
- **Accept**: application/xml, application/json
|
||||||
|
|
||||||
|
|
||||||
|
Deletes a pet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.*
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiClient = ApiClient()
|
||||||
|
val webService = apiClient.createWebservice(PetApi::class.java)
|
||||||
|
val petId : kotlin.Long = 789 // kotlin.Long | Pet id to delete
|
||||||
|
val apiKey : kotlin.String = apiKey_example // kotlin.String |
|
||||||
|
|
||||||
|
webService.deletePet(petId, apiKey)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**petId** | **kotlin.Long**| Pet id to delete |
|
||||||
|
**apiKey** | **kotlin.String**| | [optional]
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
null (empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
|
||||||
|
Finds Pets by status
|
||||||
|
|
||||||
|
Multiple status values can be provided with comma separated strings
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.*
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiClient = ApiClient()
|
||||||
|
val webService = apiClient.createWebservice(PetApi::class.java)
|
||||||
|
val status : kotlin.collections.List<kotlin.String> = // kotlin.collections.List<kotlin.String> | Status values that need to be considered for filter
|
||||||
|
|
||||||
|
val result : kotlin.collections.List<Pet> = webService.findPetsByStatus(status)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**status** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Status values that need to be considered for filter | [enum: available, pending, sold]
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**kotlin.collections.List<Pet>**](Pet.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: application/xml, application/json
|
||||||
|
|
||||||
|
|
||||||
|
Finds Pets by tags
|
||||||
|
|
||||||
|
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.*
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiClient = ApiClient()
|
||||||
|
val webService = apiClient.createWebservice(PetApi::class.java)
|
||||||
|
val tags : kotlin.collections.List<kotlin.String> = // kotlin.collections.List<kotlin.String> | Tags to filter by
|
||||||
|
|
||||||
|
val result : kotlin.collections.List<Pet> = webService.findPetsByTags(tags)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**tags** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Tags to filter by |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**kotlin.collections.List<Pet>**](Pet.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: application/xml, application/json
|
||||||
|
|
||||||
|
|
||||||
|
Find pet by ID
|
||||||
|
|
||||||
|
Returns a single pet
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.*
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiClient = ApiClient()
|
||||||
|
val webService = apiClient.createWebservice(PetApi::class.java)
|
||||||
|
val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to return
|
||||||
|
|
||||||
|
val result : Pet = webService.getPetById(petId)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**petId** | **kotlin.Long**| ID of pet to return |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**Pet**](Pet.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: application/xml, application/json
|
||||||
|
|
||||||
|
|
||||||
|
Update an existing pet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.*
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiClient = ApiClient()
|
||||||
|
val webService = apiClient.createWebservice(PetApi::class.java)
|
||||||
|
val pet : Pet = // Pet | Pet object that needs to be added to the store
|
||||||
|
|
||||||
|
val result : Pet = webService.updatePet(pet)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**Pet**](Pet.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json, application/xml
|
||||||
|
- **Accept**: application/xml, application/json
|
||||||
|
|
||||||
|
|
||||||
|
Updates a pet in the store with form data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.*
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiClient = ApiClient()
|
||||||
|
val webService = apiClient.createWebservice(PetApi::class.java)
|
||||||
|
val petId : kotlin.Long = 789 // kotlin.Long | ID of pet that needs to be updated
|
||||||
|
val name : kotlin.String = name_example // kotlin.String | Updated name of the pet
|
||||||
|
val status : kotlin.String = status_example // kotlin.String | Updated status of the pet
|
||||||
|
|
||||||
|
webService.updatePetWithForm(petId, name, status)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**petId** | **kotlin.Long**| ID of pet that needs to be updated |
|
||||||
|
**name** | **kotlin.String**| Updated name of the pet | [optional]
|
||||||
|
**status** | **kotlin.String**| Updated status of the pet | [optional]
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
null (empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/x-www-form-urlencoded
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
|
||||||
|
uploads an image
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.*
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiClient = ApiClient()
|
||||||
|
val webService = apiClient.createWebservice(PetApi::class.java)
|
||||||
|
val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update
|
||||||
|
val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server
|
||||||
|
val file : java.io.File = BINARY_DATA_HERE // java.io.File | file to upload
|
||||||
|
|
||||||
|
val result : ModelApiResponse = webService.uploadFile(petId, additionalMetadata, file)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**petId** | **kotlin.Long**| ID of pet to update |
|
||||||
|
**additionalMetadata** | **kotlin.String**| Additional data to pass to server | [optional]
|
||||||
|
**file** | **java.io.File**| file to upload | [optional]
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**ModelApiResponse**](ModelApiResponse.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: multipart/form-data
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
160
samples/client/petstore/kotlin-jvm-jackson/docs/StoreApi.md
Normal file
160
samples/client/petstore/kotlin-jvm-jackson/docs/StoreApi.md
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
# StoreApi
|
||||||
|
|
||||||
|
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||||
|
|
||||||
|
Method | HTTP request | Description
|
||||||
|
------------- | ------------- | -------------
|
||||||
|
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** store/order/{orderId} | Delete purchase order by ID
|
||||||
|
[**getInventory**](StoreApi.md#getInventory) | **GET** store/inventory | Returns pet inventories by status
|
||||||
|
[**getOrderById**](StoreApi.md#getOrderById) | **GET** store/order/{orderId} | Find purchase order by ID
|
||||||
|
[**placeOrder**](StoreApi.md#placeOrder) | **POST** store/order | Place an order for a pet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Delete purchase order by ID
|
||||||
|
|
||||||
|
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.*
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiClient = ApiClient()
|
||||||
|
val webService = apiClient.createWebservice(StoreApi::class.java)
|
||||||
|
val orderId : kotlin.String = orderId_example // kotlin.String | ID of the order that needs to be deleted
|
||||||
|
|
||||||
|
webService.deleteOrder(orderId)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**orderId** | **kotlin.String**| ID of the order that needs to be deleted |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
null (empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
|
||||||
|
Returns pet inventories by status
|
||||||
|
|
||||||
|
Returns a map of status codes to quantities
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.*
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiClient = ApiClient()
|
||||||
|
val webService = apiClient.createWebservice(StoreApi::class.java)
|
||||||
|
|
||||||
|
val result : kotlin.collections.Map<kotlin.String, kotlin.Int> = webService.getInventory()
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
This endpoint does not need any parameter.
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**kotlin.collections.Map<kotlin.String, kotlin.Int>**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
|
||||||
|
Find purchase order by ID
|
||||||
|
|
||||||
|
For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.*
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiClient = ApiClient()
|
||||||
|
val webService = apiClient.createWebservice(StoreApi::class.java)
|
||||||
|
val orderId : kotlin.Long = 789 // kotlin.Long | ID of pet that needs to be fetched
|
||||||
|
|
||||||
|
val result : Order = webService.getOrderById(orderId)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**orderId** | **kotlin.Long**| ID of pet that needs to be fetched |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**Order**](Order.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: application/xml, application/json
|
||||||
|
|
||||||
|
|
||||||
|
Place an order for a pet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.*
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiClient = ApiClient()
|
||||||
|
val webService = apiClient.createWebservice(StoreApi::class.java)
|
||||||
|
val order : Order = // Order | order placed for purchasing the pet
|
||||||
|
|
||||||
|
val result : Order = webService.placeOrder(order)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**order** | [**Order**](Order.md)| order placed for purchasing the pet |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**Order**](Order.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/xml, application/json
|
||||||
|
|
11
samples/client/petstore/kotlin-jvm-jackson/docs/Tag.md
Normal file
11
samples/client/petstore/kotlin-jvm-jackson/docs/Tag.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
# Tag
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**id** | **kotlin.Long** | | [optional]
|
||||||
|
**name** | **kotlin.String** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
17
samples/client/petstore/kotlin-jvm-jackson/docs/User.md
Normal file
17
samples/client/petstore/kotlin-jvm-jackson/docs/User.md
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
# User
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**id** | **kotlin.Long** | | [optional]
|
||||||
|
**username** | **kotlin.String** | | [optional]
|
||||||
|
**firstName** | **kotlin.String** | | [optional]
|
||||||
|
**lastName** | **kotlin.String** | | [optional]
|
||||||
|
**email** | **kotlin.String** | | [optional]
|
||||||
|
**password** | **kotlin.String** | | [optional]
|
||||||
|
**phone** | **kotlin.String** | | [optional]
|
||||||
|
**userStatus** | **kotlin.Int** | User Status | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
320
samples/client/petstore/kotlin-jvm-jackson/docs/UserApi.md
Normal file
320
samples/client/petstore/kotlin-jvm-jackson/docs/UserApi.md
Normal file
@ -0,0 +1,320 @@
|
|||||||
|
# UserApi
|
||||||
|
|
||||||
|
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||||
|
|
||||||
|
Method | HTTP request | Description
|
||||||
|
------------- | ------------- | -------------
|
||||||
|
[**createUser**](UserApi.md#createUser) | **POST** user | Create user
|
||||||
|
[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** user/createWithArray | Creates list of users with given input array
|
||||||
|
[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** user/createWithList | Creates list of users with given input array
|
||||||
|
[**deleteUser**](UserApi.md#deleteUser) | **DELETE** user/{username} | Delete user
|
||||||
|
[**getUserByName**](UserApi.md#getUserByName) | **GET** user/{username} | Get user by user name
|
||||||
|
[**loginUser**](UserApi.md#loginUser) | **GET** user/login | Logs user into the system
|
||||||
|
[**logoutUser**](UserApi.md#logoutUser) | **GET** user/logout | Logs out current logged in user session
|
||||||
|
[**updateUser**](UserApi.md#updateUser) | **PUT** user/{username} | Updated user
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Create user
|
||||||
|
|
||||||
|
This can only be done by the logged in user.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.*
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiClient = ApiClient()
|
||||||
|
val webService = apiClient.createWebservice(UserApi::class.java)
|
||||||
|
val user : User = // User | Created user object
|
||||||
|
|
||||||
|
webService.createUser(user)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**user** | [**User**](User.md)| Created user object |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
null (empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
|
||||||
|
Creates list of users with given input array
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.*
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiClient = ApiClient()
|
||||||
|
val webService = apiClient.createWebservice(UserApi::class.java)
|
||||||
|
val user : kotlin.collections.List<User> = // kotlin.collections.List<User> | List of user object
|
||||||
|
|
||||||
|
webService.createUsersWithArrayInput(user)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**user** | [**kotlin.collections.List<User>**](User.md)| List of user object |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
null (empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
|
||||||
|
Creates list of users with given input array
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.*
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiClient = ApiClient()
|
||||||
|
val webService = apiClient.createWebservice(UserApi::class.java)
|
||||||
|
val user : kotlin.collections.List<User> = // kotlin.collections.List<User> | List of user object
|
||||||
|
|
||||||
|
webService.createUsersWithListInput(user)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**user** | [**kotlin.collections.List<User>**](User.md)| List of user object |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
null (empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
|
||||||
|
Delete user
|
||||||
|
|
||||||
|
This can only be done by the logged in user.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.*
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiClient = ApiClient()
|
||||||
|
val webService = apiClient.createWebservice(UserApi::class.java)
|
||||||
|
val username : kotlin.String = username_example // kotlin.String | The name that needs to be deleted
|
||||||
|
|
||||||
|
webService.deleteUser(username)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**username** | **kotlin.String**| The name that needs to be deleted |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
null (empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
|
||||||
|
Get user by user name
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.*
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiClient = ApiClient()
|
||||||
|
val webService = apiClient.createWebservice(UserApi::class.java)
|
||||||
|
val username : kotlin.String = username_example // kotlin.String | The name that needs to be fetched. Use user1 for testing.
|
||||||
|
|
||||||
|
val result : User = webService.getUserByName(username)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**username** | **kotlin.String**| The name that needs to be fetched. Use user1 for testing. |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**User**](User.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: application/xml, application/json
|
||||||
|
|
||||||
|
|
||||||
|
Logs user into the system
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.*
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiClient = ApiClient()
|
||||||
|
val webService = apiClient.createWebservice(UserApi::class.java)
|
||||||
|
val username : kotlin.String = username_example // kotlin.String | The user name for login
|
||||||
|
val password : kotlin.String = password_example // kotlin.String | The password for login in clear text
|
||||||
|
|
||||||
|
val result : kotlin.String = webService.loginUser(username, password)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**username** | **kotlin.String**| The user name for login |
|
||||||
|
**password** | **kotlin.String**| The password for login in clear text |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**kotlin.String**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: application/xml, application/json
|
||||||
|
|
||||||
|
|
||||||
|
Logs out current logged in user session
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.*
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiClient = ApiClient()
|
||||||
|
val webService = apiClient.createWebservice(UserApi::class.java)
|
||||||
|
|
||||||
|
webService.logoutUser()
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
This endpoint does not need any parameter.
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
null (empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
|
||||||
|
Updated user
|
||||||
|
|
||||||
|
This can only be done by the logged in user.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```kotlin
|
||||||
|
// Import classes:
|
||||||
|
//import org.openapitools.client.*
|
||||||
|
//import org.openapitools.client.infrastructure.*
|
||||||
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
|
val apiClient = ApiClient()
|
||||||
|
val webService = apiClient.createWebservice(UserApi::class.java)
|
||||||
|
val username : kotlin.String = username_example // kotlin.String | name that need to be deleted
|
||||||
|
val user : User = // User | Updated user object
|
||||||
|
|
||||||
|
webService.updateUser(username, user)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**username** | **kotlin.String**| name that need to be deleted |
|
||||||
|
**user** | [**User**](User.md)| Updated user object |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
null (empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
BIN
samples/client/petstore/kotlin-jvm-jackson/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
samples/client/petstore/kotlin-jvm-jackson/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
samples/client/petstore/kotlin-jvm-jackson/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
samples/client/petstore/kotlin-jvm-jackson/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-all.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
245
samples/client/petstore/kotlin-jvm-jackson/gradlew
vendored
Normal file
245
samples/client/petstore/kotlin-jvm-jackson/gradlew
vendored
Normal file
@ -0,0 +1,245 @@
|
|||||||
|
#!/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##*/}
|
||||||
|
APP_HOME=$( cd "${APP_HOME:-./}" && 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
|
||||||
|
which java >/dev/null 2>&1 || 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
|
||||||
|
|
||||||
|
# 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=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=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, and $GRADLE_OPTS can contain fragments of
|
||||||
|
# shell script including quotes and variable substitutions, so put them in
|
||||||
|
# double quotes to make sure that they get re-expanded; and
|
||||||
|
# * put everything else in single quotes, so that it's not re-expanded.
|
||||||
|
|
||||||
|
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" "$@"
|
92
samples/client/petstore/kotlin-jvm-jackson/gradlew.bat
vendored
Normal file
92
samples/client/petstore/kotlin-jvm-jackson/gradlew.bat
vendored
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
@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=.
|
||||||
|
@rem This is normally unused
|
||||||
|
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% equ 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% equ 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!
|
||||||
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
rootProject.name = 'kotlin-petstore-jvm-jackson'
|
@ -0,0 +1,137 @@
|
|||||||
|
package org.openapitools.client.apis
|
||||||
|
|
||||||
|
import org.openapitools.client.infrastructure.CollectionFormats.*
|
||||||
|
import retrofit2.http.*
|
||||||
|
import retrofit2.Call
|
||||||
|
import okhttp3.RequestBody
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
|
||||||
|
import org.openapitools.client.models.ModelApiResponse
|
||||||
|
import org.openapitools.client.models.Pet
|
||||||
|
|
||||||
|
import okhttp3.MultipartBody
|
||||||
|
|
||||||
|
interface PetApi {
|
||||||
|
/**
|
||||||
|
* Add a new pet to the store
|
||||||
|
*
|
||||||
|
* Responses:
|
||||||
|
* - 200: successful operation
|
||||||
|
* - 405: Invalid input
|
||||||
|
*
|
||||||
|
* @param pet Pet object that needs to be added to the store
|
||||||
|
* @return [Call]<[Pet]>
|
||||||
|
*/
|
||||||
|
@POST("pet")
|
||||||
|
fun addPet(@Body pet: Pet): Call<Pet>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a pet
|
||||||
|
*
|
||||||
|
* Responses:
|
||||||
|
* - 400: Invalid pet value
|
||||||
|
*
|
||||||
|
* @param petId Pet id to delete
|
||||||
|
* @param apiKey (optional)
|
||||||
|
* @return [Call]<[Unit]>
|
||||||
|
*/
|
||||||
|
@DELETE("pet/{petId}")
|
||||||
|
fun deletePet(@Path("petId") petId: kotlin.Long, @Header("api_key") apiKey: kotlin.String? = null): Call<Unit>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* enum for parameter status
|
||||||
|
*/
|
||||||
|
enum class StatusFindPetsByStatus(val value: kotlin.String) {
|
||||||
|
@JsonProperty(value = "available") available("available"),
|
||||||
|
@JsonProperty(value = "pending") pending("pending"),
|
||||||
|
@JsonProperty(value = "sold") sold("sold"),
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds Pets by status
|
||||||
|
* Multiple status values can be provided with comma separated strings
|
||||||
|
* Responses:
|
||||||
|
* - 200: successful operation
|
||||||
|
* - 400: Invalid status value
|
||||||
|
*
|
||||||
|
* @param status Status values that need to be considered for filter
|
||||||
|
* @return [Call]<[kotlin.collections.List<Pet>]>
|
||||||
|
*/
|
||||||
|
@GET("pet/findByStatus")
|
||||||
|
fun findPetsByStatus(@Query("status") status: CSVParams): Call<kotlin.collections.List<Pet>>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds Pets by tags
|
||||||
|
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||||
|
* Responses:
|
||||||
|
* - 200: successful operation
|
||||||
|
* - 400: Invalid tag value
|
||||||
|
*
|
||||||
|
* @param tags Tags to filter by
|
||||||
|
* @return [Call]<[kotlin.collections.List<Pet>]>
|
||||||
|
*/
|
||||||
|
@Deprecated("This api was deprecated")
|
||||||
|
@GET("pet/findByTags")
|
||||||
|
fun findPetsByTags(@Query("tags") tags: CSVParams): Call<kotlin.collections.List<Pet>>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find pet by ID
|
||||||
|
* Returns a single pet
|
||||||
|
* Responses:
|
||||||
|
* - 200: successful operation
|
||||||
|
* - 400: Invalid ID supplied
|
||||||
|
* - 404: Pet not found
|
||||||
|
*
|
||||||
|
* @param petId ID of pet to return
|
||||||
|
* @return [Call]<[Pet]>
|
||||||
|
*/
|
||||||
|
@GET("pet/{petId}")
|
||||||
|
fun getPetById(@Path("petId") petId: kotlin.Long): Call<Pet>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update an existing pet
|
||||||
|
*
|
||||||
|
* Responses:
|
||||||
|
* - 200: successful operation
|
||||||
|
* - 400: Invalid ID supplied
|
||||||
|
* - 404: Pet not found
|
||||||
|
* - 405: Validation exception
|
||||||
|
*
|
||||||
|
* @param pet Pet object that needs to be added to the store
|
||||||
|
* @return [Call]<[Pet]>
|
||||||
|
*/
|
||||||
|
@PUT("pet")
|
||||||
|
fun updatePet(@Body pet: Pet): Call<Pet>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates a pet in the store with form data
|
||||||
|
*
|
||||||
|
* Responses:
|
||||||
|
* - 405: Invalid input
|
||||||
|
*
|
||||||
|
* @param petId ID of pet that needs to be updated
|
||||||
|
* @param name Updated name of the pet (optional)
|
||||||
|
* @param status Updated status of the pet (optional)
|
||||||
|
* @return [Call]<[Unit]>
|
||||||
|
*/
|
||||||
|
@FormUrlEncoded
|
||||||
|
@POST("pet/{petId}")
|
||||||
|
fun updatePetWithForm(@Path("petId") petId: kotlin.Long, @Field("name") name: kotlin.String? = null, @Field("status") status: kotlin.String? = null): Call<Unit>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* uploads an image
|
||||||
|
*
|
||||||
|
* Responses:
|
||||||
|
* - 200: successful operation
|
||||||
|
*
|
||||||
|
* @param petId ID of pet to update
|
||||||
|
* @param additionalMetadata Additional data to pass to server (optional)
|
||||||
|
* @param file file to upload (optional)
|
||||||
|
* @return [Call]<[ModelApiResponse]>
|
||||||
|
*/
|
||||||
|
@Multipart
|
||||||
|
@POST("pet/{petId}/uploadImage")
|
||||||
|
fun uploadFile(@Path("petId") petId: kotlin.Long, @Part("additionalMetadata") additionalMetadata: kotlin.String? = null, @Part file: MultipartBody.Part? = null): Call<ModelApiResponse>
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
package org.openapitools.client.apis
|
||||||
|
|
||||||
|
import org.openapitools.client.infrastructure.CollectionFormats.*
|
||||||
|
import retrofit2.http.*
|
||||||
|
import retrofit2.Call
|
||||||
|
import okhttp3.RequestBody
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
|
||||||
|
import org.openapitools.client.models.Order
|
||||||
|
|
||||||
|
interface StoreApi {
|
||||||
|
/**
|
||||||
|
* Delete purchase order by ID
|
||||||
|
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||||
|
* Responses:
|
||||||
|
* - 400: Invalid ID supplied
|
||||||
|
* - 404: Order not found
|
||||||
|
*
|
||||||
|
* @param orderId ID of the order that needs to be deleted
|
||||||
|
* @return [Call]<[Unit]>
|
||||||
|
*/
|
||||||
|
@DELETE("store/order/{orderId}")
|
||||||
|
fun deleteOrder(@Path("orderId") orderId: kotlin.String): Call<Unit>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns pet inventories by status
|
||||||
|
* Returns a map of status codes to quantities
|
||||||
|
* Responses:
|
||||||
|
* - 200: successful operation
|
||||||
|
*
|
||||||
|
* @return [Call]<[kotlin.collections.Map<kotlin.String, kotlin.Int>]>
|
||||||
|
*/
|
||||||
|
@GET("store/inventory")
|
||||||
|
fun getInventory(): Call<kotlin.collections.Map<kotlin.String, kotlin.Int>>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find purchase order by ID
|
||||||
|
* For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions
|
||||||
|
* Responses:
|
||||||
|
* - 200: successful operation
|
||||||
|
* - 400: Invalid ID supplied
|
||||||
|
* - 404: Order not found
|
||||||
|
*
|
||||||
|
* @param orderId ID of pet that needs to be fetched
|
||||||
|
* @return [Call]<[Order]>
|
||||||
|
*/
|
||||||
|
@GET("store/order/{orderId}")
|
||||||
|
fun getOrderById(@Path("orderId") orderId: kotlin.Long): Call<Order>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Place an order for a pet
|
||||||
|
*
|
||||||
|
* Responses:
|
||||||
|
* - 200: successful operation
|
||||||
|
* - 400: Invalid Order
|
||||||
|
*
|
||||||
|
* @param order order placed for purchasing the pet
|
||||||
|
* @return [Call]<[Order]>
|
||||||
|
*/
|
||||||
|
@POST("store/order")
|
||||||
|
fun placeOrder(@Body order: Order): Call<Order>
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,114 @@
|
|||||||
|
package org.openapitools.client.apis
|
||||||
|
|
||||||
|
import org.openapitools.client.infrastructure.CollectionFormats.*
|
||||||
|
import retrofit2.http.*
|
||||||
|
import retrofit2.Call
|
||||||
|
import okhttp3.RequestBody
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
|
||||||
|
import org.openapitools.client.models.User
|
||||||
|
|
||||||
|
interface UserApi {
|
||||||
|
/**
|
||||||
|
* Create user
|
||||||
|
* This can only be done by the logged in user.
|
||||||
|
* Responses:
|
||||||
|
* - 0: successful operation
|
||||||
|
*
|
||||||
|
* @param user Created user object
|
||||||
|
* @return [Call]<[Unit]>
|
||||||
|
*/
|
||||||
|
@POST("user")
|
||||||
|
fun createUser(@Body user: User): Call<Unit>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates list of users with given input array
|
||||||
|
*
|
||||||
|
* Responses:
|
||||||
|
* - 0: successful operation
|
||||||
|
*
|
||||||
|
* @param user List of user object
|
||||||
|
* @return [Call]<[Unit]>
|
||||||
|
*/
|
||||||
|
@POST("user/createWithArray")
|
||||||
|
fun createUsersWithArrayInput(@Body user: kotlin.collections.List<User>): Call<Unit>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates list of users with given input array
|
||||||
|
*
|
||||||
|
* Responses:
|
||||||
|
* - 0: successful operation
|
||||||
|
*
|
||||||
|
* @param user List of user object
|
||||||
|
* @return [Call]<[Unit]>
|
||||||
|
*/
|
||||||
|
@POST("user/createWithList")
|
||||||
|
fun createUsersWithListInput(@Body user: kotlin.collections.List<User>): Call<Unit>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete user
|
||||||
|
* This can only be done by the logged in user.
|
||||||
|
* Responses:
|
||||||
|
* - 400: Invalid username supplied
|
||||||
|
* - 404: User not found
|
||||||
|
*
|
||||||
|
* @param username The name that needs to be deleted
|
||||||
|
* @return [Call]<[Unit]>
|
||||||
|
*/
|
||||||
|
@DELETE("user/{username}")
|
||||||
|
fun deleteUser(@Path("username") username: kotlin.String): Call<Unit>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get user by user name
|
||||||
|
*
|
||||||
|
* Responses:
|
||||||
|
* - 200: successful operation
|
||||||
|
* - 400: Invalid username supplied
|
||||||
|
* - 404: User not found
|
||||||
|
*
|
||||||
|
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||||
|
* @return [Call]<[User]>
|
||||||
|
*/
|
||||||
|
@GET("user/{username}")
|
||||||
|
fun getUserByName(@Path("username") username: kotlin.String): Call<User>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs user into the system
|
||||||
|
*
|
||||||
|
* Responses:
|
||||||
|
* - 200: successful operation
|
||||||
|
* - 400: Invalid username/password supplied
|
||||||
|
*
|
||||||
|
* @param username The user name for login
|
||||||
|
* @param password The password for login in clear text
|
||||||
|
* @return [Call]<[kotlin.String]>
|
||||||
|
*/
|
||||||
|
@GET("user/login")
|
||||||
|
fun loginUser(@Query("username") username: kotlin.String, @Query("password") password: kotlin.String): Call<kotlin.String>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs out current logged in user session
|
||||||
|
*
|
||||||
|
* Responses:
|
||||||
|
* - 0: successful operation
|
||||||
|
*
|
||||||
|
* @return [Call]<[Unit]>
|
||||||
|
*/
|
||||||
|
@GET("user/logout")
|
||||||
|
fun logoutUser(): Call<Unit>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updated user
|
||||||
|
* This can only be done by the logged in user.
|
||||||
|
* Responses:
|
||||||
|
* - 400: Invalid user supplied
|
||||||
|
* - 404: User not found
|
||||||
|
*
|
||||||
|
* @param username name that need to be deleted
|
||||||
|
* @param user Updated user object
|
||||||
|
* @return [Call]<[Unit]>
|
||||||
|
*/
|
||||||
|
@PUT("user/{username}")
|
||||||
|
fun updateUser(@Path("username") username: kotlin.String, @Body user: User): Call<Unit>
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
package org.openapitools.client.auth
|
||||||
|
|
||||||
|
import java.io.IOException
|
||||||
|
import java.net.URI
|
||||||
|
import java.net.URISyntaxException
|
||||||
|
|
||||||
|
import okhttp3.Interceptor
|
||||||
|
import okhttp3.Response
|
||||||
|
|
||||||
|
class ApiKeyAuth(
|
||||||
|
private val location: String = "",
|
||||||
|
private val paramName: String = "",
|
||||||
|
private var apiKey: String = ""
|
||||||
|
) : Interceptor {
|
||||||
|
|
||||||
|
@Throws(IOException::class)
|
||||||
|
override fun intercept(chain: Interceptor.Chain): Response {
|
||||||
|
var request = chain.request()
|
||||||
|
|
||||||
|
if ("query" == location) {
|
||||||
|
var newQuery = request.url.toUri().query
|
||||||
|
val paramValue = "$paramName=$apiKey"
|
||||||
|
if (newQuery == null) {
|
||||||
|
newQuery = paramValue
|
||||||
|
} else {
|
||||||
|
newQuery += "&$paramValue"
|
||||||
|
}
|
||||||
|
|
||||||
|
val newUri: URI
|
||||||
|
try {
|
||||||
|
val oldUri = request.url.toUri()
|
||||||
|
newUri = URI(oldUri.scheme, oldUri.authority,
|
||||||
|
oldUri.path, newQuery, oldUri.fragment)
|
||||||
|
} catch (e: URISyntaxException) {
|
||||||
|
throw IOException(e)
|
||||||
|
}
|
||||||
|
|
||||||
|
request = request.newBuilder().url(newUri.toURL()).build()
|
||||||
|
} else if ("header" == location) {
|
||||||
|
request = request.newBuilder()
|
||||||
|
.addHeader(paramName, apiKey)
|
||||||
|
.build()
|
||||||
|
} else if ("cookie" == location) {
|
||||||
|
request = request.newBuilder()
|
||||||
|
.addHeader("Cookie", "$paramName=$apiKey")
|
||||||
|
.build()
|
||||||
|
}
|
||||||
|
return chain.proceed(request)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,151 @@
|
|||||||
|
package org.openapitools.client.auth
|
||||||
|
|
||||||
|
import java.net.HttpURLConnection.HTTP_UNAUTHORIZED
|
||||||
|
import java.net.HttpURLConnection.HTTP_FORBIDDEN
|
||||||
|
|
||||||
|
import java.io.IOException
|
||||||
|
|
||||||
|
import org.apache.oltu.oauth2.client.OAuthClient
|
||||||
|
import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest
|
||||||
|
import org.apache.oltu.oauth2.client.request.OAuthClientRequest
|
||||||
|
import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder
|
||||||
|
import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder
|
||||||
|
import org.apache.oltu.oauth2.common.exception.OAuthProblemException
|
||||||
|
import org.apache.oltu.oauth2.common.exception.OAuthSystemException
|
||||||
|
import org.apache.oltu.oauth2.common.message.types.GrantType
|
||||||
|
import org.apache.oltu.oauth2.common.token.BasicOAuthToken
|
||||||
|
|
||||||
|
import okhttp3.Interceptor
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
|
import okhttp3.Response
|
||||||
|
|
||||||
|
class OAuth(
|
||||||
|
client: OkHttpClient,
|
||||||
|
var tokenRequestBuilder: TokenRequestBuilder
|
||||||
|
) : Interceptor {
|
||||||
|
|
||||||
|
interface AccessTokenListener {
|
||||||
|
fun notify(token: BasicOAuthToken)
|
||||||
|
}
|
||||||
|
|
||||||
|
private var oauthClient: OAuthClient = OAuthClient(OAuthOkHttpClient(client))
|
||||||
|
|
||||||
|
@Volatile
|
||||||
|
private var accessToken: String? = null
|
||||||
|
var authenticationRequestBuilder: AuthenticationRequestBuilder? = null
|
||||||
|
private var accessTokenListener: AccessTokenListener? = null
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
requestBuilder: TokenRequestBuilder
|
||||||
|
) : this(
|
||||||
|
OkHttpClient(),
|
||||||
|
requestBuilder
|
||||||
|
)
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
flow: OAuthFlow,
|
||||||
|
authorizationUrl: String,
|
||||||
|
tokenUrl: String,
|
||||||
|
scopes: String
|
||||||
|
) : this(
|
||||||
|
OAuthClientRequest.tokenLocation(tokenUrl).setScope(scopes)
|
||||||
|
) {
|
||||||
|
setFlow(flow)
|
||||||
|
authenticationRequestBuilder = OAuthClientRequest.authorizationLocation(authorizationUrl)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setFlow(flow: OAuthFlow) {
|
||||||
|
when (flow) {
|
||||||
|
OAuthFlow.accessCode, OAuthFlow.implicit ->
|
||||||
|
tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE)
|
||||||
|
OAuthFlow.password ->
|
||||||
|
tokenRequestBuilder.setGrantType(GrantType.PASSWORD)
|
||||||
|
OAuthFlow.application ->
|
||||||
|
tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Throws(IOException::class)
|
||||||
|
override fun intercept(chain: Interceptor.Chain): Response {
|
||||||
|
return retryingIntercept(chain, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Throws(IOException::class)
|
||||||
|
private fun retryingIntercept(chain: Interceptor.Chain, updateTokenAndRetryOnAuthorizationFailure: Boolean): Response {
|
||||||
|
var request = chain.request()
|
||||||
|
|
||||||
|
// If the request already have an authorization (eg. Basic auth), do nothing
|
||||||
|
if (request.header("Authorization") != null) {
|
||||||
|
return chain.proceed(request)
|
||||||
|
}
|
||||||
|
|
||||||
|
// If first time, get the token
|
||||||
|
val oAuthRequest: OAuthClientRequest
|
||||||
|
if (accessToken == null) {
|
||||||
|
updateAccessToken(null)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (accessToken != null) {
|
||||||
|
// Build the request
|
||||||
|
val rb = request.newBuilder()
|
||||||
|
|
||||||
|
val requestAccessToken = accessToken
|
||||||
|
try {
|
||||||
|
oAuthRequest = OAuthBearerClientRequest(request.url.toString())
|
||||||
|
.setAccessToken(requestAccessToken)
|
||||||
|
.buildHeaderMessage()
|
||||||
|
} catch (e: OAuthSystemException) {
|
||||||
|
throw IOException(e)
|
||||||
|
}
|
||||||
|
|
||||||
|
oAuthRequest.headers.entries.forEach { header ->
|
||||||
|
rb.addHeader(header.key, header.value)
|
||||||
|
}
|
||||||
|
rb.url(oAuthRequest.locationUri)
|
||||||
|
|
||||||
|
//Execute the request
|
||||||
|
val response = chain.proceed(rb.build())
|
||||||
|
|
||||||
|
// 401/403 most likely indicates that access token has expired. Unless it happens two times in a row.
|
||||||
|
if ((response.code == HTTP_UNAUTHORIZED || response.code == HTTP_FORBIDDEN) && updateTokenAndRetryOnAuthorizationFailure) {
|
||||||
|
try {
|
||||||
|
if (updateAccessToken(requestAccessToken)) {
|
||||||
|
response.body?.close()
|
||||||
|
return retryingIntercept(chain, false)
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
response.body?.close()
|
||||||
|
throw e
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response
|
||||||
|
} else {
|
||||||
|
return chain.proceed(chain.request())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the access token has been updated
|
||||||
|
*/
|
||||||
|
@Throws(IOException::class)
|
||||||
|
@Synchronized
|
||||||
|
fun updateAccessToken(requestAccessToken: String?): Boolean {
|
||||||
|
if (accessToken == null || accessToken.equals(requestAccessToken)) {
|
||||||
|
return try {
|
||||||
|
val accessTokenResponse = oauthClient.accessToken(this.tokenRequestBuilder.buildBodyMessage())
|
||||||
|
if (accessTokenResponse != null && accessTokenResponse.accessToken != null) {
|
||||||
|
accessToken = accessTokenResponse.accessToken
|
||||||
|
accessTokenListener?.notify(accessTokenResponse.oAuthToken as BasicOAuthToken)
|
||||||
|
!accessToken.equals(requestAccessToken)
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
} catch (e: OAuthSystemException) {
|
||||||
|
throw IOException(e)
|
||||||
|
} catch (e: OAuthProblemException) {
|
||||||
|
throw IOException(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
package org.openapitools.client.auth
|
||||||
|
|
||||||
|
enum class OAuthFlow {
|
||||||
|
accessCode, implicit, password, application
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package org.openapitools.client.auth
|
||||||
|
|
||||||
|
import java.io.IOException
|
||||||
|
|
||||||
|
import org.apache.oltu.oauth2.client.HttpClient
|
||||||
|
import org.apache.oltu.oauth2.client.request.OAuthClientRequest
|
||||||
|
import org.apache.oltu.oauth2.client.response.OAuthClientResponse
|
||||||
|
import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory
|
||||||
|
import org.apache.oltu.oauth2.common.exception.OAuthProblemException
|
||||||
|
import org.apache.oltu.oauth2.common.exception.OAuthSystemException
|
||||||
|
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
|
import okhttp3.Request
|
||||||
|
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||||
|
import okhttp3.RequestBody
|
||||||
|
import okhttp3.RequestBody.Companion.toRequestBody
|
||||||
|
|
||||||
|
|
||||||
|
class OAuthOkHttpClient(
|
||||||
|
private var client: OkHttpClient = OkHttpClient()
|
||||||
|
) : HttpClient {
|
||||||
|
|
||||||
|
@Throws(OAuthSystemException::class, OAuthProblemException::class)
|
||||||
|
override fun <T : OAuthClientResponse?> execute(
|
||||||
|
request: OAuthClientRequest,
|
||||||
|
headers: Map<String, String>?,
|
||||||
|
requestMethod: String,
|
||||||
|
responseClass: Class<T>?): T {
|
||||||
|
|
||||||
|
var mediaType = "application/json".toMediaTypeOrNull()
|
||||||
|
val requestBuilder = Request.Builder().url(request.locationUri)
|
||||||
|
|
||||||
|
headers?.forEach { entry ->
|
||||||
|
if (entry.key.equals("Content-Type", true)) {
|
||||||
|
mediaType = entry.value.toMediaTypeOrNull()
|
||||||
|
} else {
|
||||||
|
requestBuilder.addHeader(entry.key, entry.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val body: RequestBody? = if (request.body != null) request.body.toRequestBody(mediaType) else null
|
||||||
|
requestBuilder.method(requestMethod, body)
|
||||||
|
|
||||||
|
try {
|
||||||
|
val response = client.newCall(requestBuilder.build()).execute()
|
||||||
|
return OAuthClientResponseFactory.createCustomResponse(
|
||||||
|
response.body?.string(),
|
||||||
|
response.body?.contentType()?.toString(),
|
||||||
|
response.code,
|
||||||
|
response.headers.toMultimap(),
|
||||||
|
responseClass)
|
||||||
|
} catch (e: IOException) {
|
||||||
|
throw OAuthSystemException(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun shutdown() {
|
||||||
|
// Nothing to do here
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,220 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder
|
||||||
|
import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder
|
||||||
|
import org.openapitools.client.auth.OAuth
|
||||||
|
import org.openapitools.client.auth.OAuth.AccessTokenListener
|
||||||
|
import org.openapitools.client.auth.OAuthFlow
|
||||||
|
import org.openapitools.client.auth.ApiKeyAuth
|
||||||
|
|
||||||
|
import okhttp3.Call
|
||||||
|
import okhttp3.Interceptor
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
|
import retrofit2.Retrofit
|
||||||
|
import okhttp3.logging.HttpLoggingInterceptor
|
||||||
|
import retrofit2.Converter
|
||||||
|
import retrofit2.CallAdapter
|
||||||
|
import retrofit2.converter.scalars.ScalarsConverterFactory
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper
|
||||||
|
|
||||||
|
|
||||||
|
class ApiClient(
|
||||||
|
private var baseUrl: String = defaultBasePath,
|
||||||
|
private val okHttpClientBuilder: OkHttpClient.Builder? = null,
|
||||||
|
private val serializerBuilder: ObjectMapper = Serializer.jacksonObjectMapper,
|
||||||
|
private val callFactory : Call.Factory? = null,
|
||||||
|
private val callAdapterFactories: List<CallAdapter.Factory> = listOf(
|
||||||
|
),
|
||||||
|
private val converterFactories: List<Converter.Factory> = listOf(
|
||||||
|
ScalarsConverterFactory.create(),
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
private val apiAuthorizations = mutableMapOf<String, Interceptor>()
|
||||||
|
var logger: ((String) -> Unit)? = null
|
||||||
|
|
||||||
|
private val retrofitBuilder: Retrofit.Builder by lazy {
|
||||||
|
Retrofit.Builder()
|
||||||
|
.baseUrl(baseUrl)
|
||||||
|
.apply {
|
||||||
|
callAdapterFactories.forEach {
|
||||||
|
addCallAdapterFactory(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.apply {
|
||||||
|
converterFactories.forEach {
|
||||||
|
addConverterFactory(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private val clientBuilder: OkHttpClient.Builder by lazy {
|
||||||
|
okHttpClientBuilder ?: defaultClientBuilder
|
||||||
|
}
|
||||||
|
|
||||||
|
private val defaultClientBuilder: OkHttpClient.Builder by lazy {
|
||||||
|
OkHttpClient()
|
||||||
|
.newBuilder()
|
||||||
|
.addInterceptor(HttpLoggingInterceptor { message -> logger?.invoke(message) }
|
||||||
|
.apply { level = HttpLoggingInterceptor.Level.BODY }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
init {
|
||||||
|
normalizeBaseUrl()
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
baseUrl: String = defaultBasePath,
|
||||||
|
okHttpClientBuilder: OkHttpClient.Builder? = null,
|
||||||
|
serializerBuilder: ObjectMapper = Serializer.jacksonObjectMapper,
|
||||||
|
authNames: Array<String>
|
||||||
|
) : this(baseUrl, okHttpClientBuilder, serializerBuilder) {
|
||||||
|
authNames.forEach { authName ->
|
||||||
|
val auth = when (authName) {
|
||||||
|
"petstore_auth" -> OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets")
|
||||||
|
|
||||||
|
"api_key" -> ApiKeyAuth("header", "api_key")
|
||||||
|
|
||||||
|
else -> throw RuntimeException("auth name $authName not found in available auth names")
|
||||||
|
}
|
||||||
|
if (auth != null) {
|
||||||
|
addAuthorization(authName, auth)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
baseUrl: String = defaultBasePath,
|
||||||
|
okHttpClientBuilder: OkHttpClient.Builder? = null,
|
||||||
|
serializerBuilder: ObjectMapper = Serializer.jacksonObjectMapper,
|
||||||
|
authName: String,
|
||||||
|
clientId: String,
|
||||||
|
secret: String,
|
||||||
|
username: String,
|
||||||
|
password: String
|
||||||
|
) : this(baseUrl, okHttpClientBuilder, serializerBuilder, arrayOf(authName)) {
|
||||||
|
getTokenEndPoint()
|
||||||
|
?.setClientId(clientId)
|
||||||
|
?.setClientSecret(secret)
|
||||||
|
?.setUsername(username)
|
||||||
|
?.setPassword(password)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one)
|
||||||
|
* @return Token request builder
|
||||||
|
*/
|
||||||
|
fun getTokenEndPoint(): TokenRequestBuilder? {
|
||||||
|
var result: TokenRequestBuilder? = null
|
||||||
|
apiAuthorizations.values.runOnFirst<Interceptor, OAuth> {
|
||||||
|
result = tokenRequestBuilder
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one)
|
||||||
|
* @return Authentication request builder
|
||||||
|
*/
|
||||||
|
fun getAuthorizationEndPoint(): AuthenticationRequestBuilder? {
|
||||||
|
var result: AuthenticationRequestBuilder? = null
|
||||||
|
apiAuthorizations.values.runOnFirst<Interceptor, OAuth> {
|
||||||
|
result = authenticationRequestBuilder
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to pre-set the oauth access token of the first oauth found in the apiAuthorizations (there should be only one)
|
||||||
|
* @param accessToken Access token
|
||||||
|
* @return ApiClient
|
||||||
|
*/
|
||||||
|
fun setAccessToken(accessToken: String): ApiClient {
|
||||||
|
apiAuthorizations.values.runOnFirst<Interceptor, OAuth> {
|
||||||
|
setAccessToken(accessToken)
|
||||||
|
}
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to configure the oauth accessCode/implicit flow parameters
|
||||||
|
* @param clientId Client ID
|
||||||
|
* @param clientSecret Client secret
|
||||||
|
* @param redirectURI Redirect URI
|
||||||
|
* @return ApiClient
|
||||||
|
*/
|
||||||
|
fun configureAuthorizationFlow(clientId: String, clientSecret: String, redirectURI: String): ApiClient {
|
||||||
|
apiAuthorizations.values.runOnFirst<Interceptor, OAuth> {
|
||||||
|
tokenRequestBuilder
|
||||||
|
.setClientId(clientId)
|
||||||
|
.setClientSecret(clientSecret)
|
||||||
|
.setRedirectURI(redirectURI)
|
||||||
|
authenticationRequestBuilder
|
||||||
|
?.setClientId(clientId)
|
||||||
|
?.setRedirectURI(redirectURI)
|
||||||
|
}
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures a listener which is notified when a new access token is received.
|
||||||
|
* @param accessTokenListener Access token listener
|
||||||
|
* @return ApiClient
|
||||||
|
*/
|
||||||
|
fun registerAccessTokenListener(accessTokenListener: AccessTokenListener): ApiClient {
|
||||||
|
apiAuthorizations.values.runOnFirst<Interceptor, OAuth> {
|
||||||
|
registerAccessTokenListener(accessTokenListener)
|
||||||
|
}
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds an authorization to be used by the client
|
||||||
|
* @param authName Authentication name
|
||||||
|
* @param authorization Authorization interceptor
|
||||||
|
* @return ApiClient
|
||||||
|
*/
|
||||||
|
fun addAuthorization(authName: String, authorization: Interceptor): ApiClient {
|
||||||
|
if (apiAuthorizations.containsKey(authName)) {
|
||||||
|
throw RuntimeException("auth name $authName already in api authorizations")
|
||||||
|
}
|
||||||
|
apiAuthorizations[authName] = authorization
|
||||||
|
clientBuilder.addInterceptor(authorization)
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setLogger(logger: (String) -> Unit): ApiClient {
|
||||||
|
this.logger = logger
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <S> createService(serviceClass: Class<S>): S {
|
||||||
|
val usedCallFactory = this.callFactory ?: clientBuilder.build()
|
||||||
|
return retrofitBuilder.callFactory(usedCallFactory).build().create(serviceClass)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun normalizeBaseUrl() {
|
||||||
|
if (!baseUrl.endsWith("/")) {
|
||||||
|
baseUrl += "/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private inline fun <T, reified U> Iterable<T>.runOnFirst(callback: U.() -> Unit) {
|
||||||
|
for (element in this) {
|
||||||
|
if (element is U) {
|
||||||
|
callback.invoke(element)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
protected val baseUrlKey = "org.openapitools.client.baseUrl"
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
val defaultBasePath: String by lazy {
|
||||||
|
System.getProperties().getProperty(baseUrlKey, "http://petstore.swagger.io/v2")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
class CollectionFormats {
|
||||||
|
|
||||||
|
open class CSVParams {
|
||||||
|
|
||||||
|
var params: List<String>
|
||||||
|
|
||||||
|
constructor(params: List<String>) {
|
||||||
|
this.params = params
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(vararg params: String) {
|
||||||
|
this.params = listOf(*params)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return params.joinToString(",")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
open class SSVParams : CSVParams {
|
||||||
|
|
||||||
|
constructor(params: List<String>) : super(params)
|
||||||
|
|
||||||
|
constructor(vararg params: String) : super(*params)
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return params.joinToString(" ")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class TSVParams : CSVParams {
|
||||||
|
|
||||||
|
constructor(params: List<String>) : super(params)
|
||||||
|
|
||||||
|
constructor(vararg params: String) : super(*params)
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return params.joinToString("\t")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class PIPESParams : CSVParams {
|
||||||
|
|
||||||
|
constructor(params: List<String>) : super(params)
|
||||||
|
|
||||||
|
constructor(vararg params: String) : super(*params)
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return params.joinToString("|")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SPACEParams : SSVParams()
|
||||||
|
}
|
@ -0,0 +1,4 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import retrofit2.Response
|
||||||
|
|
@ -0,0 +1,14 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper
|
||||||
|
import com.fasterxml.jackson.databind.SerializationFeature
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude
|
||||||
|
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
|
||||||
|
|
||||||
|
object Serializer {
|
||||||
|
@JvmStatic
|
||||||
|
val jacksonObjectMapper: ObjectMapper = jacksonObjectMapper()
|
||||||
|
.findAndRegisterModules()
|
||||||
|
.setSerializationInclusion(JsonInclude.Include.NON_ABSENT)
|
||||||
|
.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)
|
||||||
|
}
|
@ -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.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A category for a pet
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @param name
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
data class Category (
|
||||||
|
|
||||||
|
@field:JsonProperty("id")
|
||||||
|
val id: kotlin.Long? = null,
|
||||||
|
|
||||||
|
@field:JsonProperty("name")
|
||||||
|
val name: 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.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describes the result of uploading an image resource
|
||||||
|
*
|
||||||
|
* @param code
|
||||||
|
* @param type
|
||||||
|
* @param message
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
data class ModelApiResponse (
|
||||||
|
|
||||||
|
@field:JsonProperty("code")
|
||||||
|
val code: kotlin.Int? = null,
|
||||||
|
|
||||||
|
@field:JsonProperty("type")
|
||||||
|
val type: kotlin.String? = null,
|
||||||
|
|
||||||
|
@field:JsonProperty("message")
|
||||||
|
val message: kotlin.String? = null
|
||||||
|
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1,68 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* 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.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An order for a pets from the pet store
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @param petId
|
||||||
|
* @param quantity
|
||||||
|
* @param shipDate
|
||||||
|
* @param status Order Status
|
||||||
|
* @param complete
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
data class Order (
|
||||||
|
|
||||||
|
@field:JsonProperty("id")
|
||||||
|
val id: kotlin.Long? = null,
|
||||||
|
|
||||||
|
@field:JsonProperty("petId")
|
||||||
|
val petId: kotlin.Long? = null,
|
||||||
|
|
||||||
|
@field:JsonProperty("quantity")
|
||||||
|
val quantity: kotlin.Int? = null,
|
||||||
|
|
||||||
|
@field:JsonProperty("shipDate")
|
||||||
|
val shipDate: java.time.OffsetDateTime? = null,
|
||||||
|
|
||||||
|
/* Order Status */
|
||||||
|
@field:JsonProperty("status")
|
||||||
|
val status: Order.Status? = null,
|
||||||
|
|
||||||
|
@field:JsonProperty("complete")
|
||||||
|
val complete: kotlin.Boolean? = false
|
||||||
|
|
||||||
|
) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Order Status
|
||||||
|
*
|
||||||
|
* Values: placed,approved,delivered,unknownDefaultOpenApi
|
||||||
|
*/
|
||||||
|
enum class Status(val value: kotlin.String) {
|
||||||
|
@JsonProperty(value = "placed") placed("placed"),
|
||||||
|
@JsonProperty(value = "approved") approved("approved"),
|
||||||
|
@JsonProperty(value = "delivered") delivered("delivered"),
|
||||||
|
@JsonProperty(value = "unknown_default_open_api") unknownDefaultOpenApi("unknown_default_open_api");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,71 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* 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.Category
|
||||||
|
import org.openapitools.client.models.Tag
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A pet for sale in the pet store
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* @param photoUrls
|
||||||
|
* @param id
|
||||||
|
* @param category
|
||||||
|
* @param tags
|
||||||
|
* @param status pet status in the store
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
data class Pet (
|
||||||
|
|
||||||
|
@field:JsonProperty("name")
|
||||||
|
val name: kotlin.String,
|
||||||
|
|
||||||
|
@field:JsonProperty("photoUrls")
|
||||||
|
val photoUrls: kotlin.collections.List<kotlin.String>,
|
||||||
|
|
||||||
|
@field:JsonProperty("id")
|
||||||
|
val id: kotlin.Long? = null,
|
||||||
|
|
||||||
|
@field:JsonProperty("category")
|
||||||
|
val category: Category? = null,
|
||||||
|
|
||||||
|
@field:JsonProperty("tags")
|
||||||
|
val tags: kotlin.collections.List<Tag>? = null,
|
||||||
|
|
||||||
|
/* pet status in the store */
|
||||||
|
@field:JsonProperty("status")
|
||||||
|
@Deprecated(message = "This property is deprecated.")
|
||||||
|
val status: Pet.Status? = null
|
||||||
|
|
||||||
|
) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pet status in the store
|
||||||
|
*
|
||||||
|
* Values: available,pending,sold,unknownDefaultOpenApi
|
||||||
|
*/
|
||||||
|
enum class Status(val value: kotlin.String) {
|
||||||
|
@JsonProperty(value = "available") available("available"),
|
||||||
|
@JsonProperty(value = "pending") pending("pending"),
|
||||||
|
@JsonProperty(value = "sold") sold("sold"),
|
||||||
|
@JsonProperty(value = "unknown_default_open_api") unknownDefaultOpenApi("unknown_default_open_api");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A tag for a pet
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @param name
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
data class Tag (
|
||||||
|
|
||||||
|
@field:JsonProperty("id")
|
||||||
|
val id: kotlin.Long? = null,
|
||||||
|
|
||||||
|
@field:JsonProperty("name")
|
||||||
|
val name: kotlin.String? = null
|
||||||
|
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1,63 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* 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.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A User who is purchasing from the pet store
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @param username
|
||||||
|
* @param firstName
|
||||||
|
* @param lastName
|
||||||
|
* @param email
|
||||||
|
* @param password
|
||||||
|
* @param phone
|
||||||
|
* @param userStatus User Status
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
data class User (
|
||||||
|
|
||||||
|
@field:JsonProperty("id")
|
||||||
|
val id: kotlin.Long? = null,
|
||||||
|
|
||||||
|
@field:JsonProperty("username")
|
||||||
|
val username: kotlin.String? = null,
|
||||||
|
|
||||||
|
@field:JsonProperty("firstName")
|
||||||
|
val firstName: kotlin.String? = null,
|
||||||
|
|
||||||
|
@field:JsonProperty("lastName")
|
||||||
|
val lastName: kotlin.String? = null,
|
||||||
|
|
||||||
|
@field:JsonProperty("email")
|
||||||
|
val email: kotlin.String? = null,
|
||||||
|
|
||||||
|
@field:JsonProperty("password")
|
||||||
|
val password: kotlin.String? = null,
|
||||||
|
|
||||||
|
@field:JsonProperty("phone")
|
||||||
|
val phone: kotlin.String? = null,
|
||||||
|
|
||||||
|
/* User Status */
|
||||||
|
@field:JsonProperty("userStatus")
|
||||||
|
val userStatus: kotlin.Int? = null
|
||||||
|
|
||||||
|
)
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user