forked from loafle/openapi-generator-original
* Added supporting kotlin.serialization for jvm * Added Serializable annotations for java types(date,time,url,uri etc.) * Added SafeEnumSerializer * Added StringBuilderAdapter for kotlin.serialization Fix adapter naming Fix Retrofit ApiClient.kt for kotlin.serialization * Added StringBuilderAdapter for kotlin.serialization * Switch sample to retrofit2-kotlin-serialization * Add sample for retrofit2-kotlin.serialization * update sample * update sample * update sample #3 * Fix enum quotes for kotlin.serialization * update samples * update pom.xml * add pom.xml to child module * fix kotlin-multiplatform freeCompilerArgs * refactoring, add useSafeEnum option, remove safeEnum for kotlin.multiplatform * update kotlin samples * fix import kotlinx.serialization.Required * Update kotlinx.serialization 1.0.0-rc-2, kotlin 1.4.10, retrofit-kotlinx-converter 0.7.0 * Update gradle wrapper 6.7-rc-3 * fix SafeEnum import * fix Json initialization, fix SafeEnumSerializer * update samples * update kotlinx.serialization to 1.0.0 * Update gradle to 6.7 in kotlin samples * fixed adding @Contextual for collections with non-primitive type elements * remove unused SafeEnum imports, refactored * update kotlin readme * update kotlin project template Readme.md * update samples for kotlin * simplify template for class properties * remove @Contextual from kotlin-multiplatform * update kotlin multiplatform dependencies * refactoring templates * revert all changes for multiplatform * fix tests * revert multiplatform #2 * update samples after merge, fix missed isListContainer->isArray * fixed redundant space before @Contextual * Fixed enum template, Class were missed in generated samples * fix enum template toString value->serialName * fixed isEnum case for collections * update samples * removed useSafeEnum option, kotlinx serialization has out of box approach with coerceInputValues option for same behavior * generate samples * update kotlinx.serialization 1.0.1 * update samples * Added pom.mustache template for kotlin-client samples with fixed execution of gradle wrapper instead standalone installed gradle on CI * update samples with new pom.xml * reverted enum value property name * fixed kotlin-multiplatform pom.xml * update kotlin-threetenbp sample * update kotlin-string sample * update kotlin-string sample * fix adding kotlinx.serialization classpath to build.gradle * generate samples * add supporting kotlinx_serialization kotlinx.serialization.Serializable with java.io.Serializable at the same time * update retrofit2-kotlinx-serialization-converter:0.8.0 * update kotlinx_serialization sample with retrofit2-kotlinx-serialization-converter:0.8.0 * apply suggest from @blendthink * added proguard-rules.pro file for kotlinx.serialization on Android projects * fix pom.mustache * update gradle wrapper to 6.8.3 * update kotlin samples * fix kotlin readme template, update kotlin samples * update kotlin samples * update kotlin sample delete petstore/kotlin unit tests * revert deletion kotlin client tests remove adding pom.xml to kotlin client samples * add support kotlinx serialization for okhttp3/4 * update kotlin client samples
8.1 KiB
8.1 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 |
findPetsByStatus | GET pet/findByStatus | Finds Pets by status |
findPetsByTags | GET pet/findByTags | Finds Pets by tags |
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 |
Add a new pet to the store
Example
// Import classes:
//import org.openapitools.client.*
//import org.openapitools.client.infrastructure.*
//import org.openapitools.client.models.*
val apiClient = ApiClient()
val webService = apiClient.createWebservice(PetApi::class.java)
val body : Pet = // Pet | Pet object that needs to be added to the store
webService.addPet(body)
Parameters
Name | Type | Description | Notes |
---|---|---|---|
body | Pet | Pet object that needs to be added to the store |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: application/json, application/xml
- Accept: Not defined
Deletes a pet
Example
// Import classes:
//import org.openapitools.client.*
//import org.openapitools.client.infrastructure.*
//import org.openapitools.client.models.*
val apiClient = ApiClient()
val webService = apiClient.createWebservice(PetApi::class.java)
val petId : kotlin.Long = 789 // kotlin.Long | Pet id to delete
val apiKey : kotlin.String = apiKey_example // kotlin.String |
webService.deletePet(petId, apiKey)
Parameters
Name | Type | Description | Notes |
---|---|---|---|
petId | kotlin.Long | Pet id to delete | |
apiKey | kotlin.String | [optional] |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: Not defined
Finds Pets by status
Multiple status values can be provided with comma separated strings
Example
// Import classes:
//import org.openapitools.client.*
//import org.openapitools.client.infrastructure.*
//import org.openapitools.client.models.*
val apiClient = ApiClient()
val webService = apiClient.createWebservice(PetApi::class.java)
val status : kotlin.collections.List<kotlin.String> = // kotlin.collections.List<kotlin.String> | Status values that need to be considered for filter
val result : kotlin.collections.List<Pet> = webService.findPetsByStatus(status)
Parameters
Name | Type | Description | Notes |
---|---|---|---|
status | kotlin.collections.List<kotlin.String> | Status values that need to be considered for filter | [enum: available, pending, sold] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/xml, application/json
Finds Pets by tags
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
Example
// Import classes:
//import org.openapitools.client.*
//import org.openapitools.client.infrastructure.*
//import org.openapitools.client.models.*
val apiClient = ApiClient()
val webService = apiClient.createWebservice(PetApi::class.java)
val tags : kotlin.collections.List<kotlin.String> = // kotlin.collections.List<kotlin.String> | Tags to filter by
val result : kotlin.collections.List<Pet> = webService.findPetsByTags(tags)
Parameters
Name | Type | Description | Notes |
---|---|---|---|
tags | kotlin.collections.List<kotlin.String> | Tags to filter by |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/xml, application/json
Find pet by ID
Returns a single pet
Example
// Import classes:
//import org.openapitools.client.*
//import org.openapitools.client.infrastructure.*
//import org.openapitools.client.models.*
val apiClient = ApiClient()
val webService = apiClient.createWebservice(PetApi::class.java)
val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to return
val result : Pet = webService.getPetById(petId)
Parameters
Name | Type | Description | Notes |
---|---|---|---|
petId | kotlin.Long | ID of pet to return |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/xml, application/json
Update an existing pet
Example
// Import classes:
//import org.openapitools.client.*
//import org.openapitools.client.infrastructure.*
//import org.openapitools.client.models.*
val apiClient = ApiClient()
val webService = apiClient.createWebservice(PetApi::class.java)
val body : Pet = // Pet | Pet object that needs to be added to the store
webService.updatePet(body)
Parameters
Name | Type | Description | Notes |
---|---|---|---|
body | Pet | Pet object that needs to be added to the store |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: application/json, application/xml
- Accept: Not defined
Updates a pet in the store with form data
Example
// Import classes:
//import org.openapitools.client.*
//import org.openapitools.client.infrastructure.*
//import org.openapitools.client.models.*
val apiClient = ApiClient()
val webService = apiClient.createWebservice(PetApi::class.java)
val petId : kotlin.Long = 789 // kotlin.Long | ID of pet that needs to be updated
val name : kotlin.String = name_example // kotlin.String | Updated name of the pet
val status : kotlin.String = status_example // kotlin.String | Updated status of the pet
webService.updatePetWithForm(petId, name, status)
Parameters
Name | Type | Description | Notes |
---|---|---|---|
petId | kotlin.Long | ID of pet that needs to be updated | |
name | kotlin.String | Updated name of the pet | [optional] |
status | kotlin.String | Updated status of the pet | [optional] |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: application/x-www-form-urlencoded
- Accept: Not defined
uploads an image
Example
// Import classes:
//import org.openapitools.client.*
//import org.openapitools.client.infrastructure.*
//import org.openapitools.client.models.*
val apiClient = ApiClient()
val webService = apiClient.createWebservice(PetApi::class.java)
val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update
val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server
val file : java.io.File = BINARY_DATA_HERE // java.io.File | file to upload
val result : ApiResponse = webService.uploadFile(petId, additionalMetadata, file)
Parameters
Name | Type | Description | Notes |
---|---|---|---|
petId | kotlin.Long | ID of pet to update | |
additionalMetadata | kotlin.String | Additional data to pass to server | [optional] |
file | java.io.File | file to upload | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: multipart/form-data
- Accept: application/json