* Replace typeMapping kotlin.Array with kotlin.collections.List, because its doesn't work with Kotlin Data Classes(required manually implementing hashCode&equals) Replace typeMapping kotlin.Array<kotlin.Byte> with efficient primitive implementation kotlin.ByteArray Replace instantiationTypes array to kotlin.collections.ArrayList, for extending Array we should provide element count to its constructor. * Fixed path(removed slash on begin path) for Jvm Kotlin Retrofit * Fixed handling optional bodyParams for Jvm Kotlin Retrofit * Fix kotlin tests * Fixed code format for detekt inspections #2 * revert formatting * Added ability to generate optional @Query params. * Update Kotlin docs. * Update Kotlin openapi3 client samples * Update Kotlin client samples * Update Kotlin openapi3 client samples after merge with master * Revert hardcoding List instead Array * Set List as default collectionType * Update Kotlin samples * Fixed Kotlin multiplatform api template. fix mapper for Array type. Fixed Kotlin multiplatform api template Code style. * Update Kotlin multiplatform sample * Fix Kotlin multiplatform template code style * Update Kotlin multiplatform sample * Fix Kotlin multiplatform converting Array to List in Api. * Update Kotlin multiplatform sample #3 * Fix Kotlin tests * Fix Kotlin jackson Application.kt * Fix Kotlin tests #2 * Fix merge conflict with master * Generate samples after merge with master * Generate samples after merge with master #2 * Generate samples after merge with master #3 * Generate samples after merge with master #4 * update kotlin samples * update all samples Co-authored-by: William Cheng <wing328hk@gmail.com>
10 KiB
PetApi
All URIs are relative to http://petstore.swagger.io/v2
Method | HTTP request | Description |
---|---|---|
addPet | POST /pet | Add a new pet to the store |
deletePet | DELETE /pet/{petId} | Deletes a pet |
findPetsByTags | GET /pet/findByTags | Finds Pets by tags |
getAllPets | GET /pet/getAll | Get all pets |
getPetById | GET /pet/{petId} | Find pet by ID |
updatePet | PUT /pet | Update an existing pet |
updatePetWithForm | POST /pet/{petId} | Updates a pet in the store with form data |
uploadFile | POST /pet/{petId}/uploadImage | uploads an image |
addPet
addPet(body)
Add a new pet to the store
Example
// 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 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
deletePet
deletePet(petId, apiKey)
Deletes a pet
Example
// 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
findPetsByTags
kotlin.collections.List<Pet> findPetsByTags(tags)
Finds Pets by tags
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
Example
// Import classes:
//import org.openapitools.client.infrastructure.*
//import org.openapitools.client.models.*
val apiInstance = PetApi()
val tags : kotlin.collections.List<kotlin.String> = // kotlin.collections.List<kotlin.String> | Tags to filter by
try {
val result : kotlin.collections.List<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.collections.List<kotlin.String> | Tags to filter by |
Return type
Authorization
Configure petstore_auth: ApiClient.accessToken = ""
HTTP request headers
- Content-Type: Not defined
- Accept: application/xml, application/json
getAllPets
kotlin.collections.List<Pet> getAllPets(lastUpdated)
Get all pets
Example
// Import classes:
//import org.openapitools.client.infrastructure.*
//import org.openapitools.client.models.*
val apiInstance = PetApi()
val lastUpdated : java.time.OffsetDateTime = 2013-10-20T19:20:30+01:00 // java.time.OffsetDateTime | When this endpoint was hit last to help indentify if the client already has the latest copy.
try {
val result : kotlin.collections.List<Pet> = apiInstance.getAllPets(lastUpdated)
println(result)
} catch (e: ClientException) {
println("4xx response calling PetApi#getAllPets")
e.printStackTrace()
} catch (e: ServerException) {
println("5xx response calling PetApi#getAllPets")
e.printStackTrace()
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
lastUpdated | java.time.OffsetDateTime | When this endpoint was hit last to help indentify if the client already has the latest copy. | [optional] |
Return type
Authorization
Configure petstore_auth: ApiClient.accessToken = ""
HTTP request headers
- Content-Type: Not defined
- Accept: application/xml, application/json
getPetById
Pet getPetById(petId)
Find pet by ID
Returns a single pet
Example
// 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
Authorization
Configure api_key: ApiClient.apiKey["api_key"] = "" ApiClient.apiKeyPrefix["api_key"] = ""
HTTP request headers
- Content-Type: Not defined
- Accept: application/xml, application/json
updatePet
updatePet(body)
Update an existing pet
Example
// 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 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
updatePetWithForm
updatePetWithForm(petId, name, status)
Updates a pet in the store with form data
Example
// 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
uploadFile
ApiResponse uploadFile(petId, additionalMetadata, file)
uploads an image
Example
// 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 : java.io.File = BINARY_DATA_HERE // java.io.File | 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 | java.io.File | file to upload | [optional] |
Return type
Authorization
Configure petstore_auth: ApiClient.accessToken = ""
HTTP request headers
- Content-Type: multipart/form-data
- Accept: application/json