forked from loafle/openapi-generator-original
Merge remote-tracking branch 'origin/4.2.x' into 5.0.x
This commit is contained in:
@@ -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 @@
|
||||
5.0.0-SNAPSHOT
|
||||
81
samples/client/petstore/kotlin-multiplatform/README.md
Normal file
81
samples/client/petstore/kotlin-multiplatform/README.md
Normal file
@@ -0,0 +1,81 @@
|
||||
# org.openapitools.client - Kotlin client library for OpenAPI Petstore
|
||||
|
||||
## Requires
|
||||
|
||||
* Kotlin 1.3.50
|
||||
|
||||
## Build
|
||||
|
||||
```
|
||||
./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.
|
||||
|
||||
|
||||
<a name="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 name="documentation-for-models"></a>
|
||||
## Documentation for Models
|
||||
|
||||
- [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md)
|
||||
- [org.openapitools.client.models.Category](docs/Category.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 name="documentation-for-authorization"></a>
|
||||
## Documentation for Authorization
|
||||
|
||||
<a name="api_key"></a>
|
||||
### api_key
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key
|
||||
- **Location**: HTTP header
|
||||
|
||||
<a name="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
|
||||
|
||||
138
samples/client/petstore/kotlin-multiplatform/build.gradle
Normal file
138
samples/client/petstore/kotlin-multiplatform/build.gradle
Normal file
@@ -0,0 +1,138 @@
|
||||
apply plugin: 'kotlin-multiplatform'
|
||||
apply plugin: 'kotlinx-serialization'
|
||||
|
||||
group 'org.openapitools'
|
||||
version '1.0.0'
|
||||
|
||||
ext {
|
||||
kotlin_version = '1.3.50'
|
||||
kotlinx_version = '1.1.0'
|
||||
coroutines_version = '1.3.1'
|
||||
serialization_version = '0.12.0'
|
||||
ktor_version = '1.2.4'
|
||||
}
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50" // $kotlin_version
|
||||
classpath "org.jetbrains.kotlin:kotlin-serialization:1.3.50" // $kotlin_version
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvm()
|
||||
iosArm64() { binaries { framework { freeCompilerArgs.add("-Xobjc-generics") } } }
|
||||
iosX64() { binaries { framework { freeCompilerArgs.add("-Xobjc-generics") } } }
|
||||
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlin_version"
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$coroutines_version"
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serialization_version"
|
||||
implementation "io.ktor:ktor-client-core:$ktor_version"
|
||||
implementation "io.ktor:ktor-client-json:$ktor_version"
|
||||
implementation "io.ktor:ktor-client-serialization:$ktor_version"
|
||||
}
|
||||
}
|
||||
|
||||
commonTest {
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-test-common"
|
||||
implementation "org.jetbrains.kotlin:kotlin-test-annotations-common"
|
||||
implementation "io.ktor:ktor-client-mock:$ktor_version"
|
||||
}
|
||||
}
|
||||
|
||||
jvmMain {
|
||||
dependsOn commonMain
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serialization_version"
|
||||
implementation "io.ktor:ktor-client-core-jvm:$ktor_version"
|
||||
implementation "io.ktor:ktor-client-json-jvm:$ktor_version"
|
||||
implementation "io.ktor:ktor-client-serialization-jvm:$ktor_version"
|
||||
}
|
||||
}
|
||||
|
||||
jvmTest {
|
||||
dependsOn commonTest
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-test"
|
||||
implementation "org.jetbrains.kotlin:kotlin-test-junit"
|
||||
implementation "io.ktor:ktor-client-mock-jvm:$ktor_version"
|
||||
}
|
||||
}
|
||||
|
||||
iosMain {
|
||||
dependsOn commonMain
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-native:$coroutines_version"
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-native:$serialization_version"
|
||||
implementation "io.ktor:ktor-client-ios:$ktor_version"
|
||||
}
|
||||
}
|
||||
|
||||
iosTest {
|
||||
dependsOn commonTest
|
||||
dependencies {
|
||||
implementation "io.ktor:ktor-client-mock-native:$ktor_version"
|
||||
}
|
||||
}
|
||||
|
||||
iosArm64().compilations.main.defaultSourceSet {
|
||||
dependsOn iosMain
|
||||
dependencies {
|
||||
implementation "io.ktor:ktor-client-ios-iosarm64:$ktor_version"
|
||||
implementation "io.ktor:ktor-client-json-iosarm64:$ktor_version"
|
||||
implementation "io.ktor:ktor-client-serialization-iosarm64:$ktor_version"
|
||||
}
|
||||
}
|
||||
|
||||
iosArm64().compilations.test.defaultSourceSet {
|
||||
dependsOn iosTest
|
||||
}
|
||||
|
||||
iosX64().compilations.main.defaultSourceSet {
|
||||
dependsOn iosMain
|
||||
dependencies {
|
||||
implementation "io.ktor:ktor-client-ios-iosx64:$ktor_version"
|
||||
implementation "io.ktor:ktor-client-json-iosx64:$ktor_version"
|
||||
implementation "io.ktor:ktor-client-serialization-iosx64:$ktor_version"
|
||||
}
|
||||
}
|
||||
|
||||
iosX64().compilations.test.defaultSourceSet {
|
||||
dependsOn iosTest
|
||||
}
|
||||
|
||||
all {
|
||||
languageSettings {
|
||||
useExperimentalAnnotation('kotlin.Experimental')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task iosTest {
|
||||
def device = project.findProperty("device")?.toString() ?: "iPhone 8"
|
||||
dependsOn 'linkDebugTestIosX64'
|
||||
group = JavaBasePlugin.VERIFICATION_GROUP
|
||||
description = "Execute unit tests on ${device} simulator"
|
||||
doLast {
|
||||
def binary = kotlin.targets.iosX64.binaries.getTest('DEBUG')
|
||||
exec { commandLine 'xcrun', 'simctl', 'spawn', device, binary.outputFile }
|
||||
}
|
||||
}
|
||||
|
||||
configurations { // workaround for https://youtrack.jetbrains.com/issue/KT-27170
|
||||
compileClasspath
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
# ApiResponse
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**code** | **kotlin.Int** | | [optional]
|
||||
**type** | **kotlin.String** | | [optional]
|
||||
**message** | **kotlin.String** | | [optional]
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
# Category
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **kotlin.Long** | | [optional]
|
||||
**name** | **kotlin.String** | | [optional]
|
||||
|
||||
|
||||
|
||||
22
samples/client/petstore/kotlin-multiplatform/docs/Order.md
Normal file
22
samples/client/petstore/kotlin-multiplatform/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** | **kotlin.String** | | [optional]
|
||||
**status** | [**inline**](#StatusEnum) | Order Status | [optional]
|
||||
**complete** | **kotlin.Boolean** | | [optional]
|
||||
|
||||
|
||||
<a name="StatusEnum"></a>
|
||||
## Enum: status
|
||||
Name | Value
|
||||
---- | -----
|
||||
status | placed, approved, delivered
|
||||
|
||||
|
||||
|
||||
22
samples/client/petstore/kotlin-multiplatform/docs/Pet.md
Normal file
22
samples/client/petstore/kotlin-multiplatform/docs/Pet.md
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
# Pet
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **kotlin.Long** | | [optional]
|
||||
**category** | [**Category**](Category.md) | | [optional]
|
||||
**name** | **kotlin.String** | |
|
||||
**photoUrls** | **kotlin.Array<kotlin.String>** | |
|
||||
**tags** | [**kotlin.Array<Tag>**](Tag.md) | | [optional]
|
||||
**status** | [**inline**](#StatusEnum) | pet status in the store | [optional]
|
||||
|
||||
|
||||
<a name="StatusEnum"></a>
|
||||
## Enum: status
|
||||
Name | Value
|
||||
---- | -----
|
||||
status | available, pending, sold
|
||||
|
||||
|
||||
|
||||
405
samples/client/petstore/kotlin-multiplatform/docs/PetApi.md
Normal file
405
samples/client/petstore/kotlin-multiplatform/docs/PetApi.md
Normal file
@@ -0,0 +1,405 @@
|
||||
# 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
|
||||
|
||||
|
||||
<a name="addPet"></a>
|
||||
# **addPet**
|
||||
> addPet(body)
|
||||
|
||||
Add a new pet to the store
|
||||
|
||||
### Example
|
||||
```kotlin
|
||||
// Import classes:
|
||||
//import org.openapitools.client.infrastructure.*
|
||||
//import org.openapitools.client.models.*
|
||||
|
||||
val apiInstance = PetApi()
|
||||
val body : Pet = // Pet | Pet object that needs to be added to the store
|
||||
try {
|
||||
apiInstance.addPet(body)
|
||||
} catch (e: ClientException) {
|
||||
println("4xx response calling PetApi#addPet")
|
||||
e.printStackTrace()
|
||||
} catch (e: ServerException) {
|
||||
println("5xx response calling PetApi#addPet")
|
||||
e.printStackTrace()
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
|
||||
### Return type
|
||||
|
||||
null (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
|
||||
Configure petstore_auth:
|
||||
ApiClient.accessToken = ""
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="deletePet"></a>
|
||||
# **deletePet**
|
||||
> deletePet(petId, apiKey)
|
||||
|
||||
Deletes a pet
|
||||
|
||||
### Example
|
||||
```kotlin
|
||||
// Import classes:
|
||||
//import org.openapitools.client.infrastructure.*
|
||||
//import org.openapitools.client.models.*
|
||||
|
||||
val apiInstance = PetApi()
|
||||
val petId : kotlin.Long = 789 // kotlin.Long | Pet id to delete
|
||||
val apiKey : kotlin.String = apiKey_example // kotlin.String |
|
||||
try {
|
||||
apiInstance.deletePet(petId, apiKey)
|
||||
} catch (e: ClientException) {
|
||||
println("4xx response calling PetApi#deletePet")
|
||||
e.printStackTrace()
|
||||
} catch (e: ServerException) {
|
||||
println("5xx response calling PetApi#deletePet")
|
||||
e.printStackTrace()
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **kotlin.Long**| Pet id to delete |
|
||||
**apiKey** | **kotlin.String**| | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
null (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
|
||||
Configure petstore_auth:
|
||||
ApiClient.accessToken = ""
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="findPetsByStatus"></a>
|
||||
# **findPetsByStatus**
|
||||
> kotlin.Array<Pet> findPetsByStatus(status)
|
||||
|
||||
Finds Pets by status
|
||||
|
||||
Multiple status values can be provided with comma separated strings
|
||||
|
||||
### Example
|
||||
```kotlin
|
||||
// Import classes:
|
||||
//import org.openapitools.client.infrastructure.*
|
||||
//import org.openapitools.client.models.*
|
||||
|
||||
val apiInstance = PetApi()
|
||||
val status : kotlin.Array<kotlin.String> = // kotlin.Array<kotlin.String> | Status values that need to be considered for filter
|
||||
try {
|
||||
val result : kotlin.Array<Pet> = apiInstance.findPetsByStatus(status)
|
||||
println(result)
|
||||
} catch (e: ClientException) {
|
||||
println("4xx response calling PetApi#findPetsByStatus")
|
||||
e.printStackTrace()
|
||||
} catch (e: ServerException) {
|
||||
println("5xx response calling PetApi#findPetsByStatus")
|
||||
e.printStackTrace()
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**status** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Status values that need to be considered for filter | [enum: available, pending, sold]
|
||||
|
||||
### Return type
|
||||
|
||||
[**kotlin.Array<Pet>**](Pet.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
|
||||
Configure petstore_auth:
|
||||
ApiClient.accessToken = ""
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
<a name="findPetsByTags"></a>
|
||||
# **findPetsByTags**
|
||||
> kotlin.Array<Pet> findPetsByTags(tags)
|
||||
|
||||
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.infrastructure.*
|
||||
//import org.openapitools.client.models.*
|
||||
|
||||
val apiInstance = PetApi()
|
||||
val tags : kotlin.Array<kotlin.String> = // kotlin.Array<kotlin.String> | Tags to filter by
|
||||
try {
|
||||
val result : kotlin.Array<Pet> = apiInstance.findPetsByTags(tags)
|
||||
println(result)
|
||||
} catch (e: ClientException) {
|
||||
println("4xx response calling PetApi#findPetsByTags")
|
||||
e.printStackTrace()
|
||||
} catch (e: ServerException) {
|
||||
println("5xx response calling PetApi#findPetsByTags")
|
||||
e.printStackTrace()
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**tags** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Tags to filter by |
|
||||
|
||||
### Return type
|
||||
|
||||
[**kotlin.Array<Pet>**](Pet.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
|
||||
Configure petstore_auth:
|
||||
ApiClient.accessToken = ""
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
<a name="getPetById"></a>
|
||||
# **getPetById**
|
||||
> Pet getPetById(petId)
|
||||
|
||||
Find pet by ID
|
||||
|
||||
Returns a single pet
|
||||
|
||||
### Example
|
||||
```kotlin
|
||||
// Import classes:
|
||||
//import org.openapitools.client.infrastructure.*
|
||||
//import org.openapitools.client.models.*
|
||||
|
||||
val apiInstance = PetApi()
|
||||
val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to return
|
||||
try {
|
||||
val result : Pet = apiInstance.getPetById(petId)
|
||||
println(result)
|
||||
} catch (e: ClientException) {
|
||||
println("4xx response calling PetApi#getPetById")
|
||||
e.printStackTrace()
|
||||
} catch (e: ServerException) {
|
||||
println("5xx response calling PetApi#getPetById")
|
||||
e.printStackTrace()
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **kotlin.Long**| ID of pet to return |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Pet**](Pet.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
|
||||
Configure api_key:
|
||||
ApiClient.apiKey["api_key"] = ""
|
||||
ApiClient.apiKeyPrefix["api_key"] = ""
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
<a name="updatePet"></a>
|
||||
# **updatePet**
|
||||
> updatePet(body)
|
||||
|
||||
Update an existing pet
|
||||
|
||||
### Example
|
||||
```kotlin
|
||||
// Import classes:
|
||||
//import org.openapitools.client.infrastructure.*
|
||||
//import org.openapitools.client.models.*
|
||||
|
||||
val apiInstance = PetApi()
|
||||
val body : Pet = // Pet | Pet object that needs to be added to the store
|
||||
try {
|
||||
apiInstance.updatePet(body)
|
||||
} catch (e: ClientException) {
|
||||
println("4xx response calling PetApi#updatePet")
|
||||
e.printStackTrace()
|
||||
} catch (e: ServerException) {
|
||||
println("5xx response calling PetApi#updatePet")
|
||||
e.printStackTrace()
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
|
||||
### Return type
|
||||
|
||||
null (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
|
||||
Configure petstore_auth:
|
||||
ApiClient.accessToken = ""
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="updatePetWithForm"></a>
|
||||
# **updatePetWithForm**
|
||||
> updatePetWithForm(petId, name, status)
|
||||
|
||||
Updates a pet in the store with form data
|
||||
|
||||
### Example
|
||||
```kotlin
|
||||
// Import classes:
|
||||
//import org.openapitools.client.infrastructure.*
|
||||
//import org.openapitools.client.models.*
|
||||
|
||||
val apiInstance = PetApi()
|
||||
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
|
||||
try {
|
||||
apiInstance.updatePetWithForm(petId, name, status)
|
||||
} catch (e: ClientException) {
|
||||
println("4xx response calling PetApi#updatePetWithForm")
|
||||
e.printStackTrace()
|
||||
} catch (e: ServerException) {
|
||||
println("5xx response calling PetApi#updatePetWithForm")
|
||||
e.printStackTrace()
|
||||
}
|
||||
```
|
||||
|
||||
### 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
|
||||
|
||||
|
||||
Configure petstore_auth:
|
||||
ApiClient.accessToken = ""
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="uploadFile"></a>
|
||||
# **uploadFile**
|
||||
> ApiResponse uploadFile(petId, additionalMetadata, file)
|
||||
|
||||
uploads an image
|
||||
|
||||
### Example
|
||||
```kotlin
|
||||
// Import classes:
|
||||
//import org.openapitools.client.infrastructure.*
|
||||
//import org.openapitools.client.models.*
|
||||
|
||||
val apiInstance = PetApi()
|
||||
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 : io.ktor.client.request.forms.InputProvider = BINARY_DATA_HERE // io.ktor.client.request.forms.InputProvider | file to upload
|
||||
try {
|
||||
val result : ApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file)
|
||||
println(result)
|
||||
} catch (e: ClientException) {
|
||||
println("4xx response calling PetApi#uploadFile")
|
||||
e.printStackTrace()
|
||||
} catch (e: ServerException) {
|
||||
println("5xx response calling PetApi#uploadFile")
|
||||
e.printStackTrace()
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **kotlin.Long**| ID of pet to update |
|
||||
**additionalMetadata** | **kotlin.String**| Additional data to pass to server | [optional]
|
||||
**file** | **io.ktor.client.request.forms.InputProvider**| file to upload | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
[**ApiResponse**](ApiResponse.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
|
||||
Configure petstore_auth:
|
||||
ApiClient.accessToken = ""
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
196
samples/client/petstore/kotlin-multiplatform/docs/StoreApi.md
Normal file
196
samples/client/petstore/kotlin-multiplatform/docs/StoreApi.md
Normal file
@@ -0,0 +1,196 @@
|
||||
# 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
|
||||
|
||||
|
||||
<a name="deleteOrder"></a>
|
||||
# **deleteOrder**
|
||||
> deleteOrder(orderId)
|
||||
|
||||
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.infrastructure.*
|
||||
//import org.openapitools.client.models.*
|
||||
|
||||
val apiInstance = StoreApi()
|
||||
val orderId : kotlin.String = orderId_example // kotlin.String | ID of the order that needs to be deleted
|
||||
try {
|
||||
apiInstance.deleteOrder(orderId)
|
||||
} catch (e: ClientException) {
|
||||
println("4xx response calling StoreApi#deleteOrder")
|
||||
e.printStackTrace()
|
||||
} catch (e: ServerException) {
|
||||
println("5xx response calling StoreApi#deleteOrder")
|
||||
e.printStackTrace()
|
||||
}
|
||||
```
|
||||
|
||||
### 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
|
||||
|
||||
<a name="getInventory"></a>
|
||||
# **getInventory**
|
||||
> kotlin.collections.Map<kotlin.String, kotlin.Int> getInventory()
|
||||
|
||||
Returns pet inventories by status
|
||||
|
||||
Returns a map of status codes to quantities
|
||||
|
||||
### Example
|
||||
```kotlin
|
||||
// Import classes:
|
||||
//import org.openapitools.client.infrastructure.*
|
||||
//import org.openapitools.client.models.*
|
||||
|
||||
val apiInstance = StoreApi()
|
||||
try {
|
||||
val result : kotlin.collections.Map<kotlin.String, kotlin.Int> = apiInstance.getInventory()
|
||||
println(result)
|
||||
} catch (e: ClientException) {
|
||||
println("4xx response calling StoreApi#getInventory")
|
||||
e.printStackTrace()
|
||||
} catch (e: ServerException) {
|
||||
println("5xx response calling StoreApi#getInventory")
|
||||
e.printStackTrace()
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
**kotlin.collections.Map<kotlin.String, kotlin.Int>**
|
||||
|
||||
### Authorization
|
||||
|
||||
|
||||
Configure api_key:
|
||||
ApiClient.apiKey["api_key"] = ""
|
||||
ApiClient.apiKeyPrefix["api_key"] = ""
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json
|
||||
|
||||
<a name="getOrderById"></a>
|
||||
# **getOrderById**
|
||||
> Order getOrderById(orderId)
|
||||
|
||||
Find purchase order by ID
|
||||
|
||||
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
|
||||
### Example
|
||||
```kotlin
|
||||
// Import classes:
|
||||
//import org.openapitools.client.infrastructure.*
|
||||
//import org.openapitools.client.models.*
|
||||
|
||||
val apiInstance = StoreApi()
|
||||
val orderId : kotlin.Long = 789 // kotlin.Long | ID of pet that needs to be fetched
|
||||
try {
|
||||
val result : Order = apiInstance.getOrderById(orderId)
|
||||
println(result)
|
||||
} catch (e: ClientException) {
|
||||
println("4xx response calling StoreApi#getOrderById")
|
||||
e.printStackTrace()
|
||||
} catch (e: ServerException) {
|
||||
println("5xx response calling StoreApi#getOrderById")
|
||||
e.printStackTrace()
|
||||
}
|
||||
```
|
||||
|
||||
### 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
|
||||
|
||||
<a name="placeOrder"></a>
|
||||
# **placeOrder**
|
||||
> Order placeOrder(body)
|
||||
|
||||
Place an order for a pet
|
||||
|
||||
### Example
|
||||
```kotlin
|
||||
// Import classes:
|
||||
//import org.openapitools.client.infrastructure.*
|
||||
//import org.openapitools.client.models.*
|
||||
|
||||
val apiInstance = StoreApi()
|
||||
val body : Order = // Order | order placed for purchasing the pet
|
||||
try {
|
||||
val result : Order = apiInstance.placeOrder(body)
|
||||
println(result)
|
||||
} catch (e: ClientException) {
|
||||
println("4xx response calling StoreApi#placeOrder")
|
||||
e.printStackTrace()
|
||||
} catch (e: ServerException) {
|
||||
println("5xx response calling StoreApi#placeOrder")
|
||||
e.printStackTrace()
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Order**](Order.md)| order placed for purchasing the pet |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Order**](Order.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
11
samples/client/petstore/kotlin-multiplatform/docs/Tag.md
Normal file
11
samples/client/petstore/kotlin-multiplatform/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-multiplatform/docs/User.md
Normal file
17
samples/client/petstore/kotlin-multiplatform/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]
|
||||
|
||||
|
||||
|
||||
376
samples/client/petstore/kotlin-multiplatform/docs/UserApi.md
Normal file
376
samples/client/petstore/kotlin-multiplatform/docs/UserApi.md
Normal file
@@ -0,0 +1,376 @@
|
||||
# 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
|
||||
|
||||
|
||||
<a name="createUser"></a>
|
||||
# **createUser**
|
||||
> createUser(body)
|
||||
|
||||
Create user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
```kotlin
|
||||
// Import classes:
|
||||
//import org.openapitools.client.infrastructure.*
|
||||
//import org.openapitools.client.models.*
|
||||
|
||||
val apiInstance = UserApi()
|
||||
val body : User = // User | Created user object
|
||||
try {
|
||||
apiInstance.createUser(body)
|
||||
} catch (e: ClientException) {
|
||||
println("4xx response calling UserApi#createUser")
|
||||
e.printStackTrace()
|
||||
} catch (e: ServerException) {
|
||||
println("5xx response calling UserApi#createUser")
|
||||
e.printStackTrace()
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**User**](User.md)| Created user object |
|
||||
|
||||
### Return type
|
||||
|
||||
null (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="createUsersWithArrayInput"></a>
|
||||
# **createUsersWithArrayInput**
|
||||
> createUsersWithArrayInput(body)
|
||||
|
||||
Creates list of users with given input array
|
||||
|
||||
### Example
|
||||
```kotlin
|
||||
// Import classes:
|
||||
//import org.openapitools.client.infrastructure.*
|
||||
//import org.openapitools.client.models.*
|
||||
|
||||
val apiInstance = UserApi()
|
||||
val body : kotlin.Array<User> = // kotlin.Array<User> | List of user object
|
||||
try {
|
||||
apiInstance.createUsersWithArrayInput(body)
|
||||
} catch (e: ClientException) {
|
||||
println("4xx response calling UserApi#createUsersWithArrayInput")
|
||||
e.printStackTrace()
|
||||
} catch (e: ServerException) {
|
||||
println("5xx response calling UserApi#createUsersWithArrayInput")
|
||||
e.printStackTrace()
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**kotlin.Array<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
null (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="createUsersWithListInput"></a>
|
||||
# **createUsersWithListInput**
|
||||
> createUsersWithListInput(body)
|
||||
|
||||
Creates list of users with given input array
|
||||
|
||||
### Example
|
||||
```kotlin
|
||||
// Import classes:
|
||||
//import org.openapitools.client.infrastructure.*
|
||||
//import org.openapitools.client.models.*
|
||||
|
||||
val apiInstance = UserApi()
|
||||
val body : kotlin.Array<User> = // kotlin.Array<User> | List of user object
|
||||
try {
|
||||
apiInstance.createUsersWithListInput(body)
|
||||
} catch (e: ClientException) {
|
||||
println("4xx response calling UserApi#createUsersWithListInput")
|
||||
e.printStackTrace()
|
||||
} catch (e: ServerException) {
|
||||
println("5xx response calling UserApi#createUsersWithListInput")
|
||||
e.printStackTrace()
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**kotlin.Array<User>**](User.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
null (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="deleteUser"></a>
|
||||
# **deleteUser**
|
||||
> deleteUser(username)
|
||||
|
||||
Delete user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
```kotlin
|
||||
// Import classes:
|
||||
//import org.openapitools.client.infrastructure.*
|
||||
//import org.openapitools.client.models.*
|
||||
|
||||
val apiInstance = UserApi()
|
||||
val username : kotlin.String = username_example // kotlin.String | The name that needs to be deleted
|
||||
try {
|
||||
apiInstance.deleteUser(username)
|
||||
} catch (e: ClientException) {
|
||||
println("4xx response calling UserApi#deleteUser")
|
||||
e.printStackTrace()
|
||||
} catch (e: ServerException) {
|
||||
println("5xx response calling UserApi#deleteUser")
|
||||
e.printStackTrace()
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **kotlin.String**| The name 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
|
||||
|
||||
<a name="getUserByName"></a>
|
||||
# **getUserByName**
|
||||
> User getUserByName(username)
|
||||
|
||||
Get user by user name
|
||||
|
||||
### Example
|
||||
```kotlin
|
||||
// Import classes:
|
||||
//import org.openapitools.client.infrastructure.*
|
||||
//import org.openapitools.client.models.*
|
||||
|
||||
val apiInstance = UserApi()
|
||||
val username : kotlin.String = username_example // kotlin.String | The name that needs to be fetched. Use user1 for testing.
|
||||
try {
|
||||
val result : User = apiInstance.getUserByName(username)
|
||||
println(result)
|
||||
} catch (e: ClientException) {
|
||||
println("4xx response calling UserApi#getUserByName")
|
||||
e.printStackTrace()
|
||||
} catch (e: ServerException) {
|
||||
println("5xx response calling UserApi#getUserByName")
|
||||
e.printStackTrace()
|
||||
}
|
||||
```
|
||||
|
||||
### 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
|
||||
|
||||
<a name="loginUser"></a>
|
||||
# **loginUser**
|
||||
> kotlin.String loginUser(username, password)
|
||||
|
||||
Logs user into the system
|
||||
|
||||
### Example
|
||||
```kotlin
|
||||
// Import classes:
|
||||
//import org.openapitools.client.infrastructure.*
|
||||
//import org.openapitools.client.models.*
|
||||
|
||||
val apiInstance = UserApi()
|
||||
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
|
||||
try {
|
||||
val result : kotlin.String = apiInstance.loginUser(username, password)
|
||||
println(result)
|
||||
} catch (e: ClientException) {
|
||||
println("4xx response calling UserApi#loginUser")
|
||||
e.printStackTrace()
|
||||
} catch (e: ServerException) {
|
||||
println("5xx response calling UserApi#loginUser")
|
||||
e.printStackTrace()
|
||||
}
|
||||
```
|
||||
|
||||
### 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
|
||||
|
||||
<a name="logoutUser"></a>
|
||||
# **logoutUser**
|
||||
> logoutUser()
|
||||
|
||||
Logs out current logged in user session
|
||||
|
||||
### Example
|
||||
```kotlin
|
||||
// Import classes:
|
||||
//import org.openapitools.client.infrastructure.*
|
||||
//import org.openapitools.client.models.*
|
||||
|
||||
val apiInstance = UserApi()
|
||||
try {
|
||||
apiInstance.logoutUser()
|
||||
} catch (e: ClientException) {
|
||||
println("4xx response calling UserApi#logoutUser")
|
||||
e.printStackTrace()
|
||||
} catch (e: ServerException) {
|
||||
println("5xx response calling UserApi#logoutUser")
|
||||
e.printStackTrace()
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
null (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="updateUser"></a>
|
||||
# **updateUser**
|
||||
> updateUser(username, body)
|
||||
|
||||
Updated user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
```kotlin
|
||||
// Import classes:
|
||||
//import org.openapitools.client.infrastructure.*
|
||||
//import org.openapitools.client.models.*
|
||||
|
||||
val apiInstance = UserApi()
|
||||
val username : kotlin.String = username_example // kotlin.String | name that need to be deleted
|
||||
val body : User = // User | Updated user object
|
||||
try {
|
||||
apiInstance.updateUser(username, body)
|
||||
} catch (e: ClientException) {
|
||||
println("4xx response calling UserApi#updateUser")
|
||||
e.printStackTrace()
|
||||
} catch (e: ServerException) {
|
||||
println("5xx response calling UserApi#updateUser")
|
||||
e.printStackTrace()
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **kotlin.String**| name that need to be deleted |
|
||||
**body** | [**User**](User.md)| Updated user object |
|
||||
|
||||
### Return type
|
||||
|
||||
null (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
BIN
samples/client/petstore/kotlin-multiplatform/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
samples/client/petstore/kotlin-multiplatform/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
samples/client/petstore/kotlin-multiplatform/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
samples/client/petstore/kotlin-multiplatform/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
#Tue May 17 23:08:05 CST 2016
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip
|
||||
160
samples/client/petstore/kotlin-multiplatform/gradlew
vendored
Normal file
160
samples/client/petstore/kotlin-multiplatform/gradlew
vendored
Normal file
@@ -0,0 +1,160 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
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" = "false" -a "$darwin" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
||||
90
samples/client/petstore/kotlin-multiplatform/gradlew.bat
vendored
Normal file
90
samples/client/petstore/kotlin-multiplatform/gradlew.bat
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
@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
|
||||
|
||||
@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=
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
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 init
|
||||
|
||||
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
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
: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 %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
47
samples/client/petstore/kotlin-multiplatform/pom.xml
Normal file
47
samples/client/petstore/kotlin-multiplatform/pom.xml
Normal file
@@ -0,0 +1,47 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>KotlinMultiPlatformClientTests</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>Kotlin MultiPlatform Petstore Client</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>bundle-test</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>/bin/bash</executable>
|
||||
<arguments>
|
||||
<argument>gradlew</argument>
|
||||
<argument>build</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,2 @@
|
||||
enableFeaturePreview('GRADLE_METADATA')
|
||||
rootProject.name = 'kotlin-client-petstore-multiplatform'
|
||||
@@ -0,0 +1,320 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.client.apis
|
||||
|
||||
import org.openapitools.client.models.ApiResponse
|
||||
import org.openapitools.client.models.Pet
|
||||
|
||||
import org.openapitools.client.infrastructure.*
|
||||
import io.ktor.client.request.forms.formData
|
||||
import kotlinx.serialization.UnstableDefault
|
||||
import io.ktor.client.engine.HttpClientEngine
|
||||
import io.ktor.client.features.json.serializer.KotlinxSerializer
|
||||
import kotlinx.serialization.json.Json
|
||||
import kotlinx.serialization.json.JsonConfiguration
|
||||
import io.ktor.http.ParametersBuilder
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.StringDescriptor
|
||||
|
||||
class PetApi @UseExperimental(UnstableDefault::class) constructor(
|
||||
baseUrl: kotlin.String = "http://petstore.swagger.io/v2",
|
||||
httpClientEngine: HttpClientEngine? = null,
|
||||
serializer: KotlinxSerializer)
|
||||
: ApiClient(baseUrl, httpClientEngine, serializer) {
|
||||
|
||||
@UseExperimental(UnstableDefault::class)
|
||||
constructor(
|
||||
baseUrl: kotlin.String = "http://petstore.swagger.io/v2",
|
||||
httpClientEngine: HttpClientEngine? = null,
|
||||
jsonConfiguration: JsonConfiguration = JsonConfiguration.Default)
|
||||
: this(baseUrl, httpClientEngine, KotlinxSerializer(Json(jsonConfiguration)))
|
||||
|
||||
/**
|
||||
* Add a new pet to the store
|
||||
*
|
||||
* @param body Pet object that needs to be added to the store
|
||||
* @return void
|
||||
*/
|
||||
suspend fun addPet(body: Pet) : HttpResponse<Unit> {
|
||||
|
||||
val localVariableBody = body
|
||||
|
||||
val localVariableQuery = mutableMapOf<String, List<String>>()
|
||||
|
||||
val localVariableHeaders = mutableMapOf<String, String>()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.POST,
|
||||
"/pet",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
|
||||
return jsonRequest(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
).wrap()
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Deletes a pet
|
||||
*
|
||||
* @param petId Pet id to delete
|
||||
* @param apiKey (optional)
|
||||
* @return void
|
||||
*/
|
||||
suspend fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : HttpResponse<Unit> {
|
||||
|
||||
val localVariableBody =
|
||||
io.ktor.client.utils.EmptyContent
|
||||
|
||||
val localVariableQuery = mutableMapOf<String, List<String>>()
|
||||
|
||||
val localVariableHeaders = mutableMapOf<String, String>()
|
||||
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.DELETE,
|
||||
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
|
||||
return request(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
).wrap()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Finds Pets by status
|
||||
* Multiple status values can be provided with comma separated strings
|
||||
* @param status Status values that need to be considered for filter
|
||||
* @return kotlin.Array<Pet>
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
suspend fun findPetsByStatus(status: kotlin.Array<kotlin.String>) : HttpResponse<kotlin.Array<Pet>> {
|
||||
|
||||
val localVariableBody =
|
||||
io.ktor.client.utils.EmptyContent
|
||||
|
||||
val localVariableQuery = mutableMapOf<String, List<String>>()
|
||||
status?.apply { localVariableQuery["status"] = toMultiValue(this, "csv") }
|
||||
|
||||
val localVariableHeaders = mutableMapOf<String, String>()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.GET,
|
||||
"/pet/findByStatus",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
|
||||
return request(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
).wrap<FindPetsByStatusResponse>().map { value.toTypedArray() }
|
||||
}
|
||||
|
||||
@Serializable
|
||||
private class FindPetsByStatusResponse(val value: List<Pet>) {
|
||||
@Serializer(FindPetsByStatusResponse::class)
|
||||
companion object : KSerializer<FindPetsByStatusResponse> {
|
||||
private val serializer: KSerializer<List<Pet>> = Pet.serializer().list
|
||||
override val descriptor = StringDescriptor.withName("FindPetsByStatusResponse")
|
||||
override fun serialize(encoder: Encoder, obj: FindPetsByStatusResponse) = serializer.serialize(encoder, obj.value)
|
||||
override fun deserialize(decoder: Decoder) = FindPetsByStatusResponse(serializer.deserialize(decoder))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds Pets by tags
|
||||
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
* @param tags Tags to filter by
|
||||
* @return kotlin.Array<Pet>
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
suspend fun findPetsByTags(tags: kotlin.Array<kotlin.String>) : HttpResponse<kotlin.Array<Pet>> {
|
||||
|
||||
val localVariableBody =
|
||||
io.ktor.client.utils.EmptyContent
|
||||
|
||||
val localVariableQuery = mutableMapOf<String, List<String>>()
|
||||
tags?.apply { localVariableQuery["tags"] = toMultiValue(this, "csv") }
|
||||
|
||||
val localVariableHeaders = mutableMapOf<String, String>()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.GET,
|
||||
"/pet/findByTags",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
|
||||
return request(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
).wrap<FindPetsByTagsResponse>().map { value.toTypedArray() }
|
||||
}
|
||||
|
||||
@Serializable
|
||||
private class FindPetsByTagsResponse(val value: List<Pet>) {
|
||||
@Serializer(FindPetsByTagsResponse::class)
|
||||
companion object : KSerializer<FindPetsByTagsResponse> {
|
||||
private val serializer: KSerializer<List<Pet>> = Pet.serializer().list
|
||||
override val descriptor = StringDescriptor.withName("FindPetsByTagsResponse")
|
||||
override fun serialize(encoder: Encoder, obj: FindPetsByTagsResponse) = serializer.serialize(encoder, obj.value)
|
||||
override fun deserialize(decoder: Decoder) = FindPetsByTagsResponse(serializer.deserialize(decoder))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find pet by ID
|
||||
* Returns a single pet
|
||||
* @param petId ID of pet to return
|
||||
* @return Pet
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
suspend fun getPetById(petId: kotlin.Long) : HttpResponse<Pet> {
|
||||
|
||||
val localVariableBody =
|
||||
io.ktor.client.utils.EmptyContent
|
||||
|
||||
val localVariableQuery = mutableMapOf<String, List<String>>()
|
||||
|
||||
val localVariableHeaders = mutableMapOf<String, String>()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.GET,
|
||||
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
|
||||
return request(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
).wrap()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update an existing pet
|
||||
*
|
||||
* @param body Pet object that needs to be added to the store
|
||||
* @return void
|
||||
*/
|
||||
suspend fun updatePet(body: Pet) : HttpResponse<Unit> {
|
||||
|
||||
val localVariableBody = body
|
||||
|
||||
val localVariableQuery = mutableMapOf<String, List<String>>()
|
||||
|
||||
val localVariableHeaders = mutableMapOf<String, String>()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.PUT,
|
||||
"/pet",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
|
||||
return jsonRequest(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
).wrap()
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Updates a pet in the store with form data
|
||||
*
|
||||
* @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 void
|
||||
*/
|
||||
suspend fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : HttpResponse<Unit> {
|
||||
|
||||
val localVariableBody =
|
||||
ParametersBuilder().also {
|
||||
name?.apply { it.append("name", name.toString()) }
|
||||
status?.apply { it.append("status", status.toString()) }
|
||||
}.build()
|
||||
|
||||
val localVariableQuery = mutableMapOf<String, List<String>>()
|
||||
|
||||
val localVariableHeaders = mutableMapOf<String, String>()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.POST,
|
||||
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
|
||||
return urlEncodedFormRequest(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
).wrap()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* @param petId ID of pet to update
|
||||
* @param additionalMetadata Additional data to pass to server (optional)
|
||||
* @param file file to upload (optional)
|
||||
* @return ApiResponse
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: io.ktor.client.request.forms.InputProvider?) : HttpResponse<ApiResponse> {
|
||||
|
||||
val localVariableBody =
|
||||
formData {
|
||||
additionalMetadata?.apply { append("additionalMetadata", additionalMetadata) }
|
||||
file?.apply { append("file", file) }
|
||||
}
|
||||
|
||||
val localVariableQuery = mutableMapOf<String, List<String>>()
|
||||
|
||||
val localVariableHeaders = mutableMapOf<String, String>()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.POST,
|
||||
"/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
|
||||
return multipartFormRequest(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
).wrap()
|
||||
}
|
||||
|
||||
|
||||
|
||||
companion object {
|
||||
internal fun setMappers(serializer: KotlinxSerializer) {
|
||||
|
||||
serializer.setMapper(FindPetsByStatusResponse::class, FindPetsByStatusResponse.serializer())
|
||||
serializer.setMapper(FindPetsByTagsResponse::class, FindPetsByTagsResponse.serializer())
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.client.apis
|
||||
|
||||
import org.openapitools.client.models.Order
|
||||
|
||||
import org.openapitools.client.infrastructure.*
|
||||
import io.ktor.client.request.forms.formData
|
||||
import kotlinx.serialization.UnstableDefault
|
||||
import io.ktor.client.engine.HttpClientEngine
|
||||
import io.ktor.client.features.json.serializer.KotlinxSerializer
|
||||
import kotlinx.serialization.json.Json
|
||||
import kotlinx.serialization.json.JsonConfiguration
|
||||
import io.ktor.http.ParametersBuilder
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.StringDescriptor
|
||||
|
||||
class StoreApi @UseExperimental(UnstableDefault::class) constructor(
|
||||
baseUrl: kotlin.String = "http://petstore.swagger.io/v2",
|
||||
httpClientEngine: HttpClientEngine? = null,
|
||||
serializer: KotlinxSerializer)
|
||||
: ApiClient(baseUrl, httpClientEngine, serializer) {
|
||||
|
||||
@UseExperimental(UnstableDefault::class)
|
||||
constructor(
|
||||
baseUrl: kotlin.String = "http://petstore.swagger.io/v2",
|
||||
httpClientEngine: HttpClientEngine? = null,
|
||||
jsonConfiguration: JsonConfiguration = JsonConfiguration.Default)
|
||||
: this(baseUrl, httpClientEngine, KotlinxSerializer(Json(jsonConfiguration)))
|
||||
|
||||
/**
|
||||
* Delete purchase order by ID
|
||||
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
* @param orderId ID of the order that needs to be deleted
|
||||
* @return void
|
||||
*/
|
||||
suspend fun deleteOrder(orderId: kotlin.String) : HttpResponse<Unit> {
|
||||
|
||||
val localVariableBody =
|
||||
io.ktor.client.utils.EmptyContent
|
||||
|
||||
val localVariableQuery = mutableMapOf<String, List<String>>()
|
||||
|
||||
val localVariableHeaders = mutableMapOf<String, String>()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.DELETE,
|
||||
"/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
|
||||
return request(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
).wrap()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns pet inventories by status
|
||||
* Returns a map of status codes to quantities
|
||||
* @return kotlin.collections.Map<kotlin.String, kotlin.Int>
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
suspend fun getInventory() : HttpResponse<kotlin.collections.Map<kotlin.String, kotlin.Int>> {
|
||||
|
||||
val localVariableBody =
|
||||
io.ktor.client.utils.EmptyContent
|
||||
|
||||
val localVariableQuery = mutableMapOf<String, List<String>>()
|
||||
|
||||
val localVariableHeaders = mutableMapOf<String, String>()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.GET,
|
||||
"/store/inventory",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
|
||||
return request(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
).wrap<GetInventoryResponse>().map { value }
|
||||
}
|
||||
|
||||
@Serializable
|
||||
private class GetInventoryResponse(val value: Map<kotlin.String, kotlin.Int>) {
|
||||
@Serializer(GetInventoryResponse::class)
|
||||
companion object : KSerializer<GetInventoryResponse> {
|
||||
private val serializer: KSerializer<Map<kotlin.String, kotlin.Int>> = (kotlin.String.serializer() to kotlin.Int.serializer()).map
|
||||
override val descriptor = StringDescriptor.withName("GetInventoryResponse")
|
||||
override fun serialize(encoder: Encoder, obj: GetInventoryResponse) = serializer.serialize(encoder, obj.value)
|
||||
override fun deserialize(decoder: Decoder) = GetInventoryResponse(serializer.deserialize(decoder))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find purchase order by ID
|
||||
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
* @param orderId ID of pet that needs to be fetched
|
||||
* @return Order
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
suspend fun getOrderById(orderId: kotlin.Long) : HttpResponse<Order> {
|
||||
|
||||
val localVariableBody =
|
||||
io.ktor.client.utils.EmptyContent
|
||||
|
||||
val localVariableQuery = mutableMapOf<String, List<String>>()
|
||||
|
||||
val localVariableHeaders = mutableMapOf<String, String>()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.GET,
|
||||
"/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
|
||||
return request(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
).wrap()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Place an order for a pet
|
||||
*
|
||||
* @param body order placed for purchasing the pet
|
||||
* @return Order
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
suspend fun placeOrder(body: Order) : HttpResponse<Order> {
|
||||
|
||||
val localVariableBody = body
|
||||
|
||||
val localVariableQuery = mutableMapOf<String, List<String>>()
|
||||
|
||||
val localVariableHeaders = mutableMapOf<String, String>()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.POST,
|
||||
"/store/order",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
|
||||
return jsonRequest(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
).wrap()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
companion object {
|
||||
internal fun setMappers(serializer: KotlinxSerializer) {
|
||||
serializer.setMapper(GetInventoryResponse::class, GetInventoryResponse.serializer())
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,304 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.client.apis
|
||||
|
||||
import org.openapitools.client.models.User
|
||||
|
||||
import org.openapitools.client.infrastructure.*
|
||||
import io.ktor.client.request.forms.formData
|
||||
import kotlinx.serialization.UnstableDefault
|
||||
import io.ktor.client.engine.HttpClientEngine
|
||||
import io.ktor.client.features.json.serializer.KotlinxSerializer
|
||||
import kotlinx.serialization.json.Json
|
||||
import kotlinx.serialization.json.JsonConfiguration
|
||||
import io.ktor.http.ParametersBuilder
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.StringDescriptor
|
||||
|
||||
class UserApi @UseExperimental(UnstableDefault::class) constructor(
|
||||
baseUrl: kotlin.String = "http://petstore.swagger.io/v2",
|
||||
httpClientEngine: HttpClientEngine? = null,
|
||||
serializer: KotlinxSerializer)
|
||||
: ApiClient(baseUrl, httpClientEngine, serializer) {
|
||||
|
||||
@UseExperimental(UnstableDefault::class)
|
||||
constructor(
|
||||
baseUrl: kotlin.String = "http://petstore.swagger.io/v2",
|
||||
httpClientEngine: HttpClientEngine? = null,
|
||||
jsonConfiguration: JsonConfiguration = JsonConfiguration.Default)
|
||||
: this(baseUrl, httpClientEngine, KotlinxSerializer(Json(jsonConfiguration)))
|
||||
|
||||
/**
|
||||
* Create user
|
||||
* This can only be done by the logged in user.
|
||||
* @param body Created user object
|
||||
* @return void
|
||||
*/
|
||||
suspend fun createUser(body: User) : HttpResponse<Unit> {
|
||||
|
||||
val localVariableBody = body
|
||||
|
||||
val localVariableQuery = mutableMapOf<String, List<String>>()
|
||||
|
||||
val localVariableHeaders = mutableMapOf<String, String>()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.POST,
|
||||
"/user",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
|
||||
return jsonRequest(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
).wrap()
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
* @param body List of user object
|
||||
* @return void
|
||||
*/
|
||||
suspend fun createUsersWithArrayInput(body: kotlin.Array<User>) : HttpResponse<Unit> {
|
||||
|
||||
val localVariableBody = CreateUsersWithArrayInputRequest(body.asList())
|
||||
|
||||
val localVariableQuery = mutableMapOf<String, List<String>>()
|
||||
|
||||
val localVariableHeaders = mutableMapOf<String, String>()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.POST,
|
||||
"/user/createWithArray",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
|
||||
return jsonRequest(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
).wrap()
|
||||
}
|
||||
|
||||
@Serializable
|
||||
private class CreateUsersWithArrayInputRequest(val value: List<User>) {
|
||||
@Serializer(CreateUsersWithArrayInputRequest::class)
|
||||
companion object : KSerializer<CreateUsersWithArrayInputRequest> {
|
||||
private val serializer: KSerializer<List<User>> = User.serializer().list
|
||||
override val descriptor = StringDescriptor.withName("CreateUsersWithArrayInputRequest")
|
||||
override fun serialize(encoder: Encoder, obj: CreateUsersWithArrayInputRequest) = serializer.serialize(encoder, obj.value)
|
||||
override fun deserialize(decoder: Decoder) = CreateUsersWithArrayInputRequest(serializer.deserialize(decoder))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
* @param body List of user object
|
||||
* @return void
|
||||
*/
|
||||
suspend fun createUsersWithListInput(body: kotlin.Array<User>) : HttpResponse<Unit> {
|
||||
|
||||
val localVariableBody = CreateUsersWithListInputRequest(body.asList())
|
||||
|
||||
val localVariableQuery = mutableMapOf<String, List<String>>()
|
||||
|
||||
val localVariableHeaders = mutableMapOf<String, String>()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.POST,
|
||||
"/user/createWithList",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
|
||||
return jsonRequest(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
).wrap()
|
||||
}
|
||||
|
||||
@Serializable
|
||||
private class CreateUsersWithListInputRequest(val value: List<User>) {
|
||||
@Serializer(CreateUsersWithListInputRequest::class)
|
||||
companion object : KSerializer<CreateUsersWithListInputRequest> {
|
||||
private val serializer: KSerializer<List<User>> = User.serializer().list
|
||||
override val descriptor = StringDescriptor.withName("CreateUsersWithListInputRequest")
|
||||
override fun serialize(encoder: Encoder, obj: CreateUsersWithListInputRequest) = serializer.serialize(encoder, obj.value)
|
||||
override fun deserialize(decoder: Decoder) = CreateUsersWithListInputRequest(serializer.deserialize(decoder))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete user
|
||||
* This can only be done by the logged in user.
|
||||
* @param username The name that needs to be deleted
|
||||
* @return void
|
||||
*/
|
||||
suspend fun deleteUser(username: kotlin.String) : HttpResponse<Unit> {
|
||||
|
||||
val localVariableBody =
|
||||
io.ktor.client.utils.EmptyContent
|
||||
|
||||
val localVariableQuery = mutableMapOf<String, List<String>>()
|
||||
|
||||
val localVariableHeaders = mutableMapOf<String, String>()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.DELETE,
|
||||
"/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
|
||||
return request(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
).wrap()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get user by user name
|
||||
*
|
||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||
* @return User
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
suspend fun getUserByName(username: kotlin.String) : HttpResponse<User> {
|
||||
|
||||
val localVariableBody =
|
||||
io.ktor.client.utils.EmptyContent
|
||||
|
||||
val localVariableQuery = mutableMapOf<String, List<String>>()
|
||||
|
||||
val localVariableHeaders = mutableMapOf<String, String>()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.GET,
|
||||
"/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
|
||||
return request(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
).wrap()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Logs user into the system
|
||||
*
|
||||
* @param username The user name for login
|
||||
* @param password The password for login in clear text
|
||||
* @return kotlin.String
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
suspend fun loginUser(username: kotlin.String, password: kotlin.String) : HttpResponse<kotlin.String> {
|
||||
|
||||
val localVariableBody =
|
||||
io.ktor.client.utils.EmptyContent
|
||||
|
||||
val localVariableQuery = mutableMapOf<String, List<String>>()
|
||||
username?.apply { localVariableQuery["username"] = listOf("$username") }
|
||||
password?.apply { localVariableQuery["password"] = listOf("$password") }
|
||||
|
||||
val localVariableHeaders = mutableMapOf<String, String>()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.GET,
|
||||
"/user/login",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
|
||||
return request(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
).wrap()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Logs out current logged in user session
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
suspend fun logoutUser() : HttpResponse<Unit> {
|
||||
|
||||
val localVariableBody =
|
||||
io.ktor.client.utils.EmptyContent
|
||||
|
||||
val localVariableQuery = mutableMapOf<String, List<String>>()
|
||||
|
||||
val localVariableHeaders = mutableMapOf<String, String>()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.GET,
|
||||
"/user/logout",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
|
||||
return request(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
).wrap()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updated user
|
||||
* This can only be done by the logged in user.
|
||||
* @param username name that need to be deleted
|
||||
* @param body Updated user object
|
||||
* @return void
|
||||
*/
|
||||
suspend fun updateUser(username: kotlin.String, body: User) : HttpResponse<Unit> {
|
||||
|
||||
val localVariableBody = body
|
||||
|
||||
val localVariableQuery = mutableMapOf<String, List<String>>()
|
||||
|
||||
val localVariableHeaders = mutableMapOf<String, String>()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.PUT,
|
||||
"/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
|
||||
return jsonRequest(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
).wrap()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
companion object {
|
||||
internal fun setMappers(serializer: KotlinxSerializer) {
|
||||
|
||||
serializer.setMapper(CreateUsersWithArrayInputRequest::class, CreateUsersWithArrayInputRequest.serializer())
|
||||
serializer.setMapper(CreateUsersWithListInputRequest::class, CreateUsersWithListInputRequest.serializer())
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
typealias MultiValueMap = Map<String,List<String>>
|
||||
|
||||
fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) {
|
||||
"csv" -> ","
|
||||
"tsv" -> "\t"
|
||||
"pipes" -> "|"
|
||||
"ssv" -> " "
|
||||
else -> ""
|
||||
}
|
||||
|
||||
val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" }
|
||||
|
||||
fun <T : Any?> toMultiValue(items: Array<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter)
|
||||
= toMultiValue(items.asIterable(), collectionFormat, map)
|
||||
|
||||
fun <T : Any?> toMultiValue(items: Iterable<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List<String> {
|
||||
return when(collectionFormat) {
|
||||
"multi" -> items.map(map)
|
||||
else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import io.ktor.client.HttpClient
|
||||
import io.ktor.client.HttpClientConfig
|
||||
import io.ktor.client.call.call
|
||||
import io.ktor.client.engine.HttpClientEngine
|
||||
import io.ktor.client.features.json.JsonFeature
|
||||
import io.ktor.client.features.json.JsonSerializer
|
||||
import io.ktor.client.features.json.serializer.KotlinxSerializer
|
||||
import io.ktor.client.request.accept
|
||||
import io.ktor.client.request.forms.FormDataContent
|
||||
import io.ktor.client.request.forms.MultiPartFormDataContent
|
||||
import io.ktor.client.request.header
|
||||
import io.ktor.client.request.parameter
|
||||
import io.ktor.client.response.HttpResponse
|
||||
import io.ktor.client.utils.EmptyContent
|
||||
import io.ktor.http.*
|
||||
import io.ktor.http.content.OutgoingContent
|
||||
import io.ktor.http.content.PartData
|
||||
import kotlinx.serialization.UnstableDefault
|
||||
import kotlinx.serialization.json.Json
|
||||
import kotlinx.serialization.json.JsonConfiguration
|
||||
|
||||
import org.openapitools.client.apis.*
|
||||
import org.openapitools.client.models.*
|
||||
|
||||
open class ApiClient(
|
||||
private val baseUrl: String,
|
||||
httpClientEngine: HttpClientEngine?,
|
||||
serializer: KotlinxSerializer) {
|
||||
|
||||
@UseExperimental(UnstableDefault::class)
|
||||
constructor(
|
||||
baseUrl: String,
|
||||
httpClientEngine: HttpClientEngine?,
|
||||
jsonConfiguration: JsonConfiguration) :
|
||||
this(baseUrl, httpClientEngine, KotlinxSerializer(Json(jsonConfiguration)))
|
||||
|
||||
private val serializer: JsonSerializer by lazy {
|
||||
serializer.apply { setMappers(this) }.ignoreOutgoingContent()
|
||||
}
|
||||
|
||||
private val client: HttpClient by lazy {
|
||||
val jsonConfig: JsonFeature.Config.() -> Unit = { this.serializer = this@ApiClient.serializer }
|
||||
val clientConfig: (HttpClientConfig<*>) -> Unit = { it.install(JsonFeature, jsonConfig) }
|
||||
httpClientEngine?.let { HttpClient(it, clientConfig) } ?: HttpClient(clientConfig)
|
||||
}
|
||||
|
||||
companion object {
|
||||
protected val UNSAFE_HEADERS = listOf(HttpHeaders.ContentType)
|
||||
|
||||
private fun setMappers(serializer: KotlinxSerializer) {
|
||||
|
||||
PetApi.setMappers(serializer)
|
||||
|
||||
StoreApi.setMappers(serializer)
|
||||
|
||||
UserApi.setMappers(serializer)
|
||||
|
||||
serializer.setMapper(ApiResponse::class, ApiResponse.serializer())
|
||||
serializer.setMapper(Category::class, Category.serializer())
|
||||
serializer.setMapper(Order::class, Order.serializer())
|
||||
serializer.setMapper(Pet::class, Pet.serializer())
|
||||
serializer.setMapper(Tag::class, Tag.serializer())
|
||||
serializer.setMapper(User::class, User.serializer())
|
||||
}
|
||||
}
|
||||
|
||||
protected suspend fun multipartFormRequest(requestConfig: RequestConfig, body: List<PartData>?): HttpResponse {
|
||||
return request(requestConfig, MultiPartFormDataContent(body ?: listOf()))
|
||||
}
|
||||
|
||||
protected suspend fun urlEncodedFormRequest(requestConfig: RequestConfig, body: Parameters?): HttpResponse {
|
||||
return request(requestConfig, FormDataContent(body ?: Parameters.Empty))
|
||||
}
|
||||
|
||||
protected suspend fun jsonRequest(requestConfig: RequestConfig, body: Any? = null): HttpResponse {
|
||||
val contentType = (requestConfig.headers[HttpHeaders.ContentType]?.let { ContentType.parse(it) }
|
||||
?: ContentType.Application.Json)
|
||||
return if (body != null) request(requestConfig, serializer.write(body, contentType))
|
||||
else request(requestConfig)
|
||||
}
|
||||
|
||||
protected suspend fun request(requestConfig: RequestConfig, body: OutgoingContent = EmptyContent): HttpResponse {
|
||||
val headers = requestConfig.headers
|
||||
|
||||
return client.call {
|
||||
this.url {
|
||||
this.takeFrom(URLBuilder(baseUrl))
|
||||
appendPath(requestConfig.path.trimStart('/').split('/'))
|
||||
requestConfig.query.forEach { query ->
|
||||
query.value.forEach { value ->
|
||||
parameter(query.key, value)
|
||||
}
|
||||
}
|
||||
}
|
||||
this.method = requestConfig.method.httpMethod
|
||||
headers.filter { header -> !UNSAFE_HEADERS.contains(header.key) }.forEach { header -> this.header(header.key, header.value) }
|
||||
if (requestConfig.method in listOf(RequestMethod.PUT, RequestMethod.POST, RequestMethod.PATCH))
|
||||
this.body = body
|
||||
|
||||
}.response
|
||||
}
|
||||
|
||||
private fun URLBuilder.appendPath(components: List<String>): URLBuilder = apply {
|
||||
encodedPath = encodedPath.trimEnd('/') + components.joinToString("/", prefix = "/") { it.encodeURLQueryComponent() }
|
||||
}
|
||||
|
||||
private val RequestMethod.httpMethod: HttpMethod
|
||||
get() = when (this) {
|
||||
RequestMethod.DELETE -> HttpMethod.Delete
|
||||
RequestMethod.GET -> HttpMethod.Get
|
||||
RequestMethod.HEAD -> HttpMethod.Head
|
||||
RequestMethod.PATCH -> HttpMethod.Patch
|
||||
RequestMethod.PUT -> HttpMethod.Put
|
||||
RequestMethod.POST -> HttpMethod.Post
|
||||
RequestMethod.OPTIONS -> HttpMethod.Options
|
||||
}
|
||||
}
|
||||
|
||||
// https://github.com/ktorio/ktor/issues/851
|
||||
private fun JsonSerializer.ignoreOutgoingContent() = IgnoreOutgoingContentJsonSerializer(this)
|
||||
|
||||
private class IgnoreOutgoingContentJsonSerializer(private val delegate: JsonSerializer) : JsonSerializer by delegate {
|
||||
override fun write(data: Any): OutgoingContent {
|
||||
if (data is OutgoingContent) return data
|
||||
return delegate.write(data)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import io.ktor.client.call.TypeInfo
|
||||
import io.ktor.client.call.typeInfo
|
||||
import io.ktor.http.Headers
|
||||
import io.ktor.http.isSuccess
|
||||
|
||||
open class HttpResponse<T : Any>(val response: io.ktor.client.response.HttpResponse, val provider: BodyProvider<T>) {
|
||||
val status: Int = response.status.value
|
||||
val success: Boolean = response.status.isSuccess()
|
||||
val headers: Map<String, List<String>> = response.headers.mapEntries()
|
||||
suspend fun body(): T = provider.body(response)
|
||||
suspend fun <V : Any> typedBody(type: TypeInfo): V = provider.typedBody(response, type)
|
||||
|
||||
companion object {
|
||||
private fun Headers.mapEntries(): Map<String, List<String>> {
|
||||
val result = mutableMapOf<String, List<String>>()
|
||||
entries().forEach { result[it.key] = it.value }
|
||||
return result
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface BodyProvider<T : Any> {
|
||||
suspend fun body(response: io.ktor.client.response.HttpResponse): T
|
||||
suspend fun <V : Any> typedBody(response: io.ktor.client.response.HttpResponse, type: TypeInfo): V
|
||||
}
|
||||
|
||||
class TypedBodyProvider<T : Any>(private val type: TypeInfo) : BodyProvider<T> {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
override suspend fun body(response: io.ktor.client.response.HttpResponse): T =
|
||||
response.call.receive(type) as T
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
override suspend fun <V : Any> typedBody(response: io.ktor.client.response.HttpResponse, type: TypeInfo): V =
|
||||
response.call.receive(type) as V
|
||||
}
|
||||
|
||||
class MappedBodyProvider<S : Any, T : Any>(private val provider: BodyProvider<S>, private val block: S.() -> T) : BodyProvider<T> {
|
||||
override suspend fun body(response: io.ktor.client.response.HttpResponse): T =
|
||||
block(provider.body(response))
|
||||
|
||||
override suspend fun <V : Any> typedBody(response: io.ktor.client.response.HttpResponse, type: TypeInfo): V =
|
||||
provider.typedBody(response, type)
|
||||
}
|
||||
|
||||
inline fun <reified T : Any> io.ktor.client.response.HttpResponse.wrap(): HttpResponse<T> =
|
||||
HttpResponse(this, TypedBodyProvider(typeInfo<T>()))
|
||||
|
||||
fun <T : Any, V : Any> HttpResponse<T>.map(block: T.() -> V): HttpResponse<V> =
|
||||
HttpResponse(response, MappedBodyProvider(provider, block))
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
/**
|
||||
* Defines a config object for a given request.
|
||||
* NOTE: This object doesn't include 'body' because it
|
||||
* allows for caching of the constructed object
|
||||
* for many request definitions.
|
||||
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
||||
* multi-valued headers as csv-only.
|
||||
*/
|
||||
data class RequestConfig(
|
||||
val method: RequestMethod,
|
||||
val path: String,
|
||||
val headers: MutableMap<String, String> = mutableMapOf(),
|
||||
val query: Map<String, List<String>> = mapOf()
|
||||
)
|
||||
@@ -0,0 +1,8 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
/**
|
||||
* Provides enumerated HTTP verbs
|
||||
*/
|
||||
enum class RequestMethod {
|
||||
GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.client.models
|
||||
|
||||
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.CommonEnumSerializer
|
||||
/**
|
||||
* Describes the result of uploading an image resource
|
||||
* @param code
|
||||
* @param type
|
||||
* @param message
|
||||
*/
|
||||
@Serializable
|
||||
data class ApiResponse (
|
||||
@SerialName(value = "code") val code: kotlin.Int? = null,
|
||||
@SerialName(value = "type") val type: kotlin.String? = null,
|
||||
@SerialName(value = "message") val message: kotlin.String? = null
|
||||
)
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.client.models
|
||||
|
||||
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.CommonEnumSerializer
|
||||
/**
|
||||
* A category for a pet
|
||||
* @param id
|
||||
* @param name
|
||||
*/
|
||||
@Serializable
|
||||
data class Category (
|
||||
@SerialName(value = "id") val id: kotlin.Long? = null,
|
||||
@SerialName(value = "name") val name: kotlin.String? = null
|
||||
)
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.client.models
|
||||
|
||||
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.CommonEnumSerializer
|
||||
/**
|
||||
* An order for a pets from the pet store
|
||||
* @param id
|
||||
* @param petId
|
||||
* @param quantity
|
||||
* @param shipDate
|
||||
* @param status Order Status
|
||||
* @param complete
|
||||
*/
|
||||
@Serializable
|
||||
data class Order (
|
||||
@SerialName(value = "id") val id: kotlin.Long? = null,
|
||||
@SerialName(value = "petId") val petId: kotlin.Long? = null,
|
||||
@SerialName(value = "quantity") val quantity: kotlin.Int? = null,
|
||||
@SerialName(value = "shipDate") val shipDate: kotlin.String? = null,
|
||||
/* Order Status */
|
||||
@SerialName(value = "status") val status: Order.Status? = null,
|
||||
@SerialName(value = "complete") val complete: kotlin.Boolean? = null
|
||||
)
|
||||
{
|
||||
|
||||
/**
|
||||
* Order Status
|
||||
* Values: placed,approved,delivered
|
||||
*/
|
||||
@Serializable(with = Status.Serializer::class)
|
||||
enum class Status(val value: kotlin.String){
|
||||
|
||||
placed("placed"),
|
||||
|
||||
approved("approved"),
|
||||
|
||||
delivered("delivered");
|
||||
|
||||
|
||||
object Serializer : CommonEnumSerializer<Status>("Status", values(), values().map { it.value }.toTypedArray())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.client.models
|
||||
|
||||
import org.openapitools.client.models.Category
|
||||
import org.openapitools.client.models.Tag
|
||||
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.CommonEnumSerializer
|
||||
/**
|
||||
* A pet for sale in the pet store
|
||||
* @param id
|
||||
* @param category
|
||||
* @param name
|
||||
* @param photoUrls
|
||||
* @param tags
|
||||
* @param status pet status in the store
|
||||
*/
|
||||
@Serializable
|
||||
data class Pet (
|
||||
@SerialName(value = "name") @Required val name: kotlin.String,
|
||||
@SerialName(value = "photoUrls") @Required val photoUrls: kotlin.Array<kotlin.String>,
|
||||
@SerialName(value = "id") val id: kotlin.Long? = null,
|
||||
@SerialName(value = "category") val category: Category? = null,
|
||||
@SerialName(value = "tags") val tags: kotlin.Array<Tag>? = null,
|
||||
/* pet status in the store */
|
||||
@SerialName(value = "status") val status: Pet.Status? = null
|
||||
)
|
||||
{
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
* Values: available,pending,sold
|
||||
*/
|
||||
@Serializable(with = Status.Serializer::class)
|
||||
enum class Status(val value: kotlin.String){
|
||||
|
||||
available("available"),
|
||||
|
||||
pending("pending"),
|
||||
|
||||
sold("sold");
|
||||
|
||||
|
||||
object Serializer : CommonEnumSerializer<Status>("Status", values(), values().map { it.value }.toTypedArray())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.client.models
|
||||
|
||||
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.CommonEnumSerializer
|
||||
/**
|
||||
* A tag for a pet
|
||||
* @param id
|
||||
* @param name
|
||||
*/
|
||||
@Serializable
|
||||
data class Tag (
|
||||
@SerialName(value = "id") val id: kotlin.Long? = null,
|
||||
@SerialName(value = "name") val name: kotlin.String? = null
|
||||
)
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.client.models
|
||||
|
||||
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.CommonEnumSerializer
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
@Serializable
|
||||
data class User (
|
||||
@SerialName(value = "id") val id: kotlin.Long? = null,
|
||||
@SerialName(value = "username") val username: kotlin.String? = null,
|
||||
@SerialName(value = "firstName") val firstName: kotlin.String? = null,
|
||||
@SerialName(value = "lastName") val lastName: kotlin.String? = null,
|
||||
@SerialName(value = "email") val email: kotlin.String? = null,
|
||||
@SerialName(value = "password") val password: kotlin.String? = null,
|
||||
@SerialName(value = "phone") val phone: kotlin.String? = null,
|
||||
/* User Status */
|
||||
@SerialName(value = "userStatus") val userStatus: kotlin.Int? = null
|
||||
)
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
package util
|
||||
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
|
||||
/**
|
||||
* Block the current thread until execution of the given coroutine is complete.
|
||||
*
|
||||
* @param block The coroutine code.
|
||||
* @return The result of the coroutine.
|
||||
*/
|
||||
internal expect fun <T> runTest(block: suspend CoroutineScope.() -> T): T
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
package util
|
||||
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlin.coroutines.EmptyCoroutineContext
|
||||
|
||||
internal actual fun <T> runTest(block: suspend CoroutineScope.() -> T): T = kotlinx.coroutines.runBlocking(EmptyCoroutineContext, block)
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
package util
|
||||
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlin.coroutines.EmptyCoroutineContext
|
||||
|
||||
internal actual fun <T> runTest(block: suspend CoroutineScope.() -> T): T = kotlinx.coroutines.runBlocking(EmptyCoroutineContext, block)
|
||||
Reference in New Issue
Block a user