Skip to content

Commit 2568913

Browse files
committed
updated kotlin client sample
1 parent 6b039e8 commit 2568913

26 files changed

+363
-109
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0.19-SNAPSHOT
1+
3.0.25-SNAPSHOT

samples/client/petstore/kotlin/README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
## Requires
44

5-
* Kotlin 1.1.2
6-
* Gradle 3.3
5+
* Kotlin 1.3.72
6+
* Gradle 4.9
77

88
## Build
99

@@ -38,6 +38,7 @@ Class | Method | HTTP request | Description
3838
*DefaultApi* | [**testMethod**](docs/DefaultApi.md#testmethod) | **GET** /test |
3939
*PetApi* | [**addPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
4040
*PetApi* | [**deletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
41+
*PetApi* | [**doCategoryStuff**](docs/PetApi.md#docategorystuff) | **POST** /pet/category |
4142
*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
4243
*PetApi* | [**findPetsByTags**](docs/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
4344
*PetApi* | [**getAllPets**](docs/PetApi.md#getallpets) | **GET** /allPets |
@@ -62,6 +63,8 @@ Class | Method | HTTP request | Description
6263
<a name="documentation-for-models"></a>
6364
## Documentation for Models
6465

66+
- [io.swagger.client.models.AllOfSubCategoryCategory](docs/AllOfSubCategoryCategory.md)
67+
- [io.swagger.client.models.AllOfSubCategoryPetsItems](docs/AllOfSubCategoryPetsItems.md)
6568
- [io.swagger.client.models.AllPetsResponse](docs/AllPetsResponse.md)
6669
- [io.swagger.client.models.ApiResponse](docs/ApiResponse.md)
6770
- [io.swagger.client.models.Body](docs/Body.md)
@@ -74,6 +77,7 @@ Class | Method | HTTP request | Description
7477
- [io.swagger.client.models.Order](docs/Order.md)
7578
- [io.swagger.client.models.Pet](docs/Pet.md)
7679
- [io.swagger.client.models.SinglePetResponse](docs/SinglePetResponse.md)
80+
- [io.swagger.client.models.SubCategory](docs/SubCategory.md)
7781
- [io.swagger.client.models.Tag](docs/Tag.md)
7882
- [io.swagger.client.models.Test](docs/Test.md)
7983
- [io.swagger.client.models.User](docs/User.md)
@@ -96,5 +100,6 @@ Class | Method | HTTP request | Description
96100
- **Flow**: implicit
97101
- **Authorization URL**: http://petstore.swagger.io/oauth/dialog
98102
- **Scopes**:
99-
- :
103+
- write:pets: modify pets in your account
104+
- read:pets: read your pets
100105

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
group 'io.swagger'
22
version '1.0.0'
33

4-
task wrapper(type: Wrapper) {
5-
gradleVersion = '3.3'
4+
wrapper {
5+
gradleVersion = '4.9'
66
distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
77
}
88

99
buildscript {
10-
ext.kotlin_version = '1.1.2'
10+
ext.kotlin_version = '1.3.72'
1111

1212
repositories {
13-
mavenCentral()
13+
maven { url "https://repo1.maven.org/maven2" }
1414
}
1515
dependencies {
1616
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
@@ -20,14 +20,14 @@ buildscript {
2020
apply plugin: 'kotlin'
2121

2222
repositories {
23-
mavenCentral()
23+
maven { url "https://repo1.maven.org/maven2" }
2424
}
2525

2626
dependencies {
27-
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
28-
compile "com.squareup.moshi:moshi-kotlin:1.5.0"
29-
compile "com.squareup.moshi:moshi-adapters:1.5.0"
30-
compile "com.squareup.okhttp3:okhttp:3.8.0"
31-
compile "org.threeten:threetenbp:1.3.6"
32-
testCompile "io.kotlintest:kotlintest:2.0.2"
33-
}
27+
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
28+
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
29+
compile "com.squareup.moshi:moshi-kotlin:1.9.2"
30+
compile "com.squareup.moshi:moshi-adapters:1.9.2"
31+
compile "com.squareup.okhttp3:okhttp:4.2.2"
32+
testCompile "io.kotlintest:kotlintest:2.0.7"
33+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# AllOfSubCategoryCategory
2+
3+
## Properties
4+
Name | Type | Description | Notes
5+
------------ | ------------- | ------------- | -------------
6+
**foo** | [**kotlin.Boolean**](.md) | | [optional]
7+
**bar** | [**kotlin.Int**](.md) | | [optional]
8+
**beer** | [**kotlin.String**](.md) | | [optional]
9+
**drunk** | [**User**](User.md) | | [optional]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# AllOfSubCategoryPetsItems
2+
3+
## Properties
4+
Name | Type | Description | Notes
5+
------------ | ------------- | ------------- | -------------

samples/client/petstore/kotlin/docs/PetApi.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Method | HTTP request | Description
66
------------- | ------------- | -------------
77
[**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
88
[**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
9+
[**doCategoryStuff**](PetApi.md#doCategoryStuff) | **POST** /pet/category |
910
[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
1011
[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
1112
[**getAllPets**](PetApi.md#getAllPets) | **GET** /allPets |
@@ -105,6 +106,51 @@ null (empty response body)
105106
- **Content-Type**: Not defined
106107
- **Accept**: Not defined
107108

109+
<a name="doCategoryStuff"></a>
110+
# **doCategoryStuff**
111+
> ApiResponse doCategoryStuff(body)
112+
113+
114+
115+
### Example
116+
```kotlin
117+
// Import classes:
118+
//import io.swagger.client.infrastructure.*
119+
//import io.swagger.client.models.*;
120+
121+
val apiInstance = PetApi()
122+
val body : SubCategory = // SubCategory |
123+
try {
124+
val result : ApiResponse = apiInstance.doCategoryStuff(body)
125+
println(result)
126+
} catch (e: ClientException) {
127+
println("4xx response calling PetApi#doCategoryStuff")
128+
e.printStackTrace()
129+
} catch (e: ServerException) {
130+
println("5xx response calling PetApi#doCategoryStuff")
131+
e.printStackTrace()
132+
}
133+
```
134+
135+
### Parameters
136+
137+
Name | Type | Description | Notes
138+
------------- | ------------- | ------------- | -------------
139+
**body** | [**SubCategory**](SubCategory.md)| | [optional]
140+
141+
### Return type
142+
143+
[**ApiResponse**](ApiResponse.md)
144+
145+
### Authorization
146+
147+
No authorization required
148+
149+
### HTTP request headers
150+
151+
- **Content-Type**: application/json
152+
- **Accept**: application/json
153+
108154
<a name="findPetsByStatus"></a>
109155
# **findPetsByStatus**
110156
> kotlin.Array&lt;Pet&gt; findPetsByStatus(status)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# SubCategory
2+
3+
## Properties
4+
Name | Type | Description | Notes
5+
------------ | ------------- | ------------- | -------------
6+
**category** | [**AllOfSubCategoryCategory**](AllOfSubCategoryCategory.md) | | [optional]
7+
**category2** | [**Category**](Category.md) | | [optional]
8+
**pets** | [**kotlin.Array&lt;AllOfSubCategoryPetsItems&gt;**](.md) | | [optional]
4.88 KB
Binary file not shown.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Mon May 29 15:39:04 EDT 2017
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

samples/client/petstore/kotlin/gradlew

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
#!/usr/bin/env sh
22

3+
#
4+
# Copyright 2015 the original author or authors.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# https://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
319
##############################################################################
420
##
521
## Gradle start up script for UN*X
@@ -28,16 +44,16 @@ APP_NAME="Gradle"
2844
APP_BASE_NAME=`basename "$0"`
2945

3046
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31-
DEFAULT_JVM_OPTS=""
47+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
3248

3349
# Use the maximum available, or set MAX_FD != -1 to use that value.
3450
MAX_FD="maximum"
3551

36-
warn ( ) {
52+
warn () {
3753
echo "$*"
3854
}
3955

40-
die ( ) {
56+
die () {
4157
echo
4258
echo "$*"
4359
echo
@@ -66,6 +82,7 @@ esac
6682

6783
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
6884

85+
6986
# Determine the Java command to use to start the JVM.
7087
if [ -n "$JAVA_HOME" ] ; then
7188
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@@ -109,10 +126,11 @@ if $darwin; then
109126
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110127
fi
111128

112-
# For Cygwin, switch paths to Windows format before running java
113-
if $cygwin ; then
129+
# For Cygwin or MSYS, switch paths to Windows format before running java
130+
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
114131
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115132
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133+
116134
JAVACMD=`cygpath --unix "$JAVACMD"`
117135

118136
# We build the pattern for arguments to be converted via cygpath
@@ -138,35 +156,30 @@ if $cygwin ; then
138156
else
139157
eval `echo args$i`="\"$arg\""
140158
fi
141-
i=$((i+1))
159+
i=`expr $i + 1`
142160
done
143161
case $i in
144-
(0) set -- ;;
145-
(1) set -- "$args0" ;;
146-
(2) set -- "$args0" "$args1" ;;
147-
(3) set -- "$args0" "$args1" "$args2" ;;
148-
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149-
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150-
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151-
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152-
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153-
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
162+
0) set -- ;;
163+
1) set -- "$args0" ;;
164+
2) set -- "$args0" "$args1" ;;
165+
3) set -- "$args0" "$args1" "$args2" ;;
166+
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167+
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168+
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169+
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170+
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171+
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154172
esac
155173
fi
156174

157175
# Escape application args
158-
save ( ) {
176+
save () {
159177
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160178
echo " "
161179
}
162-
APP_ARGS=$(save "$@")
180+
APP_ARGS=`save "$@"`
163181

164182
# Collect all arguments for the java command, following the shell quoting and substitution rules
165183
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166184

167-
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168-
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169-
cd "$(dirname "$0")"
170-
fi
171-
172185
exec "$JAVACMD" "$@"

0 commit comments

Comments
 (0)