forked from loafle/openapi-generator-original
[Kotlin][Client] create request config method (#8617)
* [kotlin][client] create an api method to create the RequestConfig * [kotlin][client] generate sample projects * [kotlin] add docs to RequestConfig method * [kotlin][client] generate sample projects * [kotlin] improve docs on the RequestConfig method * [kotlin][client] generate sample projects
This commit is contained in:
@@ -45,18 +45,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
*/
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
suspend fun addPet(body: Pet) : Unit {
|
||||
val localVariableBody: kotlin.Any? = body
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.POST,
|
||||
"/pet",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val localVariableConfig = addPetRequestConfig(body = body)
|
||||
|
||||
val localVarResponse = request<Any?>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
localVariableConfig
|
||||
)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
@@ -74,6 +66,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation addPet
|
||||
*
|
||||
* @param body Pet object that needs to be added to the store
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun addPetRequestConfig(body: Pet) : RequestConfig {
|
||||
val localVariableBody: kotlin.Any? = body
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
method = RequestMethod.POST,
|
||||
path = "/pet",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
body = localVariableBody
|
||||
)
|
||||
|
||||
return localVariableConfig
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a pet
|
||||
*
|
||||
@@ -86,19 +100,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
*/
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
suspend fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.DELETE,
|
||||
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
|
||||
|
||||
val localVarResponse = request<Any?>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
localVariableConfig
|
||||
)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
@@ -116,6 +121,30 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation deletePet
|
||||
*
|
||||
* @param petId Pet id to delete
|
||||
* @param apiKey (optional)
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
method = RequestMethod.DELETE,
|
||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
body = localVariableBody
|
||||
)
|
||||
|
||||
return localVariableConfig
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds Pets by status
|
||||
* Multiple status values can be provided with comma separated strings
|
||||
@@ -128,21 +157,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
suspend fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||
.apply {
|
||||
put("status", toMultiValue(status.toList(), "csv"))
|
||||
}
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.GET,
|
||||
"/pet/findByStatus",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val localVariableConfig = findPetsByStatusRequestConfig(status = status)
|
||||
|
||||
val localVarResponse = request<kotlin.collections.List<Pet>>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
localVariableConfig
|
||||
)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
@@ -160,6 +178,31 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation findPetsByStatus
|
||||
*
|
||||
* @param status Status values that need to be considered for filter
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||
.apply {
|
||||
put("status", toMultiValue(status.toList(), "csv"))
|
||||
}
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
method = RequestMethod.GET,
|
||||
path = "/pet/findByStatus",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
body = localVariableBody
|
||||
)
|
||||
|
||||
return localVariableConfig
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds Pets by tags
|
||||
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
@@ -173,21 +216,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
@Deprecated(message = "This operation is deprecated.")
|
||||
suspend fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||
.apply {
|
||||
put("tags", toMultiValue(tags.toList(), "csv"))
|
||||
}
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.GET,
|
||||
"/pet/findByTags",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
|
||||
|
||||
val localVarResponse = request<kotlin.collections.List<Pet>>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
localVariableConfig
|
||||
)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
@@ -205,6 +237,32 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation findPetsByTags
|
||||
*
|
||||
* @param tags Tags to filter by
|
||||
* @return RequestConfig
|
||||
*/
|
||||
@Deprecated(message = "This operation is deprecated.")
|
||||
fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||
.apply {
|
||||
put("tags", toMultiValue(tags.toList(), "csv"))
|
||||
}
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
method = RequestMethod.GET,
|
||||
path = "/pet/findByTags",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
body = localVariableBody
|
||||
)
|
||||
|
||||
return localVariableConfig
|
||||
}
|
||||
|
||||
/**
|
||||
* Find pet by ID
|
||||
* Returns a single pet
|
||||
@@ -217,18 +275,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
suspend fun getPetById(petId: kotlin.Long) : Pet {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.GET,
|
||||
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val localVariableConfig = getPetByIdRequestConfig(petId = petId)
|
||||
|
||||
val localVarResponse = request<Pet>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
localVariableConfig
|
||||
)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
@@ -246,6 +296,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation getPetById
|
||||
*
|
||||
* @param petId ID of pet to return
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
method = RequestMethod.GET,
|
||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
body = localVariableBody
|
||||
)
|
||||
|
||||
return localVariableConfig
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an existing pet
|
||||
*
|
||||
@@ -257,18 +329,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
*/
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
suspend fun updatePet(body: Pet) : Unit {
|
||||
val localVariableBody: kotlin.Any? = body
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.PUT,
|
||||
"/pet",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val localVariableConfig = updatePetRequestConfig(body = body)
|
||||
|
||||
val localVarResponse = request<Any?>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
localVariableConfig
|
||||
)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
@@ -286,6 +350,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation updatePet
|
||||
*
|
||||
* @param body Pet object that needs to be added to the store
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun updatePetRequestConfig(body: Pet) : RequestConfig {
|
||||
val localVariableBody: kotlin.Any? = body
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
method = RequestMethod.PUT,
|
||||
path = "/pet",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
body = localVariableBody
|
||||
)
|
||||
|
||||
return localVariableConfig
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a pet in the store with form data
|
||||
*
|
||||
@@ -299,18 +385,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
*/
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
suspend fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
|
||||
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.POST,
|
||||
"/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
|
||||
|
||||
val localVarResponse = request<Any?>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
localVariableConfig
|
||||
)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
@@ -328,6 +406,30 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation updatePetWithForm
|
||||
*
|
||||
* @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 RequestConfig
|
||||
*/
|
||||
fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
|
||||
val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
method = RequestMethod.POST,
|
||||
path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
body = localVariableBody
|
||||
)
|
||||
|
||||
return localVariableConfig
|
||||
}
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
@@ -342,18 +444,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
|
||||
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.POST,
|
||||
"/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
|
||||
|
||||
val localVarResponse = request<ApiResponse>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
localVariableConfig
|
||||
)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
@@ -371,4 +465,28 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation uploadFile
|
||||
*
|
||||
* @param petId ID of pet to update
|
||||
* @param additionalMetadata Additional data to pass to server (optional)
|
||||
* @param file file to upload (optional)
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
|
||||
val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
method = RequestMethod.POST,
|
||||
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
body = localVariableBody
|
||||
)
|
||||
|
||||
return localVariableConfig
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -44,18 +44,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
||||
*/
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
suspend fun deleteOrder(orderId: kotlin.String) : Unit {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.DELETE,
|
||||
"/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
|
||||
|
||||
val localVarResponse = request<Any?>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
localVariableConfig
|
||||
)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
@@ -73,6 +65,28 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation deleteOrder
|
||||
*
|
||||
* @param orderId ID of the order that needs to be deleted
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
method = RequestMethod.DELETE,
|
||||
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
body = localVariableBody
|
||||
)
|
||||
|
||||
return localVariableConfig
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns pet inventories by status
|
||||
* Returns a map of status codes to quantities
|
||||
@@ -84,18 +98,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
suspend fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.GET,
|
||||
"/store/inventory",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val localVariableConfig = getInventoryRequestConfig()
|
||||
|
||||
val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
localVariableConfig
|
||||
)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
@@ -113,6 +119,27 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation getInventory
|
||||
*
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun getInventoryRequestConfig() : RequestConfig {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
method = RequestMethod.GET,
|
||||
path = "/store/inventory",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
body = localVariableBody
|
||||
)
|
||||
|
||||
return localVariableConfig
|
||||
}
|
||||
|
||||
/**
|
||||
* Find purchase order by ID
|
||||
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
@@ -125,18 +152,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
suspend fun getOrderById(orderId: kotlin.Long) : Order {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.GET,
|
||||
"/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
|
||||
|
||||
val localVarResponse = request<Order>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
localVariableConfig
|
||||
)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
@@ -154,6 +173,28 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation getOrderById
|
||||
*
|
||||
* @param orderId ID of pet that needs to be fetched
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
method = RequestMethod.GET,
|
||||
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
body = localVariableBody
|
||||
)
|
||||
|
||||
return localVariableConfig
|
||||
}
|
||||
|
||||
/**
|
||||
* Place an order for a pet
|
||||
*
|
||||
@@ -166,18 +207,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
suspend fun placeOrder(body: Order) : Order {
|
||||
val localVariableBody: kotlin.Any? = body
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.POST,
|
||||
"/store/order",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val localVariableConfig = placeOrderRequestConfig(body = body)
|
||||
|
||||
val localVarResponse = request<Order>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
localVariableConfig
|
||||
)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
@@ -195,4 +228,26 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation placeOrder
|
||||
*
|
||||
* @param body order placed for purchasing the pet
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun placeOrderRequestConfig(body: Order) : RequestConfig {
|
||||
val localVariableBody: kotlin.Any? = body
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
method = RequestMethod.POST,
|
||||
path = "/store/order",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
body = localVariableBody
|
||||
)
|
||||
|
||||
return localVariableConfig
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -44,18 +44,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
*/
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
suspend fun createUser(body: User) : Unit {
|
||||
val localVariableBody: kotlin.Any? = body
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.POST,
|
||||
"/user",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val localVariableConfig = createUserRequestConfig(body = body)
|
||||
|
||||
val localVarResponse = request<Any?>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
localVariableConfig
|
||||
)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
@@ -73,6 +65,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation createUser
|
||||
*
|
||||
* @param body Created user object
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun createUserRequestConfig(body: User) : RequestConfig {
|
||||
val localVariableBody: kotlin.Any? = body
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
method = RequestMethod.POST,
|
||||
path = "/user",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
body = localVariableBody
|
||||
)
|
||||
|
||||
return localVariableConfig
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
@@ -84,18 +98,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
*/
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
suspend fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
|
||||
val localVariableBody: kotlin.Any? = body
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.POST,
|
||||
"/user/createWithArray",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
|
||||
|
||||
val localVarResponse = request<Any?>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
localVariableConfig
|
||||
)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
@@ -113,6 +119,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation createUsersWithArrayInput
|
||||
*
|
||||
* @param body List of user object
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
|
||||
val localVariableBody: kotlin.Any? = body
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
method = RequestMethod.POST,
|
||||
path = "/user/createWithArray",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
body = localVariableBody
|
||||
)
|
||||
|
||||
return localVariableConfig
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
@@ -124,18 +152,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
*/
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
suspend fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
|
||||
val localVariableBody: kotlin.Any? = body
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.POST,
|
||||
"/user/createWithList",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
|
||||
|
||||
val localVarResponse = request<Any?>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
localVariableConfig
|
||||
)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
@@ -153,6 +173,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation createUsersWithListInput
|
||||
*
|
||||
* @param body List of user object
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
|
||||
val localVariableBody: kotlin.Any? = body
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
method = RequestMethod.POST,
|
||||
path = "/user/createWithList",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
body = localVariableBody
|
||||
)
|
||||
|
||||
return localVariableConfig
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete user
|
||||
* This can only be done by the logged in user.
|
||||
@@ -164,18 +206,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
*/
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
suspend fun deleteUser(username: kotlin.String) : Unit {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.DELETE,
|
||||
"/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val localVariableConfig = deleteUserRequestConfig(username = username)
|
||||
|
||||
val localVarResponse = request<Any?>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
localVariableConfig
|
||||
)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
@@ -193,6 +227,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation deleteUser
|
||||
*
|
||||
* @param username The name that needs to be deleted
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
method = RequestMethod.DELETE,
|
||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
body = localVariableBody
|
||||
)
|
||||
|
||||
return localVariableConfig
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user by user name
|
||||
*
|
||||
@@ -205,18 +261,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
suspend fun getUserByName(username: kotlin.String) : User {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.GET,
|
||||
"/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val localVariableConfig = getUserByNameRequestConfig(username = username)
|
||||
|
||||
val localVarResponse = request<User>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
localVariableConfig
|
||||
)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
@@ -234,6 +282,28 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation getUserByName
|
||||
*
|
||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
method = RequestMethod.GET,
|
||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
body = localVariableBody
|
||||
)
|
||||
|
||||
return localVariableConfig
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs user into the system
|
||||
*
|
||||
@@ -247,22 +317,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
suspend fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||
.apply {
|
||||
put("username", listOf(username.toString()))
|
||||
put("password", listOf(password.toString()))
|
||||
}
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.GET,
|
||||
"/user/login",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val localVariableConfig = loginUserRequestConfig(username = username, password = password)
|
||||
|
||||
val localVarResponse = request<kotlin.String>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
localVariableConfig
|
||||
)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
@@ -280,6 +338,33 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation loginUser
|
||||
*
|
||||
* @param username The user name for login
|
||||
* @param password The password for login in clear text
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||
.apply {
|
||||
put("username", listOf(username.toString()))
|
||||
put("password", listOf(password.toString()))
|
||||
}
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
method = RequestMethod.GET,
|
||||
path = "/user/login",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
body = localVariableBody
|
||||
)
|
||||
|
||||
return localVariableConfig
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs out current logged in user session
|
||||
*
|
||||
@@ -290,18 +375,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
*/
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
suspend fun logoutUser() : Unit {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.GET,
|
||||
"/user/logout",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val localVariableConfig = logoutUserRequestConfig()
|
||||
|
||||
val localVarResponse = request<Any?>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
localVariableConfig
|
||||
)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
@@ -319,6 +396,27 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation logoutUser
|
||||
*
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun logoutUserRequestConfig() : RequestConfig {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
method = RequestMethod.GET,
|
||||
path = "/user/logout",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
body = localVariableBody
|
||||
)
|
||||
|
||||
return localVariableConfig
|
||||
}
|
||||
|
||||
/**
|
||||
* Updated user
|
||||
* This can only be done by the logged in user.
|
||||
@@ -331,18 +429,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
*/
|
||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
suspend fun updateUser(username: kotlin.String, body: User) : Unit {
|
||||
val localVariableBody: kotlin.Any? = body
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.PUT,
|
||||
"/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders
|
||||
)
|
||||
val localVariableConfig = updateUserRequestConfig(username = username, body = body)
|
||||
|
||||
val localVarResponse = request<Any?>(
|
||||
localVariableConfig,
|
||||
localVariableBody
|
||||
localVariableConfig
|
||||
)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
@@ -360,4 +450,27 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation updateUser
|
||||
*
|
||||
* @param username name that need to be deleted
|
||||
* @param body Updated user object
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
|
||||
val localVariableBody: kotlin.Any? = body
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
|
||||
val localVariableConfig = RequestConfig(
|
||||
method = RequestMethod.PUT,
|
||||
path = "/user/{username}".replace("{"+"username"+"}", "$username"),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
body = localVariableBody
|
||||
)
|
||||
|
||||
return localVariableConfig
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ open class ApiClient(val baseUrl: String) {
|
||||
}
|
||||
}
|
||||
|
||||
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig, body : Any? = null): ApiInfrastructureResponse<T?> {
|
||||
protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
|
||||
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
|
||||
|
||||
// take authMethod from operation
|
||||
@@ -174,12 +174,12 @@ open class ApiClient(val baseUrl: String) {
|
||||
val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
|
||||
|
||||
val request = when (requestConfig.method) {
|
||||
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(body, contentType))
|
||||
RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
|
||||
RequestMethod.GET -> Request.Builder().url(url)
|
||||
RequestMethod.HEAD -> Request.Builder().url(url).head()
|
||||
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType))
|
||||
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType))
|
||||
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType))
|
||||
RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType))
|
||||
RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType))
|
||||
RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType))
|
||||
RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null)
|
||||
}.apply {
|
||||
headers.forEach { header -> addHeader(header.key, header.value) }
|
||||
|
||||
@@ -12,5 +12,6 @@ data class RequestConfig(
|
||||
val method: RequestMethod,
|
||||
val path: String,
|
||||
val headers: MutableMap<String, String> = mutableMapOf(),
|
||||
val query: MutableMap<String, List<String>> = mutableMapOf()
|
||||
val query: MutableMap<String, List<String>> = mutableMapOf(),
|
||||
val body: kotlin.Any? = null
|
||||
)
|
||||
Reference in New Issue
Block a user