mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-20 13:27:08 +00:00
[Kotlin][Tests]: Add test for kotlin-jvm-okhttp (#20338)
* feat(issue-20231): add echo_api client for kotlin okhttp * build(issue-20231): sync files
This commit is contained in:
@@ -0,0 +1,186 @@
|
||||
/**
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"ArrayInDataClass",
|
||||
"EnumEntryName",
|
||||
"RemoveRedundantQualifierName",
|
||||
"UnusedImport"
|
||||
)
|
||||
|
||||
package org.openapitools.client.apis
|
||||
|
||||
import java.io.IOException
|
||||
import okhttp3.Call
|
||||
import okhttp3.HttpUrl
|
||||
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
|
||||
import org.openapitools.client.infrastructure.ApiClient
|
||||
import org.openapitools.client.infrastructure.ApiResponse
|
||||
import org.openapitools.client.infrastructure.ClientException
|
||||
import org.openapitools.client.infrastructure.ClientError
|
||||
import org.openapitools.client.infrastructure.ServerException
|
||||
import org.openapitools.client.infrastructure.ServerError
|
||||
import org.openapitools.client.infrastructure.MultiValueMap
|
||||
import org.openapitools.client.infrastructure.PartConfig
|
||||
import org.openapitools.client.infrastructure.RequestConfig
|
||||
import org.openapitools.client.infrastructure.RequestMethod
|
||||
import org.openapitools.client.infrastructure.ResponseType
|
||||
import org.openapitools.client.infrastructure.Success
|
||||
import org.openapitools.client.infrastructure.toMultiValue
|
||||
|
||||
class AuthApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
val defaultBasePath: String by lazy {
|
||||
System.getProperties().getProperty(ApiClient.baseUrlKey, "http://localhost:3000")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To test HTTP basic authentication
|
||||
* To test HTTP basic authentication
|
||||
* @return kotlin.String
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
fun testAuthHttpBasic() : kotlin.String {
|
||||
val localVarResponse = testAuthHttpBasicWithHttpInfo()
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||
ResponseType.ClientError -> {
|
||||
val localVarError = localVarResponse as ClientError<*>
|
||||
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
ResponseType.ServerError -> {
|
||||
val localVarError = localVarResponse as ServerError<*>
|
||||
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To test HTTP basic authentication
|
||||
* To test HTTP basic authentication
|
||||
* @return ApiResponse<kotlin.String?>
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class)
|
||||
fun testAuthHttpBasicWithHttpInfo() : ApiResponse<kotlin.String?> {
|
||||
val localVariableConfig = testAuthHttpBasicRequestConfig()
|
||||
|
||||
return request<Unit, kotlin.String>(
|
||||
localVariableConfig
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation testAuthHttpBasic
|
||||
*
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun testAuthHttpBasicRequestConfig() : RequestConfig<Unit> {
|
||||
val localVariableBody = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
localVariableHeaders["Accept"] = "text/plain"
|
||||
|
||||
return RequestConfig(
|
||||
method = RequestMethod.POST,
|
||||
path = "/auth/http/basic",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
requiresAuthentication = true,
|
||||
body = localVariableBody
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* To test HTTP bearer authentication
|
||||
* To test HTTP bearer authentication
|
||||
* @return kotlin.String
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
fun testAuthHttpBearer() : kotlin.String {
|
||||
val localVarResponse = testAuthHttpBearerWithHttpInfo()
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||
ResponseType.ClientError -> {
|
||||
val localVarError = localVarResponse as ClientError<*>
|
||||
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
ResponseType.ServerError -> {
|
||||
val localVarError = localVarResponse as ServerError<*>
|
||||
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To test HTTP bearer authentication
|
||||
* To test HTTP bearer authentication
|
||||
* @return ApiResponse<kotlin.String?>
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class)
|
||||
fun testAuthHttpBearerWithHttpInfo() : ApiResponse<kotlin.String?> {
|
||||
val localVariableConfig = testAuthHttpBearerRequestConfig()
|
||||
|
||||
return request<Unit, kotlin.String>(
|
||||
localVariableConfig
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation testAuthHttpBearer
|
||||
*
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun testAuthHttpBearerRequestConfig() : RequestConfig<Unit> {
|
||||
val localVariableBody = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
localVariableHeaders["Accept"] = "text/plain"
|
||||
|
||||
return RequestConfig(
|
||||
method = RequestMethod.POST,
|
||||
path = "/auth/http/bearer",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
requiresAuthentication = true,
|
||||
body = localVariableBody
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
|
||||
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
|
||||
}
|
||||
@@ -0,0 +1,623 @@
|
||||
/**
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"ArrayInDataClass",
|
||||
"EnumEntryName",
|
||||
"RemoveRedundantQualifierName",
|
||||
"UnusedImport"
|
||||
)
|
||||
|
||||
package org.openapitools.client.apis
|
||||
|
||||
import java.io.IOException
|
||||
import okhttp3.Call
|
||||
import okhttp3.HttpUrl
|
||||
|
||||
import org.openapitools.client.models.ApiPet
|
||||
import org.openapitools.client.models.ApiTag
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
|
||||
import org.openapitools.client.infrastructure.ApiClient
|
||||
import org.openapitools.client.infrastructure.ApiResponse
|
||||
import org.openapitools.client.infrastructure.ClientException
|
||||
import org.openapitools.client.infrastructure.ClientError
|
||||
import org.openapitools.client.infrastructure.ServerException
|
||||
import org.openapitools.client.infrastructure.ServerError
|
||||
import org.openapitools.client.infrastructure.MultiValueMap
|
||||
import org.openapitools.client.infrastructure.PartConfig
|
||||
import org.openapitools.client.infrastructure.RequestConfig
|
||||
import org.openapitools.client.infrastructure.RequestMethod
|
||||
import org.openapitools.client.infrastructure.ResponseType
|
||||
import org.openapitools.client.infrastructure.Success
|
||||
import org.openapitools.client.infrastructure.toMultiValue
|
||||
|
||||
class BodyApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
val defaultBasePath: String by lazy {
|
||||
System.getProperties().getProperty(ApiClient.baseUrlKey, "http://localhost:3000")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test binary (gif) response body
|
||||
* Test binary (gif) response body
|
||||
* @return java.io.File
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
fun testBinaryGif() : java.io.File {
|
||||
val localVarResponse = testBinaryGifWithHttpInfo()
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
ResponseType.Success -> (localVarResponse as Success<*>).data as java.io.File
|
||||
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||
ResponseType.ClientError -> {
|
||||
val localVarError = localVarResponse as ClientError<*>
|
||||
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
ResponseType.ServerError -> {
|
||||
val localVarError = localVarResponse as ServerError<*>
|
||||
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test binary (gif) response body
|
||||
* Test binary (gif) response body
|
||||
* @return ApiResponse<java.io.File?>
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class)
|
||||
fun testBinaryGifWithHttpInfo() : ApiResponse<java.io.File?> {
|
||||
val localVariableConfig = testBinaryGifRequestConfig()
|
||||
|
||||
return request<Unit, java.io.File>(
|
||||
localVariableConfig
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation testBinaryGif
|
||||
*
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun testBinaryGifRequestConfig() : RequestConfig<Unit> {
|
||||
val localVariableBody = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
|
||||
return RequestConfig(
|
||||
method = RequestMethod.POST,
|
||||
path = "/binary/gif",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
requiresAuthentication = false,
|
||||
body = localVariableBody
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
* Test body parameter(s)
|
||||
* @param body (optional)
|
||||
* @return kotlin.String
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
fun testBodyApplicationOctetstreamBinary(body: java.io.File? = null) : kotlin.String {
|
||||
val localVarResponse = testBodyApplicationOctetstreamBinaryWithHttpInfo(body = body)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||
ResponseType.ClientError -> {
|
||||
val localVarError = localVarResponse as ClientError<*>
|
||||
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
ResponseType.ServerError -> {
|
||||
val localVarError = localVarResponse as ServerError<*>
|
||||
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
* Test body parameter(s)
|
||||
* @param body (optional)
|
||||
* @return ApiResponse<kotlin.String?>
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class)
|
||||
fun testBodyApplicationOctetstreamBinaryWithHttpInfo(body: java.io.File?) : ApiResponse<kotlin.String?> {
|
||||
val localVariableConfig = testBodyApplicationOctetstreamBinaryRequestConfig(body = body)
|
||||
|
||||
return request<java.io.File, kotlin.String>(
|
||||
localVariableConfig
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation testBodyApplicationOctetstreamBinary
|
||||
*
|
||||
* @param body (optional)
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun testBodyApplicationOctetstreamBinaryRequestConfig(body: java.io.File?) : RequestConfig<java.io.File> {
|
||||
val localVariableBody = body
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
localVariableHeaders["Content-Type"] = "application/octet-stream"
|
||||
localVariableHeaders["Accept"] = "text/plain"
|
||||
|
||||
return RequestConfig(
|
||||
method = RequestMethod.POST,
|
||||
path = "/body/application/octetstream/binary",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
requiresAuthentication = false,
|
||||
body = localVariableBody
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Test array of binary in multipart mime
|
||||
* Test array of binary in multipart mime
|
||||
* @param files
|
||||
* @return kotlin.String
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
fun testBodyMultipartFormdataArrayOfBinary(files: kotlin.collections.List<java.io.File>) : kotlin.String {
|
||||
val localVarResponse = testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files = files)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||
ResponseType.ClientError -> {
|
||||
val localVarError = localVarResponse as ClientError<*>
|
||||
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
ResponseType.ServerError -> {
|
||||
val localVarError = localVarResponse as ServerError<*>
|
||||
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test array of binary in multipart mime
|
||||
* Test array of binary in multipart mime
|
||||
* @param files
|
||||
* @return ApiResponse<kotlin.String?>
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class)
|
||||
fun testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files: kotlin.collections.List<java.io.File>) : ApiResponse<kotlin.String?> {
|
||||
val localVariableConfig = testBodyMultipartFormdataArrayOfBinaryRequestConfig(files = files)
|
||||
|
||||
return request<Map<String, PartConfig<*>>, kotlin.String>(
|
||||
localVariableConfig
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation testBodyMultipartFormdataArrayOfBinary
|
||||
*
|
||||
* @param files
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun testBodyMultipartFormdataArrayOfBinaryRequestConfig(files: kotlin.collections.List<java.io.File>) : RequestConfig<Map<String, PartConfig<*>>> {
|
||||
val localVariableBody = mapOf(
|
||||
"files" to PartConfig(body = files, headers = mutableMapOf()),)
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
|
||||
localVariableHeaders["Accept"] = "text/plain"
|
||||
|
||||
return RequestConfig(
|
||||
method = RequestMethod.POST,
|
||||
path = "/body/application/octetstream/array_of_binary",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
requiresAuthentication = false,
|
||||
body = localVariableBody
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Test single binary in multipart mime
|
||||
* Test single binary in multipart mime
|
||||
* @param myFile (optional)
|
||||
* @return kotlin.String
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
fun testBodyMultipartFormdataSingleBinary(myFile: java.io.File? = null) : kotlin.String {
|
||||
val localVarResponse = testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile = myFile)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||
ResponseType.ClientError -> {
|
||||
val localVarError = localVarResponse as ClientError<*>
|
||||
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
ResponseType.ServerError -> {
|
||||
val localVarError = localVarResponse as ServerError<*>
|
||||
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test single binary in multipart mime
|
||||
* Test single binary in multipart mime
|
||||
* @param myFile (optional)
|
||||
* @return ApiResponse<kotlin.String?>
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class)
|
||||
fun testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile: java.io.File?) : ApiResponse<kotlin.String?> {
|
||||
val localVariableConfig = testBodyMultipartFormdataSingleBinaryRequestConfig(myFile = myFile)
|
||||
|
||||
return request<Map<String, PartConfig<*>>, kotlin.String>(
|
||||
localVariableConfig
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation testBodyMultipartFormdataSingleBinary
|
||||
*
|
||||
* @param myFile (optional)
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun testBodyMultipartFormdataSingleBinaryRequestConfig(myFile: java.io.File?) : RequestConfig<Map<String, PartConfig<*>>> {
|
||||
val localVariableBody = mapOf(
|
||||
"my-file" to PartConfig(body = myFile, headers = mutableMapOf()),)
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
|
||||
localVariableHeaders["Accept"] = "text/plain"
|
||||
|
||||
return RequestConfig(
|
||||
method = RequestMethod.POST,
|
||||
path = "/body/application/octetstream/single_binary",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
requiresAuthentication = false,
|
||||
body = localVariableBody
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Test free form object
|
||||
* Test free form object
|
||||
* @param body Free form object (optional)
|
||||
* @return kotlin.String
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
fun testEchoBodyFreeFormObjectResponseString(body: kotlin.Any? = null) : kotlin.String {
|
||||
val localVarResponse = testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body = body)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||
ResponseType.ClientError -> {
|
||||
val localVarError = localVarResponse as ClientError<*>
|
||||
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
ResponseType.ServerError -> {
|
||||
val localVarError = localVarResponse as ServerError<*>
|
||||
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test free form object
|
||||
* Test free form object
|
||||
* @param body Free form object (optional)
|
||||
* @return ApiResponse<kotlin.String?>
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class)
|
||||
fun testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body: kotlin.Any?) : ApiResponse<kotlin.String?> {
|
||||
val localVariableConfig = testEchoBodyFreeFormObjectResponseStringRequestConfig(body = body)
|
||||
|
||||
return request<kotlin.Any, kotlin.String>(
|
||||
localVariableConfig
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation testEchoBodyFreeFormObjectResponseString
|
||||
*
|
||||
* @param body Free form object (optional)
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun testEchoBodyFreeFormObjectResponseStringRequestConfig(body: kotlin.Any?) : RequestConfig<kotlin.Any> {
|
||||
val localVariableBody = body
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
localVariableHeaders["Content-Type"] = "application/json"
|
||||
localVariableHeaders["Accept"] = "text/plain"
|
||||
|
||||
return RequestConfig(
|
||||
method = RequestMethod.POST,
|
||||
path = "/echo/body/FreeFormObject/response_string",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
requiresAuthentication = false,
|
||||
body = localVariableBody
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
* Test body parameter(s)
|
||||
* @param apiPet Pet object that needs to be added to the store (optional)
|
||||
* @return ApiPet
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
fun testEchoBodyPet(apiPet: ApiPet? = null) : ApiPet {
|
||||
val localVarResponse = testEchoBodyPetWithHttpInfo(apiPet = apiPet)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
ResponseType.Success -> (localVarResponse as Success<*>).data as ApiPet
|
||||
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||
ResponseType.ClientError -> {
|
||||
val localVarError = localVarResponse as ClientError<*>
|
||||
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
ResponseType.ServerError -> {
|
||||
val localVarError = localVarResponse as ServerError<*>
|
||||
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
* Test body parameter(s)
|
||||
* @param apiPet Pet object that needs to be added to the store (optional)
|
||||
* @return ApiResponse<ApiPet?>
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class)
|
||||
fun testEchoBodyPetWithHttpInfo(apiPet: ApiPet?) : ApiResponse<ApiPet?> {
|
||||
val localVariableConfig = testEchoBodyPetRequestConfig(apiPet = apiPet)
|
||||
|
||||
return request<ApiPet, ApiPet>(
|
||||
localVariableConfig
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation testEchoBodyPet
|
||||
*
|
||||
* @param apiPet Pet object that needs to be added to the store (optional)
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun testEchoBodyPetRequestConfig(apiPet: ApiPet?) : RequestConfig<ApiPet> {
|
||||
val localVariableBody = apiPet
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
localVariableHeaders["Content-Type"] = "application/json"
|
||||
localVariableHeaders["Accept"] = "application/json"
|
||||
|
||||
return RequestConfig(
|
||||
method = RequestMethod.POST,
|
||||
path = "/echo/body/Pet",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
requiresAuthentication = false,
|
||||
body = localVariableBody
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Test empty response body
|
||||
* Test empty response body
|
||||
* @param apiPet Pet object that needs to be added to the store (optional)
|
||||
* @return kotlin.String
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
fun testEchoBodyPetResponseString(apiPet: ApiPet? = null) : kotlin.String {
|
||||
val localVarResponse = testEchoBodyPetResponseStringWithHttpInfo(apiPet = apiPet)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||
ResponseType.ClientError -> {
|
||||
val localVarError = localVarResponse as ClientError<*>
|
||||
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
ResponseType.ServerError -> {
|
||||
val localVarError = localVarResponse as ServerError<*>
|
||||
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test empty response body
|
||||
* Test empty response body
|
||||
* @param apiPet Pet object that needs to be added to the store (optional)
|
||||
* @return ApiResponse<kotlin.String?>
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class)
|
||||
fun testEchoBodyPetResponseStringWithHttpInfo(apiPet: ApiPet?) : ApiResponse<kotlin.String?> {
|
||||
val localVariableConfig = testEchoBodyPetResponseStringRequestConfig(apiPet = apiPet)
|
||||
|
||||
return request<ApiPet, kotlin.String>(
|
||||
localVariableConfig
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation testEchoBodyPetResponseString
|
||||
*
|
||||
* @param apiPet Pet object that needs to be added to the store (optional)
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun testEchoBodyPetResponseStringRequestConfig(apiPet: ApiPet?) : RequestConfig<ApiPet> {
|
||||
val localVariableBody = apiPet
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
localVariableHeaders["Content-Type"] = "application/json"
|
||||
localVariableHeaders["Accept"] = "text/plain"
|
||||
|
||||
return RequestConfig(
|
||||
method = RequestMethod.POST,
|
||||
path = "/echo/body/Pet/response_string",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
requiresAuthentication = false,
|
||||
body = localVariableBody
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Test empty json (request body)
|
||||
* Test empty json (request body)
|
||||
* @param apiTag Tag object (optional)
|
||||
* @return kotlin.String
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
fun testEchoBodyTagResponseString(apiTag: ApiTag? = null) : kotlin.String {
|
||||
val localVarResponse = testEchoBodyTagResponseStringWithHttpInfo(apiTag = apiTag)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||
ResponseType.ClientError -> {
|
||||
val localVarError = localVarResponse as ClientError<*>
|
||||
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
ResponseType.ServerError -> {
|
||||
val localVarError = localVarResponse as ServerError<*>
|
||||
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test empty json (request body)
|
||||
* Test empty json (request body)
|
||||
* @param apiTag Tag object (optional)
|
||||
* @return ApiResponse<kotlin.String?>
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class)
|
||||
fun testEchoBodyTagResponseStringWithHttpInfo(apiTag: ApiTag?) : ApiResponse<kotlin.String?> {
|
||||
val localVariableConfig = testEchoBodyTagResponseStringRequestConfig(apiTag = apiTag)
|
||||
|
||||
return request<ApiTag, kotlin.String>(
|
||||
localVariableConfig
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation testEchoBodyTagResponseString
|
||||
*
|
||||
* @param apiTag Tag object (optional)
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun testEchoBodyTagResponseStringRequestConfig(apiTag: ApiTag?) : RequestConfig<ApiTag> {
|
||||
val localVariableBody = apiTag
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
localVariableHeaders["Content-Type"] = "application/json"
|
||||
localVariableHeaders["Accept"] = "text/plain"
|
||||
|
||||
return RequestConfig(
|
||||
method = RequestMethod.POST,
|
||||
path = "/echo/body/Tag/response_string",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
requiresAuthentication = false,
|
||||
body = localVariableBody
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
|
||||
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
|
||||
}
|
||||
@@ -0,0 +1,222 @@
|
||||
/**
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"ArrayInDataClass",
|
||||
"EnumEntryName",
|
||||
"RemoveRedundantQualifierName",
|
||||
"UnusedImport"
|
||||
)
|
||||
|
||||
package org.openapitools.client.apis
|
||||
|
||||
import java.io.IOException
|
||||
import okhttp3.Call
|
||||
import okhttp3.HttpUrl
|
||||
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
|
||||
import org.openapitools.client.infrastructure.ApiClient
|
||||
import org.openapitools.client.infrastructure.ApiResponse
|
||||
import org.openapitools.client.infrastructure.ClientException
|
||||
import org.openapitools.client.infrastructure.ClientError
|
||||
import org.openapitools.client.infrastructure.ServerException
|
||||
import org.openapitools.client.infrastructure.ServerError
|
||||
import org.openapitools.client.infrastructure.MultiValueMap
|
||||
import org.openapitools.client.infrastructure.PartConfig
|
||||
import org.openapitools.client.infrastructure.RequestConfig
|
||||
import org.openapitools.client.infrastructure.RequestMethod
|
||||
import org.openapitools.client.infrastructure.ResponseType
|
||||
import org.openapitools.client.infrastructure.Success
|
||||
import org.openapitools.client.infrastructure.toMultiValue
|
||||
|
||||
class FormApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
val defaultBasePath: String by lazy {
|
||||
System.getProperties().getProperty(ApiClient.baseUrlKey, "http://localhost:3000")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test form parameter(s)
|
||||
* Test form parameter(s)
|
||||
* @param integerForm (optional)
|
||||
* @param booleanForm (optional)
|
||||
* @param stringForm (optional)
|
||||
* @return kotlin.String
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
fun testFormIntegerBooleanString(integerForm: kotlin.Int? = null, booleanForm: kotlin.Boolean? = null, stringForm: kotlin.String? = null) : kotlin.String {
|
||||
val localVarResponse = testFormIntegerBooleanStringWithHttpInfo(integerForm = integerForm, booleanForm = booleanForm, stringForm = stringForm)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||
ResponseType.ClientError -> {
|
||||
val localVarError = localVarResponse as ClientError<*>
|
||||
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
ResponseType.ServerError -> {
|
||||
val localVarError = localVarResponse as ServerError<*>
|
||||
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test form parameter(s)
|
||||
* Test form parameter(s)
|
||||
* @param integerForm (optional)
|
||||
* @param booleanForm (optional)
|
||||
* @param stringForm (optional)
|
||||
* @return ApiResponse<kotlin.String?>
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class)
|
||||
fun testFormIntegerBooleanStringWithHttpInfo(integerForm: kotlin.Int?, booleanForm: kotlin.Boolean?, stringForm: kotlin.String?) : ApiResponse<kotlin.String?> {
|
||||
val localVariableConfig = testFormIntegerBooleanStringRequestConfig(integerForm = integerForm, booleanForm = booleanForm, stringForm = stringForm)
|
||||
|
||||
return request<Map<String, PartConfig<*>>, kotlin.String>(
|
||||
localVariableConfig
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation testFormIntegerBooleanString
|
||||
*
|
||||
* @param integerForm (optional)
|
||||
* @param booleanForm (optional)
|
||||
* @param stringForm (optional)
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun testFormIntegerBooleanStringRequestConfig(integerForm: kotlin.Int?, booleanForm: kotlin.Boolean?, stringForm: kotlin.String?) : RequestConfig<Map<String, PartConfig<*>>> {
|
||||
val localVariableBody = mapOf(
|
||||
"integer_form" to PartConfig(body = integerForm, headers = mutableMapOf()),
|
||||
"boolean_form" to PartConfig(body = booleanForm, headers = mutableMapOf()),
|
||||
"string_form" to PartConfig(body = stringForm, headers = mutableMapOf()),)
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
|
||||
localVariableHeaders["Accept"] = "text/plain"
|
||||
|
||||
return RequestConfig(
|
||||
method = RequestMethod.POST,
|
||||
path = "/form/integer/boolean/string",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
requiresAuthentication = false,
|
||||
body = localVariableBody
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Test form parameter(s) for oneOf schema
|
||||
* Test form parameter(s) for oneOf schema
|
||||
* @param form1 (optional)
|
||||
* @param form2 (optional)
|
||||
* @param form3 (optional)
|
||||
* @param form4 (optional)
|
||||
* @param id (optional)
|
||||
* @param name (optional)
|
||||
* @return kotlin.String
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
fun testFormOneof(form1: kotlin.String? = null, form2: kotlin.Int? = null, form3: kotlin.String? = null, form4: kotlin.Boolean? = null, id: kotlin.Long? = null, name: kotlin.String? = null) : kotlin.String {
|
||||
val localVarResponse = testFormOneofWithHttpInfo(form1 = form1, form2 = form2, form3 = form3, form4 = form4, id = id, name = name)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||
ResponseType.ClientError -> {
|
||||
val localVarError = localVarResponse as ClientError<*>
|
||||
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
ResponseType.ServerError -> {
|
||||
val localVarError = localVarResponse as ServerError<*>
|
||||
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test form parameter(s) for oneOf schema
|
||||
* Test form parameter(s) for oneOf schema
|
||||
* @param form1 (optional)
|
||||
* @param form2 (optional)
|
||||
* @param form3 (optional)
|
||||
* @param form4 (optional)
|
||||
* @param id (optional)
|
||||
* @param name (optional)
|
||||
* @return ApiResponse<kotlin.String?>
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class)
|
||||
fun testFormOneofWithHttpInfo(form1: kotlin.String?, form2: kotlin.Int?, form3: kotlin.String?, form4: kotlin.Boolean?, id: kotlin.Long?, name: kotlin.String?) : ApiResponse<kotlin.String?> {
|
||||
val localVariableConfig = testFormOneofRequestConfig(form1 = form1, form2 = form2, form3 = form3, form4 = form4, id = id, name = name)
|
||||
|
||||
return request<Map<String, PartConfig<*>>, kotlin.String>(
|
||||
localVariableConfig
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation testFormOneof
|
||||
*
|
||||
* @param form1 (optional)
|
||||
* @param form2 (optional)
|
||||
* @param form3 (optional)
|
||||
* @param form4 (optional)
|
||||
* @param id (optional)
|
||||
* @param name (optional)
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun testFormOneofRequestConfig(form1: kotlin.String?, form2: kotlin.Int?, form3: kotlin.String?, form4: kotlin.Boolean?, id: kotlin.Long?, name: kotlin.String?) : RequestConfig<Map<String, PartConfig<*>>> {
|
||||
val localVariableBody = mapOf(
|
||||
"form1" to PartConfig(body = form1, headers = mutableMapOf()),
|
||||
"form2" to PartConfig(body = form2, headers = mutableMapOf()),
|
||||
"form3" to PartConfig(body = form3, headers = mutableMapOf()),
|
||||
"form4" to PartConfig(body = form4, headers = mutableMapOf()),
|
||||
"id" to PartConfig(body = id, headers = mutableMapOf()),
|
||||
"name" to PartConfig(body = name, headers = mutableMapOf()),)
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
|
||||
localVariableHeaders["Accept"] = "text/plain"
|
||||
|
||||
return RequestConfig(
|
||||
method = RequestMethod.POST,
|
||||
path = "/form/oneof",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
requiresAuthentication = false,
|
||||
body = localVariableBody
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
|
||||
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
/**
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"ArrayInDataClass",
|
||||
"EnumEntryName",
|
||||
"RemoveRedundantQualifierName",
|
||||
"UnusedImport"
|
||||
)
|
||||
|
||||
package org.openapitools.client.apis
|
||||
|
||||
import java.io.IOException
|
||||
import okhttp3.Call
|
||||
import okhttp3.HttpUrl
|
||||
|
||||
import org.openapitools.client.models.ApiStringEnumRef
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
|
||||
import org.openapitools.client.infrastructure.ApiClient
|
||||
import org.openapitools.client.infrastructure.ApiResponse
|
||||
import org.openapitools.client.infrastructure.ClientException
|
||||
import org.openapitools.client.infrastructure.ClientError
|
||||
import org.openapitools.client.infrastructure.ServerException
|
||||
import org.openapitools.client.infrastructure.ServerError
|
||||
import org.openapitools.client.infrastructure.MultiValueMap
|
||||
import org.openapitools.client.infrastructure.PartConfig
|
||||
import org.openapitools.client.infrastructure.RequestConfig
|
||||
import org.openapitools.client.infrastructure.RequestMethod
|
||||
import org.openapitools.client.infrastructure.ResponseType
|
||||
import org.openapitools.client.infrastructure.Success
|
||||
import org.openapitools.client.infrastructure.toMultiValue
|
||||
|
||||
class HeaderApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
val defaultBasePath: String by lazy {
|
||||
System.getProperties().getProperty(ApiClient.baseUrlKey, "http://localhost:3000")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* enum for parameter enumNonrefStringHeader
|
||||
*/
|
||||
enum class EnumNonrefStringHeaderTestHeaderIntegerBooleanStringEnums(val value: kotlin.String) {
|
||||
@Json(name = "success") success("success"),
|
||||
@Json(name = "failure") failure("failure"),
|
||||
@Json(name = "unclassified") unclassified("unclassified");
|
||||
|
||||
/**
|
||||
* Override [toString()] to avoid using the enum variable name as the value, and instead use
|
||||
* the actual value defined in the API spec file.
|
||||
*
|
||||
* This solves a problem when the variable name and its value are different, and ensures that
|
||||
* the client sends the correct enum values to the server always.
|
||||
*/
|
||||
override fun toString(): kotlin.String = "$value"
|
||||
}
|
||||
|
||||
/**
|
||||
* Test header parameter(s)
|
||||
* Test header parameter(s)
|
||||
* @param integerHeader (optional)
|
||||
* @param booleanHeader (optional)
|
||||
* @param stringHeader (optional)
|
||||
* @param enumNonrefStringHeader (optional)
|
||||
* @param enumRefStringHeader (optional)
|
||||
* @return kotlin.String
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
fun testHeaderIntegerBooleanStringEnums(integerHeader: kotlin.Int? = null, booleanHeader: kotlin.Boolean? = null, stringHeader: kotlin.String? = null, enumNonrefStringHeader: EnumNonrefStringHeaderTestHeaderIntegerBooleanStringEnums? = null, enumRefStringHeader: ApiStringEnumRef? = null) : kotlin.String {
|
||||
val localVarResponse = testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader = integerHeader, booleanHeader = booleanHeader, stringHeader = stringHeader, enumNonrefStringHeader = enumNonrefStringHeader, enumRefStringHeader = enumRefStringHeader)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||
ResponseType.ClientError -> {
|
||||
val localVarError = localVarResponse as ClientError<*>
|
||||
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
ResponseType.ServerError -> {
|
||||
val localVarError = localVarResponse as ServerError<*>
|
||||
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test header parameter(s)
|
||||
* Test header parameter(s)
|
||||
* @param integerHeader (optional)
|
||||
* @param booleanHeader (optional)
|
||||
* @param stringHeader (optional)
|
||||
* @param enumNonrefStringHeader (optional)
|
||||
* @param enumRefStringHeader (optional)
|
||||
* @return ApiResponse<kotlin.String?>
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class)
|
||||
fun testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader: kotlin.Int?, booleanHeader: kotlin.Boolean?, stringHeader: kotlin.String?, enumNonrefStringHeader: EnumNonrefStringHeaderTestHeaderIntegerBooleanStringEnums?, enumRefStringHeader: ApiStringEnumRef?) : ApiResponse<kotlin.String?> {
|
||||
val localVariableConfig = testHeaderIntegerBooleanStringEnumsRequestConfig(integerHeader = integerHeader, booleanHeader = booleanHeader, stringHeader = stringHeader, enumNonrefStringHeader = enumNonrefStringHeader, enumRefStringHeader = enumRefStringHeader)
|
||||
|
||||
return request<Unit, kotlin.String>(
|
||||
localVariableConfig
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation testHeaderIntegerBooleanStringEnums
|
||||
*
|
||||
* @param integerHeader (optional)
|
||||
* @param booleanHeader (optional)
|
||||
* @param stringHeader (optional)
|
||||
* @param enumNonrefStringHeader (optional)
|
||||
* @param enumRefStringHeader (optional)
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun testHeaderIntegerBooleanStringEnumsRequestConfig(integerHeader: kotlin.Int?, booleanHeader: kotlin.Boolean?, stringHeader: kotlin.String?, enumNonrefStringHeader: EnumNonrefStringHeaderTestHeaderIntegerBooleanStringEnums?, enumRefStringHeader: ApiStringEnumRef?) : RequestConfig<Unit> {
|
||||
val localVariableBody = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
integerHeader?.apply { localVariableHeaders["integer_header"] = this.toString() }
|
||||
booleanHeader?.apply { localVariableHeaders["boolean_header"] = this.toString() }
|
||||
stringHeader?.apply { localVariableHeaders["string_header"] = this.toString() }
|
||||
enumNonrefStringHeader?.apply { localVariableHeaders["enum_nonref_string_header"] = this.toString() }
|
||||
enumRefStringHeader?.apply { localVariableHeaders["enum_ref_string_header"] = this.toString() }
|
||||
localVariableHeaders["Accept"] = "text/plain"
|
||||
|
||||
return RequestConfig(
|
||||
method = RequestMethod.GET,
|
||||
path = "/header/integer/boolean/string/enums",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
requiresAuthentication = false,
|
||||
body = localVariableBody
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
|
||||
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
/**
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"ArrayInDataClass",
|
||||
"EnumEntryName",
|
||||
"RemoveRedundantQualifierName",
|
||||
"UnusedImport"
|
||||
)
|
||||
|
||||
package org.openapitools.client.apis
|
||||
|
||||
import java.io.IOException
|
||||
import okhttp3.Call
|
||||
import okhttp3.HttpUrl
|
||||
|
||||
import org.openapitools.client.models.ApiStringEnumRef
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
|
||||
import org.openapitools.client.infrastructure.ApiClient
|
||||
import org.openapitools.client.infrastructure.ApiResponse
|
||||
import org.openapitools.client.infrastructure.ClientException
|
||||
import org.openapitools.client.infrastructure.ClientError
|
||||
import org.openapitools.client.infrastructure.ServerException
|
||||
import org.openapitools.client.infrastructure.ServerError
|
||||
import org.openapitools.client.infrastructure.MultiValueMap
|
||||
import org.openapitools.client.infrastructure.PartConfig
|
||||
import org.openapitools.client.infrastructure.RequestConfig
|
||||
import org.openapitools.client.infrastructure.RequestMethod
|
||||
import org.openapitools.client.infrastructure.ResponseType
|
||||
import org.openapitools.client.infrastructure.Success
|
||||
import org.openapitools.client.infrastructure.toMultiValue
|
||||
|
||||
class PathApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
val defaultBasePath: String by lazy {
|
||||
System.getProperties().getProperty(ApiClient.baseUrlKey, "http://localhost:3000")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* enum for parameter enumNonrefStringPath
|
||||
*/
|
||||
enum class EnumNonrefStringPathTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(val value: kotlin.String) {
|
||||
@Json(name = "success") success("success"),
|
||||
@Json(name = "failure") failure("failure"),
|
||||
@Json(name = "unclassified") unclassified("unclassified");
|
||||
|
||||
/**
|
||||
* Override [toString()] to avoid using the enum variable name as the value, and instead use
|
||||
* the actual value defined in the API spec file.
|
||||
*
|
||||
* This solves a problem when the variable name and its value are different, and ensures that
|
||||
* the client sends the correct enum values to the server always.
|
||||
*/
|
||||
override fun toString(): kotlin.String = "$value"
|
||||
}
|
||||
|
||||
/**
|
||||
* Test path parameter(s)
|
||||
* Test path parameter(s)
|
||||
* @param pathString
|
||||
* @param pathInteger
|
||||
* @param enumNonrefStringPath
|
||||
* @param enumRefStringPath
|
||||
* @return kotlin.String
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
fun testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString: kotlin.String, pathInteger: kotlin.Int, enumNonrefStringPath: EnumNonrefStringPathTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, enumRefStringPath: ApiStringEnumRef) : kotlin.String {
|
||||
val localVarResponse = testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString = pathString, pathInteger = pathInteger, enumNonrefStringPath = enumNonrefStringPath, enumRefStringPath = enumRefStringPath)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||
ResponseType.ClientError -> {
|
||||
val localVarError = localVarResponse as ClientError<*>
|
||||
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
ResponseType.ServerError -> {
|
||||
val localVarError = localVarResponse as ServerError<*>
|
||||
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test path parameter(s)
|
||||
* Test path parameter(s)
|
||||
* @param pathString
|
||||
* @param pathInteger
|
||||
* @param enumNonrefStringPath
|
||||
* @param enumRefStringPath
|
||||
* @return ApiResponse<kotlin.String?>
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class)
|
||||
fun testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString: kotlin.String, pathInteger: kotlin.Int, enumNonrefStringPath: EnumNonrefStringPathTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, enumRefStringPath: ApiStringEnumRef) : ApiResponse<kotlin.String?> {
|
||||
val localVariableConfig = testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequestConfig(pathString = pathString, pathInteger = pathInteger, enumNonrefStringPath = enumNonrefStringPath, enumRefStringPath = enumRefStringPath)
|
||||
|
||||
return request<Unit, kotlin.String>(
|
||||
localVariableConfig
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath
|
||||
*
|
||||
* @param pathString
|
||||
* @param pathInteger
|
||||
* @param enumNonrefStringPath
|
||||
* @param enumRefStringPath
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequestConfig(pathString: kotlin.String, pathInteger: kotlin.Int, enumNonrefStringPath: EnumNonrefStringPathTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, enumRefStringPath: ApiStringEnumRef) : RequestConfig<Unit> {
|
||||
val localVariableBody = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf()
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
localVariableHeaders["Accept"] = "text/plain"
|
||||
|
||||
return RequestConfig(
|
||||
method = RequestMethod.GET,
|
||||
path = "/path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}".replace("{"+"path_string"+"}", encodeURIComponent(pathString.toString())).replace("{"+"path_integer"+"}", encodeURIComponent(pathInteger.toString())).replace("{"+"enum_nonref_string_path"+"}", encodeURIComponent(enumNonrefStringPath.value.toString())).replace("{"+"enum_ref_string_path"+"}", encodeURIComponent(enumRefStringPath.toString())),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
requiresAuthentication = false,
|
||||
body = localVariableBody
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
|
||||
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
|
||||
}
|
||||
@@ -0,0 +1,557 @@
|
||||
/**
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"ArrayInDataClass",
|
||||
"EnumEntryName",
|
||||
"RemoveRedundantQualifierName",
|
||||
"UnusedImport"
|
||||
)
|
||||
|
||||
package org.openapitools.client.apis
|
||||
|
||||
import java.io.IOException
|
||||
import okhttp3.Call
|
||||
import okhttp3.HttpUrl
|
||||
|
||||
import org.openapitools.client.models.ApiPet
|
||||
import org.openapitools.client.models.ApiStringEnumRef
|
||||
import org.openapitools.client.models.ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
|
||||
import org.openapitools.client.infrastructure.ApiClient
|
||||
import org.openapitools.client.infrastructure.ApiResponse
|
||||
import org.openapitools.client.infrastructure.ClientException
|
||||
import org.openapitools.client.infrastructure.ClientError
|
||||
import org.openapitools.client.infrastructure.ServerException
|
||||
import org.openapitools.client.infrastructure.ServerError
|
||||
import org.openapitools.client.infrastructure.MultiValueMap
|
||||
import org.openapitools.client.infrastructure.PartConfig
|
||||
import org.openapitools.client.infrastructure.RequestConfig
|
||||
import org.openapitools.client.infrastructure.RequestMethod
|
||||
import org.openapitools.client.infrastructure.ResponseType
|
||||
import org.openapitools.client.infrastructure.Success
|
||||
import org.openapitools.client.infrastructure.toMultiValue
|
||||
|
||||
class QueryApi(basePath: kotlin.String = defaultBasePath, client: Call.Factory = ApiClient.defaultClient) : ApiClient(basePath, client) {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
val defaultBasePath: String by lazy {
|
||||
System.getProperties().getProperty(ApiClient.baseUrlKey, "http://localhost:3000")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* enum for parameter enumNonrefStringQuery
|
||||
*/
|
||||
enum class EnumNonrefStringQueryTestEnumRefString(val value: kotlin.String) {
|
||||
@Json(name = "success") success("success"),
|
||||
@Json(name = "failure") failure("failure"),
|
||||
@Json(name = "unclassified") unclassified("unclassified");
|
||||
|
||||
/**
|
||||
* Override [toString()] to avoid using the enum variable name as the value, and instead use
|
||||
* the actual value defined in the API spec file.
|
||||
*
|
||||
* This solves a problem when the variable name and its value are different, and ensures that
|
||||
* the client sends the correct enum values to the server always.
|
||||
*/
|
||||
override fun toString(): kotlin.String = "$value"
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* @param enumNonrefStringQuery (optional)
|
||||
* @param enumRefStringQuery (optional)
|
||||
* @return kotlin.String
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
fun testEnumRefString(enumNonrefStringQuery: EnumNonrefStringQueryTestEnumRefString? = null, enumRefStringQuery: ApiStringEnumRef? = null) : kotlin.String {
|
||||
val localVarResponse = testEnumRefStringWithHttpInfo(enumNonrefStringQuery = enumNonrefStringQuery, enumRefStringQuery = enumRefStringQuery)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||
ResponseType.ClientError -> {
|
||||
val localVarError = localVarResponse as ClientError<*>
|
||||
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
ResponseType.ServerError -> {
|
||||
val localVarError = localVarResponse as ServerError<*>
|
||||
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* @param enumNonrefStringQuery (optional)
|
||||
* @param enumRefStringQuery (optional)
|
||||
* @return ApiResponse<kotlin.String?>
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class)
|
||||
fun testEnumRefStringWithHttpInfo(enumNonrefStringQuery: EnumNonrefStringQueryTestEnumRefString?, enumRefStringQuery: ApiStringEnumRef?) : ApiResponse<kotlin.String?> {
|
||||
val localVariableConfig = testEnumRefStringRequestConfig(enumNonrefStringQuery = enumNonrefStringQuery, enumRefStringQuery = enumRefStringQuery)
|
||||
|
||||
return request<Unit, kotlin.String>(
|
||||
localVariableConfig
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation testEnumRefString
|
||||
*
|
||||
* @param enumNonrefStringQuery (optional)
|
||||
* @param enumRefStringQuery (optional)
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun testEnumRefStringRequestConfig(enumNonrefStringQuery: EnumNonrefStringQueryTestEnumRefString?, enumRefStringQuery: ApiStringEnumRef?) : RequestConfig<Unit> {
|
||||
val localVariableBody = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, kotlin.collections.List<kotlin.String>>()
|
||||
.apply {
|
||||
if (enumNonrefStringQuery != null) {
|
||||
put("enum_nonref_string_query", listOf(enumNonrefStringQuery.value))
|
||||
}
|
||||
if (enumRefStringQuery != null) {
|
||||
put("enum_ref_string_query", listOf(enumRefStringQuery.toString()))
|
||||
}
|
||||
}
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
localVariableHeaders["Accept"] = "text/plain"
|
||||
|
||||
return RequestConfig(
|
||||
method = RequestMethod.GET,
|
||||
path = "/query/enum_ref_string",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
requiresAuthentication = false,
|
||||
body = localVariableBody
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* @param datetimeQuery (optional)
|
||||
* @param dateQuery (optional)
|
||||
* @param stringQuery (optional)
|
||||
* @return kotlin.String
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
fun testQueryDatetimeDateString(datetimeQuery: java.time.OffsetDateTime? = null, dateQuery: java.time.LocalDate? = null, stringQuery: kotlin.String? = null) : kotlin.String {
|
||||
val localVarResponse = testQueryDatetimeDateStringWithHttpInfo(datetimeQuery = datetimeQuery, dateQuery = dateQuery, stringQuery = stringQuery)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||
ResponseType.ClientError -> {
|
||||
val localVarError = localVarResponse as ClientError<*>
|
||||
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
ResponseType.ServerError -> {
|
||||
val localVarError = localVarResponse as ServerError<*>
|
||||
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* @param datetimeQuery (optional)
|
||||
* @param dateQuery (optional)
|
||||
* @param stringQuery (optional)
|
||||
* @return ApiResponse<kotlin.String?>
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class)
|
||||
fun testQueryDatetimeDateStringWithHttpInfo(datetimeQuery: java.time.OffsetDateTime?, dateQuery: java.time.LocalDate?, stringQuery: kotlin.String?) : ApiResponse<kotlin.String?> {
|
||||
val localVariableConfig = testQueryDatetimeDateStringRequestConfig(datetimeQuery = datetimeQuery, dateQuery = dateQuery, stringQuery = stringQuery)
|
||||
|
||||
return request<Unit, kotlin.String>(
|
||||
localVariableConfig
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation testQueryDatetimeDateString
|
||||
*
|
||||
* @param datetimeQuery (optional)
|
||||
* @param dateQuery (optional)
|
||||
* @param stringQuery (optional)
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun testQueryDatetimeDateStringRequestConfig(datetimeQuery: java.time.OffsetDateTime?, dateQuery: java.time.LocalDate?, stringQuery: kotlin.String?) : RequestConfig<Unit> {
|
||||
val localVariableBody = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, kotlin.collections.List<kotlin.String>>()
|
||||
.apply {
|
||||
if (datetimeQuery != null) {
|
||||
put("datetime_query", listOf(parseDateToQueryString(datetimeQuery)))
|
||||
}
|
||||
if (dateQuery != null) {
|
||||
put("date_query", listOf(parseDateToQueryString(dateQuery)))
|
||||
}
|
||||
if (stringQuery != null) {
|
||||
put("string_query", listOf(stringQuery.toString()))
|
||||
}
|
||||
}
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
localVariableHeaders["Accept"] = "text/plain"
|
||||
|
||||
return RequestConfig(
|
||||
method = RequestMethod.GET,
|
||||
path = "/query/datetime/date/string",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
requiresAuthentication = false,
|
||||
body = localVariableBody
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* @param integerQuery (optional)
|
||||
* @param booleanQuery (optional)
|
||||
* @param stringQuery (optional)
|
||||
* @return kotlin.String
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
fun testQueryIntegerBooleanString(integerQuery: kotlin.Int? = null, booleanQuery: kotlin.Boolean? = null, stringQuery: kotlin.String? = null) : kotlin.String {
|
||||
val localVarResponse = testQueryIntegerBooleanStringWithHttpInfo(integerQuery = integerQuery, booleanQuery = booleanQuery, stringQuery = stringQuery)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||
ResponseType.ClientError -> {
|
||||
val localVarError = localVarResponse as ClientError<*>
|
||||
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
ResponseType.ServerError -> {
|
||||
val localVarError = localVarResponse as ServerError<*>
|
||||
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* @param integerQuery (optional)
|
||||
* @param booleanQuery (optional)
|
||||
* @param stringQuery (optional)
|
||||
* @return ApiResponse<kotlin.String?>
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class)
|
||||
fun testQueryIntegerBooleanStringWithHttpInfo(integerQuery: kotlin.Int?, booleanQuery: kotlin.Boolean?, stringQuery: kotlin.String?) : ApiResponse<kotlin.String?> {
|
||||
val localVariableConfig = testQueryIntegerBooleanStringRequestConfig(integerQuery = integerQuery, booleanQuery = booleanQuery, stringQuery = stringQuery)
|
||||
|
||||
return request<Unit, kotlin.String>(
|
||||
localVariableConfig
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation testQueryIntegerBooleanString
|
||||
*
|
||||
* @param integerQuery (optional)
|
||||
* @param booleanQuery (optional)
|
||||
* @param stringQuery (optional)
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun testQueryIntegerBooleanStringRequestConfig(integerQuery: kotlin.Int?, booleanQuery: kotlin.Boolean?, stringQuery: kotlin.String?) : RequestConfig<Unit> {
|
||||
val localVariableBody = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, kotlin.collections.List<kotlin.String>>()
|
||||
.apply {
|
||||
if (integerQuery != null) {
|
||||
put("integer_query", listOf(integerQuery.toString()))
|
||||
}
|
||||
if (booleanQuery != null) {
|
||||
put("boolean_query", listOf(booleanQuery.toString()))
|
||||
}
|
||||
if (stringQuery != null) {
|
||||
put("string_query", listOf(stringQuery.toString()))
|
||||
}
|
||||
}
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
localVariableHeaders["Accept"] = "text/plain"
|
||||
|
||||
return RequestConfig(
|
||||
method = RequestMethod.GET,
|
||||
path = "/query/integer/boolean/string",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
requiresAuthentication = false,
|
||||
body = localVariableBody
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* @param queryObject (optional)
|
||||
* @return kotlin.String
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
fun testQueryStyleDeepObjectExplodeTrueObject(queryObject: ApiPet? = null) : kotlin.String {
|
||||
val localVarResponse = testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject = queryObject)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||
ResponseType.ClientError -> {
|
||||
val localVarError = localVarResponse as ClientError<*>
|
||||
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
ResponseType.ServerError -> {
|
||||
val localVarError = localVarResponse as ServerError<*>
|
||||
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* @param queryObject (optional)
|
||||
* @return ApiResponse<kotlin.String?>
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class)
|
||||
fun testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject: ApiPet?) : ApiResponse<kotlin.String?> {
|
||||
val localVariableConfig = testQueryStyleDeepObjectExplodeTrueObjectRequestConfig(queryObject = queryObject)
|
||||
|
||||
return request<Unit, kotlin.String>(
|
||||
localVariableConfig
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation testQueryStyleDeepObjectExplodeTrueObject
|
||||
*
|
||||
* @param queryObject (optional)
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun testQueryStyleDeepObjectExplodeTrueObjectRequestConfig(queryObject: ApiPet?) : RequestConfig<Unit> {
|
||||
val localVariableBody = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, kotlin.collections.List<kotlin.String>>()
|
||||
.apply {
|
||||
if (queryObject != null) {
|
||||
put("query_object", listOf(queryObject.toString()))
|
||||
}
|
||||
}
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
localVariableHeaders["Accept"] = "text/plain"
|
||||
|
||||
return RequestConfig(
|
||||
method = RequestMethod.GET,
|
||||
path = "/query/style_deepObject/explode_true/object",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
requiresAuthentication = false,
|
||||
body = localVariableBody
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* @param queryObject (optional)
|
||||
* @return kotlin.String
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
fun testQueryStyleFormExplodeTrueArrayString(queryObject: ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter? = null) : kotlin.String {
|
||||
val localVarResponse = testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject = queryObject)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||
ResponseType.ClientError -> {
|
||||
val localVarError = localVarResponse as ClientError<*>
|
||||
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
ResponseType.ServerError -> {
|
||||
val localVarError = localVarResponse as ServerError<*>
|
||||
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* @param queryObject (optional)
|
||||
* @return ApiResponse<kotlin.String?>
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class)
|
||||
fun testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject: ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter?) : ApiResponse<kotlin.String?> {
|
||||
val localVariableConfig = testQueryStyleFormExplodeTrueArrayStringRequestConfig(queryObject = queryObject)
|
||||
|
||||
return request<Unit, kotlin.String>(
|
||||
localVariableConfig
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation testQueryStyleFormExplodeTrueArrayString
|
||||
*
|
||||
* @param queryObject (optional)
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun testQueryStyleFormExplodeTrueArrayStringRequestConfig(queryObject: ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter?) : RequestConfig<Unit> {
|
||||
val localVariableBody = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, kotlin.collections.List<kotlin.String>>()
|
||||
.apply {
|
||||
if (queryObject != null) {
|
||||
put("query_object", listOf(queryObject.toString()))
|
||||
}
|
||||
}
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
localVariableHeaders["Accept"] = "text/plain"
|
||||
|
||||
return RequestConfig(
|
||||
method = RequestMethod.GET,
|
||||
path = "/query/style_form/explode_true/array_string",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
requiresAuthentication = false,
|
||||
body = localVariableBody
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* @param queryObject (optional)
|
||||
* @return kotlin.String
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
* @throws UnsupportedOperationException If the API returns an informational or redirection response
|
||||
* @throws ClientException If the API returns a client error response
|
||||
* @throws ServerException If the API returns a server error response
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||
fun testQueryStyleFormExplodeTrueObject(queryObject: ApiPet? = null) : kotlin.String {
|
||||
val localVarResponse = testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject = queryObject)
|
||||
|
||||
return when (localVarResponse.responseType) {
|
||||
ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
|
||||
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
|
||||
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
|
||||
ResponseType.ClientError -> {
|
||||
val localVarError = localVarResponse as ClientError<*>
|
||||
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
ResponseType.ServerError -> {
|
||||
val localVarError = localVarResponse as ServerError<*>
|
||||
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body}", localVarError.statusCode, localVarResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* @param queryObject (optional)
|
||||
* @return ApiResponse<kotlin.String?>
|
||||
* @throws IllegalStateException If the request is not correctly configured
|
||||
* @throws IOException Rethrows the OkHttp execute method exception
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Throws(IllegalStateException::class, IOException::class)
|
||||
fun testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject: ApiPet?) : ApiResponse<kotlin.String?> {
|
||||
val localVariableConfig = testQueryStyleFormExplodeTrueObjectRequestConfig(queryObject = queryObject)
|
||||
|
||||
return request<Unit, kotlin.String>(
|
||||
localVariableConfig
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* To obtain the request config of the operation testQueryStyleFormExplodeTrueObject
|
||||
*
|
||||
* @param queryObject (optional)
|
||||
* @return RequestConfig
|
||||
*/
|
||||
fun testQueryStyleFormExplodeTrueObjectRequestConfig(queryObject: ApiPet?) : RequestConfig<Unit> {
|
||||
val localVariableBody = null
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, kotlin.collections.List<kotlin.String>>()
|
||||
.apply {
|
||||
if (queryObject != null) {
|
||||
put("query_object", listOf(queryObject.toString()))
|
||||
}
|
||||
}
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
localVariableHeaders["Accept"] = "text/plain"
|
||||
|
||||
return RequestConfig(
|
||||
method = RequestMethod.GET,
|
||||
path = "/query/style_form/explode_true/object",
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
requiresAuthentication = false,
|
||||
body = localVariableBody
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
|
||||
HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
typealias MultiValueMap = MutableMap<String,List<String>>
|
||||
|
||||
fun collectionDelimiter(collectionFormat: String): String = when(collectionFormat) {
|
||||
"csv" -> ","
|
||||
"tsv" -> "\t"
|
||||
"pipe" -> "|"
|
||||
"space" -> " "
|
||||
else -> ""
|
||||
}
|
||||
|
||||
val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" }
|
||||
|
||||
fun <T : Any?> toMultiValue(items: Array<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List<String>
|
||||
= 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,375 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.RequestBody
|
||||
import okhttp3.RequestBody.Companion.asRequestBody
|
||||
import okhttp3.RequestBody.Companion.toRequestBody
|
||||
import okhttp3.FormBody
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
||||
import okhttp3.ResponseBody
|
||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||
import okhttp3.Request
|
||||
import okhttp3.Headers
|
||||
import okhttp3.Headers.Builder
|
||||
import okhttp3.Headers.Companion.toHeaders
|
||||
import okhttp3.MultipartBody
|
||||
import okhttp3.Call
|
||||
import okhttp3.Callback
|
||||
import okhttp3.Response
|
||||
import java.io.BufferedWriter
|
||||
import java.io.File
|
||||
import java.io.FileWriter
|
||||
import java.io.IOException
|
||||
import java.net.URLConnection
|
||||
import java.time.LocalDate
|
||||
import java.time.LocalDateTime
|
||||
import java.time.LocalTime
|
||||
import java.time.OffsetDateTime
|
||||
import java.time.OffsetTime
|
||||
import java.util.Locale
|
||||
import java.util.regex.Pattern
|
||||
import com.squareup.moshi.adapter
|
||||
|
||||
val EMPTY_REQUEST: RequestBody = ByteArray(0).toRequestBody()
|
||||
|
||||
open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClient) {
|
||||
companion object {
|
||||
protected const val ContentType: String = "Content-Type"
|
||||
protected const val Accept: String = "Accept"
|
||||
protected const val Authorization: String = "Authorization"
|
||||
protected const val JsonMediaType: String = "application/json"
|
||||
protected const val FormDataMediaType: String = "multipart/form-data"
|
||||
protected const val FormUrlEncMediaType: String = "application/x-www-form-urlencoded"
|
||||
protected const val XmlMediaType: String = "application/xml"
|
||||
protected const val OctetMediaType: String = "application/octet-stream"
|
||||
protected const val TextMediaType: String = "text/plain"
|
||||
|
||||
val apiKey: MutableMap<String, String> = mutableMapOf()
|
||||
val apiKeyPrefix: MutableMap<String, String> = mutableMapOf()
|
||||
var username: String? = null
|
||||
var password: String? = null
|
||||
var accessToken: String? = null
|
||||
const val baseUrlKey: String = "org.openapitools.client.baseUrl"
|
||||
|
||||
@JvmStatic
|
||||
val defaultClient: OkHttpClient by lazy {
|
||||
builder.build()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
val builder: OkHttpClient.Builder = OkHttpClient.Builder()
|
||||
}
|
||||
|
||||
/**
|
||||
* Guess Content-Type header from the given byteArray (defaults to "application/octet-stream").
|
||||
*
|
||||
* @param byteArray The given file
|
||||
* @return The guessed Content-Type
|
||||
*/
|
||||
protected fun guessContentTypeFromByteArray(byteArray: ByteArray): String {
|
||||
val contentType = try {
|
||||
URLConnection.guessContentTypeFromStream(byteArray.inputStream())
|
||||
} catch (io: IOException) {
|
||||
"application/octet-stream"
|
||||
}
|
||||
return contentType
|
||||
}
|
||||
|
||||
/**
|
||||
* Guess Content-Type header from the given file (defaults to "application/octet-stream").
|
||||
*
|
||||
* @param file The given file
|
||||
* @return The guessed Content-Type
|
||||
*/
|
||||
protected fun guessContentTypeFromFile(file: File): String {
|
||||
val contentType = URLConnection.guessContentTypeFromName(file.name)
|
||||
return contentType ?: "application/octet-stream"
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a File to a MultipartBody.Builder
|
||||
* Defined a helper in the requestBody method to not duplicate code
|
||||
* It will be used when the content is a FormDataMediaType and the body of the PartConfig is a File
|
||||
*
|
||||
* @param name The field name to add in the request
|
||||
* @param headers The headers that are in the PartConfig
|
||||
* @param file The file that will be added as the field value
|
||||
* @return The method returns Unit but the new Part is added to the Builder that the extension function is applying on
|
||||
* @see requestBody
|
||||
*/
|
||||
protected fun MultipartBody.Builder.addPartToMultiPart(name: String, headers: Map<String, String>, file: File) {
|
||||
val partHeaders = headers.toMutableMap() +
|
||||
("Content-Disposition" to "form-data; name=\"$name\"; filename=\"${file.name}\"")
|
||||
val fileMediaType = guessContentTypeFromFile(file).toMediaTypeOrNull()
|
||||
addPart(
|
||||
partHeaders.toHeaders(),
|
||||
file.asRequestBody(fileMediaType)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds any type to a MultipartBody.Builder
|
||||
* Defined a helper in the requestBody method to not duplicate code
|
||||
* It will be used when the content is a FormDataMediaType and the body of the PartConfig is not a File.
|
||||
*
|
||||
* @param name The field name to add in the request
|
||||
* @param headers The headers that are in the PartConfig
|
||||
* @param obj The field name to add in the request
|
||||
* @return The method returns Unit but the new Part is added to the Builder that the extension function is applying on
|
||||
* @see requestBody
|
||||
*/
|
||||
protected fun <T> MultipartBody.Builder.addPartToMultiPart(name: String, headers: Map<String, String>, obj: T?) {
|
||||
val partHeaders = headers.toMutableMap() +
|
||||
("Content-Disposition" to "form-data; name=\"$name\"")
|
||||
addPart(
|
||||
partHeaders.toHeaders(),
|
||||
parameterToString(obj).toRequestBody(null)
|
||||
)
|
||||
}
|
||||
|
||||
protected inline fun <reified T> requestBody(content: T, mediaType: String?): RequestBody =
|
||||
when {
|
||||
content is ByteArray -> content.toRequestBody((mediaType ?: guessContentTypeFromByteArray(content)).toMediaTypeOrNull())
|
||||
content is File -> content.asRequestBody((mediaType ?: guessContentTypeFromFile(content)).toMediaTypeOrNull())
|
||||
mediaType == FormDataMediaType ->
|
||||
MultipartBody.Builder()
|
||||
.setType(MultipartBody.FORM)
|
||||
.apply {
|
||||
// content's type *must* be Map<String, PartConfig<*>>
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
(content as Map<String, PartConfig<*>>).forEach { (name, part) ->
|
||||
when (part.body) {
|
||||
is File -> addPartToMultiPart(name, part.headers, part.body)
|
||||
is List<*> -> {
|
||||
part.body.forEach {
|
||||
if (it is File) {
|
||||
addPartToMultiPart(name, part.headers, it)
|
||||
} else {
|
||||
addPartToMultiPart(name, part.headers, it)
|
||||
}
|
||||
}
|
||||
}
|
||||
else -> addPartToMultiPart(name, part.headers, part.body)
|
||||
}
|
||||
}
|
||||
}.build()
|
||||
mediaType == FormUrlEncMediaType -> {
|
||||
FormBody.Builder().apply {
|
||||
// content's type *must* be Map<String, PartConfig<*>>
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
(content as Map<String, PartConfig<*>>).forEach { (name, part) ->
|
||||
add(name, parameterToString(part.body))
|
||||
}
|
||||
}.build()
|
||||
}
|
||||
mediaType == null || mediaType.startsWith("application/") && mediaType.endsWith("json") ->
|
||||
if (content == null) {
|
||||
EMPTY_REQUEST
|
||||
} else {
|
||||
Serializer.moshi.adapter(T::class.java).toJson(content)
|
||||
.toRequestBody((mediaType ?: JsonMediaType).toMediaTypeOrNull())
|
||||
}
|
||||
mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.")
|
||||
mediaType == TextMediaType && content is String ->
|
||||
content.toRequestBody(TextMediaType.toMediaTypeOrNull())
|
||||
// TODO: this should be extended with other serializers
|
||||
else -> throw UnsupportedOperationException("requestBody currently only supports JSON body, text body, byte body and File body.")
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalStdlibApi::class)
|
||||
protected inline fun <reified T: Any?> responseBody(response: Response, mediaType: String? = JsonMediaType): T? {
|
||||
val body = response.body
|
||||
if(body == null) {
|
||||
return null
|
||||
} else if (T::class.java == Unit::class.java) {
|
||||
// No need to parse the body when we're not interested in the body
|
||||
// Useful when API is returning other Content-Type
|
||||
return null
|
||||
} else if (T::class.java == File::class.java) {
|
||||
// return tempFile
|
||||
val contentDisposition = response.header("Content-Disposition")
|
||||
|
||||
val fileName = if (contentDisposition != null) {
|
||||
// Get filename from the Content-Disposition header.
|
||||
val pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?")
|
||||
val matcher = pattern.matcher(contentDisposition)
|
||||
if (matcher.find()) {
|
||||
matcher.group(1)
|
||||
?.replace(".*[/\\\\]", "")
|
||||
?.replace(";", "")
|
||||
} else {
|
||||
null
|
||||
}
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
var prefix: String?
|
||||
val suffix: String?
|
||||
if (fileName == null) {
|
||||
prefix = "download"
|
||||
suffix = ""
|
||||
} else {
|
||||
val pos = fileName.lastIndexOf(".")
|
||||
if (pos == -1) {
|
||||
prefix = fileName
|
||||
suffix = null
|
||||
} else {
|
||||
prefix = fileName.substring(0, pos)
|
||||
suffix = fileName.substring(pos)
|
||||
}
|
||||
// Files.createTempFile requires the prefix to be at least three characters long
|
||||
if (prefix.length < 3) {
|
||||
prefix = "download"
|
||||
}
|
||||
}
|
||||
|
||||
// Attention: if you are developing an android app that supports API Level 25 and below, please check flag supportAndroidApiLevel25AndBelow in https://openapi-generator.tech/docs/generators/kotlin#config-options
|
||||
val tempFile = java.nio.file.Files.createTempFile(prefix, suffix).toFile()
|
||||
tempFile.deleteOnExit()
|
||||
body.byteStream().use { inputStream ->
|
||||
tempFile.outputStream().use { tempFileOutputStream ->
|
||||
inputStream.copyTo(tempFileOutputStream)
|
||||
}
|
||||
}
|
||||
return tempFile as T
|
||||
}
|
||||
|
||||
return when {
|
||||
mediaType == null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> {
|
||||
val bodyContent = body.string()
|
||||
if (bodyContent.isEmpty()) {
|
||||
return null
|
||||
}
|
||||
Serializer.moshi.adapter<T>().fromJson(bodyContent)
|
||||
}
|
||||
mediaType == OctetMediaType -> body.bytes() as? T
|
||||
mediaType == TextMediaType -> body.string() as? T
|
||||
else -> throw UnsupportedOperationException("responseBody currently only supports JSON body, text body and byte body.")
|
||||
}
|
||||
}
|
||||
|
||||
protected fun <T> updateAuthParams(requestConfig: RequestConfig<T>) {
|
||||
if (requestConfig.headers[Authorization].isNullOrEmpty()) {
|
||||
username?.let { username ->
|
||||
password?.let { password ->
|
||||
requestConfig.headers[Authorization] = okhttp3.Credentials.basic(username, password)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (requestConfig.headers[Authorization].isNullOrEmpty()) {
|
||||
accessToken?.let { accessToken ->
|
||||
requestConfig.headers[Authorization] = "Bearer $accessToken"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected inline fun <reified I, reified T: Any?> request(requestConfig: RequestConfig<I>): ApiResponse<T?> {
|
||||
val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
|
||||
|
||||
// take authMethod from operation
|
||||
updateAuthParams(requestConfig)
|
||||
|
||||
val url = httpUrl.newBuilder()
|
||||
.addEncodedPathSegments(requestConfig.path.trimStart('/'))
|
||||
.apply {
|
||||
requestConfig.query.forEach { query ->
|
||||
query.value.forEach { queryValue ->
|
||||
addQueryParameter(query.key, queryValue)
|
||||
}
|
||||
}
|
||||
}.build()
|
||||
|
||||
// take content-type/accept from spec or set to default (application/json) if not defined
|
||||
if (requestConfig.body != null && requestConfig.headers[ContentType].isNullOrEmpty()) {
|
||||
requestConfig.headers[ContentType] = JsonMediaType
|
||||
}
|
||||
if (requestConfig.headers[Accept].isNullOrEmpty()) {
|
||||
requestConfig.headers[Accept] = JsonMediaType
|
||||
}
|
||||
val headers = requestConfig.headers
|
||||
|
||||
if (headers[Accept].isNullOrEmpty()) {
|
||||
throw kotlin.IllegalStateException("Missing Accept header. This is required.")
|
||||
}
|
||||
|
||||
val contentType = if (headers[ContentType] != null) {
|
||||
// TODO: support multiple contentType options here.
|
||||
(headers[ContentType] as String).substringBefore(";").lowercase(Locale.US)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
val request = when (requestConfig.method) {
|
||||
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(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 {
|
||||
val headersBuilder = Headers.Builder()
|
||||
headers.forEach { header ->
|
||||
headersBuilder.add(header.key, header.value)
|
||||
}
|
||||
this.headers(headersBuilder.build())
|
||||
}.build()
|
||||
|
||||
val response = client.newCall(request).execute()
|
||||
|
||||
val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.US)
|
||||
|
||||
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
||||
@Suppress("UNNECESSARY_SAFE_CALL")
|
||||
return response.use {
|
||||
when {
|
||||
it.isRedirect -> Redirection(
|
||||
it.code,
|
||||
it.headers.toMultimap()
|
||||
)
|
||||
it.isInformational -> Informational(
|
||||
it.message,
|
||||
it.code,
|
||||
it.headers.toMultimap()
|
||||
)
|
||||
it.isSuccessful -> Success(
|
||||
responseBody(it, accept),
|
||||
it.code,
|
||||
it.headers.toMultimap()
|
||||
)
|
||||
it.isClientError -> ClientError(
|
||||
it.message,
|
||||
it.body?.string(),
|
||||
it.code,
|
||||
it.headers.toMultimap()
|
||||
)
|
||||
else -> ServerError(
|
||||
it.message,
|
||||
it.body?.string(),
|
||||
it.code,
|
||||
it.headers.toMultimap()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected fun parameterToString(value: Any?): String = when (value) {
|
||||
null -> ""
|
||||
is Array<*> -> toMultiValue(value, "csv").toString()
|
||||
is Iterable<*> -> toMultiValue(value, "csv").toString()
|
||||
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime ->
|
||||
parseDateToQueryString(value)
|
||||
else -> value.toString()
|
||||
}
|
||||
|
||||
protected inline fun <reified T: Any> parseDateToQueryString(value : T): String {
|
||||
/*
|
||||
.replace("\"", "") converts the json object string to an actual string for the query parameter.
|
||||
The moshi or gson adapter allows a more generic solution instead of trying to use a native
|
||||
formatter. It also easily allows to provide a simple way to define a custom date format pattern
|
||||
inside a gson/moshi adapter.
|
||||
*/
|
||||
return Serializer.moshi.adapter(T::class.java).toJson(value).replace("\"", "")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
enum class ResponseType {
|
||||
Success, Informational, Redirection, ClientError, ServerError
|
||||
}
|
||||
|
||||
interface Response
|
||||
|
||||
abstract class ApiResponse<T>(val responseType: ResponseType): Response {
|
||||
abstract val statusCode: Int
|
||||
abstract val headers: Map<String,List<String>>
|
||||
}
|
||||
|
||||
class Success<T>(
|
||||
val data: T,
|
||||
override val statusCode: Int = -1,
|
||||
override val headers: Map<String, List<String>> = mapOf()
|
||||
): ApiResponse<T>(ResponseType.Success)
|
||||
|
||||
class Informational<T>(
|
||||
val statusText: String,
|
||||
override val statusCode: Int = -1,
|
||||
override val headers: Map<String, List<String>> = mapOf()
|
||||
) : ApiResponse<T>(ResponseType.Informational)
|
||||
|
||||
class Redirection<T>(
|
||||
override val statusCode: Int = -1,
|
||||
override val headers: Map<String, List<String>> = mapOf()
|
||||
) : ApiResponse<T>(ResponseType.Redirection)
|
||||
|
||||
class ClientError<T>(
|
||||
val message: String? = null,
|
||||
val body: Any? = null,
|
||||
override val statusCode: Int = -1,
|
||||
override val headers: Map<String, List<String>> = mapOf()
|
||||
) : ApiResponse<T>(ResponseType.ClientError)
|
||||
|
||||
class ServerError<T>(
|
||||
val message: String? = null,
|
||||
val body: Any? = null,
|
||||
override val statusCode: Int = -1,
|
||||
override val headers: Map<String, List<String>> = mapOf()
|
||||
): ApiResponse<T>(ResponseType.ServerError)
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import com.squareup.moshi.FromJson
|
||||
import com.squareup.moshi.ToJson
|
||||
import java.math.BigDecimal
|
||||
|
||||
class BigDecimalAdapter {
|
||||
@ToJson
|
||||
fun toJson(value: BigDecimal): String {
|
||||
return value.toPlainString()
|
||||
}
|
||||
|
||||
@FromJson
|
||||
fun fromJson(value: String): BigDecimal {
|
||||
return BigDecimal(value)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import com.squareup.moshi.FromJson
|
||||
import com.squareup.moshi.ToJson
|
||||
import java.math.BigInteger
|
||||
|
||||
class BigIntegerAdapter {
|
||||
@ToJson
|
||||
fun toJson(value: BigInteger): String {
|
||||
return value.toString()
|
||||
}
|
||||
|
||||
@FromJson
|
||||
fun fromJson(value: String): BigInteger {
|
||||
return BigInteger(value)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import com.squareup.moshi.FromJson
|
||||
import com.squareup.moshi.ToJson
|
||||
|
||||
class ByteArrayAdapter {
|
||||
@ToJson
|
||||
fun toJson(data: ByteArray): String = String(data)
|
||||
|
||||
@FromJson
|
||||
fun fromJson(data: String): ByteArray = data.toByteArray()
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
@file:Suppress("unused")
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import java.lang.RuntimeException
|
||||
|
||||
open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123L
|
||||
}
|
||||
}
|
||||
|
||||
open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 456L
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import com.squareup.moshi.FromJson
|
||||
import com.squareup.moshi.ToJson
|
||||
import java.time.LocalDate
|
||||
import java.time.format.DateTimeFormatter
|
||||
|
||||
class LocalDateAdapter {
|
||||
@ToJson
|
||||
fun toJson(value: LocalDate): String {
|
||||
return DateTimeFormatter.ISO_LOCAL_DATE.format(value)
|
||||
}
|
||||
|
||||
@FromJson
|
||||
fun fromJson(value: String): LocalDate {
|
||||
return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import com.squareup.moshi.FromJson
|
||||
import com.squareup.moshi.ToJson
|
||||
import java.time.LocalDateTime
|
||||
import java.time.format.DateTimeFormatter
|
||||
|
||||
class LocalDateTimeAdapter {
|
||||
@ToJson
|
||||
fun toJson(value: LocalDateTime): String {
|
||||
return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value)
|
||||
}
|
||||
|
||||
@FromJson
|
||||
fun fromJson(value: String): LocalDateTime {
|
||||
return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import com.squareup.moshi.FromJson
|
||||
import com.squareup.moshi.ToJson
|
||||
import java.time.OffsetDateTime
|
||||
import java.time.format.DateTimeFormatter
|
||||
|
||||
class OffsetDateTimeAdapter {
|
||||
@ToJson
|
||||
fun toJson(value: OffsetDateTime): String {
|
||||
return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value)
|
||||
}
|
||||
|
||||
@FromJson
|
||||
fun fromJson(value: String): OffsetDateTime {
|
||||
return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
/**
|
||||
* Defines a config object for a given part of a multi-part request.
|
||||
* NOTE: Headers is a Map<String,String> because rfc2616 defines
|
||||
* multi-valued headers as csv-only.
|
||||
*/
|
||||
data class PartConfig<T>(
|
||||
val headers: MutableMap<String, String> = mutableMapOf(),
|
||||
val body: T? = null
|
||||
)
|
||||
@@ -0,0 +1,19 @@
|
||||
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<T>(
|
||||
val method: RequestMethod,
|
||||
val path: String,
|
||||
val headers: MutableMap<String, String> = mutableMapOf(),
|
||||
val params: MutableMap<String, Any> = mutableMapOf(),
|
||||
val query: MutableMap<String, List<String>> = mutableMapOf(),
|
||||
val requiresAuthentication: Boolean,
|
||||
val body: T? = null
|
||||
)
|
||||
@@ -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,24 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import okhttp3.Response
|
||||
|
||||
/**
|
||||
* Provides an extension to evaluation whether the response is a 1xx code
|
||||
*/
|
||||
val Response.isInformational : Boolean get() = this.code in 100..199
|
||||
|
||||
/**
|
||||
* Provides an extension to evaluation whether the response is a 3xx code
|
||||
*/
|
||||
@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
|
||||
val Response.isRedirect : Boolean get() = this.code in 300..399
|
||||
|
||||
/**
|
||||
* Provides an extension to evaluation whether the response is a 4xx code
|
||||
*/
|
||||
val Response.isClientError : Boolean get() = this.code in 400..499
|
||||
|
||||
/**
|
||||
* Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code
|
||||
*/
|
||||
val Response.isServerError : Boolean get() = this.code in 500..999
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import com.squareup.moshi.Moshi
|
||||
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
|
||||
|
||||
object Serializer {
|
||||
@JvmStatic
|
||||
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
||||
.add(OffsetDateTimeAdapter())
|
||||
.add(LocalDateTimeAdapter())
|
||||
.add(LocalDateAdapter())
|
||||
.add(UUIDAdapter())
|
||||
.add(ByteArrayAdapter())
|
||||
.add(URIAdapter())
|
||||
.add(KotlinJsonAdapterFactory())
|
||||
.add(BigDecimalAdapter())
|
||||
.add(BigIntegerAdapter())
|
||||
|
||||
@JvmStatic
|
||||
val moshi: Moshi by lazy {
|
||||
moshiBuilder.build()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import com.squareup.moshi.FromJson
|
||||
import com.squareup.moshi.ToJson
|
||||
import java.net.URI
|
||||
|
||||
class URIAdapter {
|
||||
@ToJson
|
||||
fun toJson(uri: URI): String = uri.toString()
|
||||
|
||||
@FromJson
|
||||
fun fromJson(s: String): URI = URI.create(s)
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import com.squareup.moshi.FromJson
|
||||
import com.squareup.moshi.ToJson
|
||||
import java.util.UUID
|
||||
|
||||
class UUIDAdapter {
|
||||
@ToJson
|
||||
fun toJson(uuid: UUID): String = uuid.toString()
|
||||
|
||||
@FromJson
|
||||
fun fromJson(s: String): UUID = UUID.fromString(s)
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"ArrayInDataClass",
|
||||
"EnumEntryName",
|
||||
"RemoveRedundantQualifierName",
|
||||
"UnusedImport"
|
||||
)
|
||||
|
||||
package org.openapitools.client.models
|
||||
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param propertySize
|
||||
* @param color
|
||||
*/
|
||||
|
||||
|
||||
data class ApiBird (
|
||||
|
||||
@Json(name = "size")
|
||||
val propertySize: kotlin.String? = null,
|
||||
|
||||
@Json(name = "color")
|
||||
val color: kotlin.String? = null
|
||||
|
||||
) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"ArrayInDataClass",
|
||||
"EnumEntryName",
|
||||
"RemoveRedundantQualifierName",
|
||||
"UnusedImport"
|
||||
)
|
||||
|
||||
package org.openapitools.client.models
|
||||
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param id
|
||||
* @param name
|
||||
*/
|
||||
|
||||
|
||||
data class ApiCategory (
|
||||
|
||||
@Json(name = "id")
|
||||
val id: kotlin.Long? = null,
|
||||
|
||||
@Json(name = "name")
|
||||
val name: kotlin.String? = null
|
||||
|
||||
) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"ArrayInDataClass",
|
||||
"EnumEntryName",
|
||||
"RemoveRedundantQualifierName",
|
||||
"UnusedImport"
|
||||
)
|
||||
|
||||
package org.openapitools.client.models
|
||||
|
||||
import org.openapitools.client.models.ApiStringEnumRef
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
||||
/**
|
||||
* to test the default value of properties
|
||||
*
|
||||
* @param arrayStringEnumRefDefault
|
||||
* @param arrayStringEnumDefault
|
||||
* @param arrayStringDefault
|
||||
* @param arrayIntegerDefault
|
||||
* @param arrayString
|
||||
* @param arrayStringNullable
|
||||
* @param arrayStringExtensionNullable
|
||||
* @param stringNullable
|
||||
*/
|
||||
|
||||
|
||||
data class ApiDefaultValue (
|
||||
|
||||
@Json(name = "array_string_enum_ref_default")
|
||||
val arrayStringEnumRefDefault: kotlin.collections.List<ApiStringEnumRef>? = null,
|
||||
|
||||
@Json(name = "array_string_enum_default")
|
||||
val arrayStringEnumDefault: kotlin.collections.List<ApiDefaultValue.ArrayStringEnumDefault>? = null,
|
||||
|
||||
@Json(name = "array_string_default")
|
||||
val arrayStringDefault: kotlin.collections.List<kotlin.String>? = arrayListOf("failure","skipped"),
|
||||
|
||||
@Json(name = "array_integer_default")
|
||||
val arrayIntegerDefault: kotlin.collections.List<kotlin.Int>? = arrayListOf(1,3),
|
||||
|
||||
@Json(name = "array_string")
|
||||
val arrayString: kotlin.collections.List<kotlin.String>? = null,
|
||||
|
||||
@Json(name = "array_string_nullable")
|
||||
val arrayStringNullable: kotlin.collections.List<kotlin.String>? = null,
|
||||
|
||||
@Json(name = "array_string_extension_nullable")
|
||||
val arrayStringExtensionNullable: kotlin.collections.List<kotlin.String>? = null,
|
||||
|
||||
@Json(name = "string_nullable")
|
||||
val stringNullable: kotlin.String? = null
|
||||
|
||||
) {
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Values: success,failure,unclassified
|
||||
*/
|
||||
@JsonClass(generateAdapter = false)
|
||||
enum class ArrayStringEnumDefault(val value: kotlin.String) {
|
||||
@Json(name = "success") success("success"),
|
||||
@Json(name = "failure") failure("failure"),
|
||||
@Json(name = "unclassified") unclassified("unclassified");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"ArrayInDataClass",
|
||||
"EnumEntryName",
|
||||
"RemoveRedundantQualifierName",
|
||||
"UnusedImport"
|
||||
)
|
||||
|
||||
package org.openapitools.client.models
|
||||
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param number
|
||||
* @param float
|
||||
* @param double
|
||||
*/
|
||||
|
||||
|
||||
data class ApiNumberPropertiesOnly (
|
||||
|
||||
@Json(name = "number")
|
||||
val number: java.math.BigDecimal? = null,
|
||||
|
||||
@Json(name = "float")
|
||||
val float: kotlin.Float? = null,
|
||||
|
||||
@Json(name = "double")
|
||||
val double: kotlin.Double? = null
|
||||
|
||||
) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
/**
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"ArrayInDataClass",
|
||||
"EnumEntryName",
|
||||
"RemoveRedundantQualifierName",
|
||||
"UnusedImport"
|
||||
)
|
||||
|
||||
package org.openapitools.client.models
|
||||
|
||||
import org.openapitools.client.models.ApiCategory
|
||||
import org.openapitools.client.models.ApiTag
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
* @param photoUrls
|
||||
* @param id
|
||||
* @param category
|
||||
* @param tags
|
||||
* @param status pet status in the store
|
||||
*/
|
||||
|
||||
|
||||
data class ApiPet (
|
||||
|
||||
@Json(name = "name")
|
||||
val name: kotlin.String,
|
||||
|
||||
@Json(name = "photoUrls")
|
||||
val photoUrls: kotlin.collections.List<kotlin.String>,
|
||||
|
||||
@Json(name = "id")
|
||||
val id: kotlin.Long? = null,
|
||||
|
||||
@Json(name = "category")
|
||||
val category: ApiCategory? = null,
|
||||
|
||||
@Json(name = "tags")
|
||||
val tags: kotlin.collections.List<ApiTag>? = null,
|
||||
|
||||
/* pet status in the store */
|
||||
@Json(name = "status")
|
||||
val status: ApiPet.Status? = null
|
||||
|
||||
) {
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
*
|
||||
* Values: available,pending,sold
|
||||
*/
|
||||
@JsonClass(generateAdapter = false)
|
||||
enum class Status(val value: kotlin.String) {
|
||||
@Json(name = "available") available("available"),
|
||||
@Json(name = "pending") pending("pending"),
|
||||
@Json(name = "sold") sold("sold");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"ArrayInDataClass",
|
||||
"EnumEntryName",
|
||||
"RemoveRedundantQualifierName",
|
||||
"UnusedImport"
|
||||
)
|
||||
|
||||
package org.openapitools.client.models
|
||||
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param id Query
|
||||
* @param outcomes
|
||||
*/
|
||||
|
||||
|
||||
data class ApiQuery (
|
||||
|
||||
/* Query */
|
||||
@Json(name = "id")
|
||||
val id: kotlin.Long? = null,
|
||||
|
||||
@Json(name = "outcomes")
|
||||
val outcomes: kotlin.collections.List<ApiQuery.Outcomes>? = null
|
||||
|
||||
) {
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Values: SUCCESS,FAILURE,SKIPPED
|
||||
*/
|
||||
@JsonClass(generateAdapter = false)
|
||||
enum class Outcomes(val value: kotlin.String) {
|
||||
@Json(name = "SUCCESS") SUCCESS("SUCCESS"),
|
||||
@Json(name = "FAILURE") FAILURE("FAILURE"),
|
||||
@Json(name = "SKIPPED") SKIPPED("SKIPPED");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"ArrayInDataClass",
|
||||
"EnumEntryName",
|
||||
"RemoveRedundantQualifierName",
|
||||
"UnusedImport"
|
||||
)
|
||||
|
||||
package org.openapitools.client.models
|
||||
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Values: success,failure,unclassified
|
||||
*/
|
||||
|
||||
@JsonClass(generateAdapter = false)
|
||||
enum class ApiStringEnumRef(val value: kotlin.String) {
|
||||
|
||||
@Json(name = "success")
|
||||
success("success"),
|
||||
|
||||
@Json(name = "failure")
|
||||
failure("failure"),
|
||||
|
||||
@Json(name = "unclassified")
|
||||
unclassified("unclassified");
|
||||
|
||||
/**
|
||||
* Override [toString()] to avoid using the enum variable name as the value, and instead use
|
||||
* the actual value defined in the API spec file.
|
||||
*
|
||||
* This solves a problem when the variable name and its value are different, and ensures that
|
||||
* the client sends the correct enum values to the server always.
|
||||
*/
|
||||
override fun toString(): kotlin.String = value
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* Converts the provided [data] to a [String] on success, null otherwise.
|
||||
*/
|
||||
fun encode(data: kotlin.Any?): kotlin.String? = if (data is ApiStringEnumRef) "$data" else null
|
||||
|
||||
/**
|
||||
* Returns a valid [ApiStringEnumRef] for [data], null otherwise.
|
||||
*/
|
||||
fun decode(data: kotlin.Any?): ApiStringEnumRef? = data?.let {
|
||||
val normalizedData = "$it".lowercase()
|
||||
values().firstOrNull { value ->
|
||||
it == value || normalizedData == "$value".lowercase()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"ArrayInDataClass",
|
||||
"EnumEntryName",
|
||||
"RemoveRedundantQualifierName",
|
||||
"UnusedImport"
|
||||
)
|
||||
|
||||
package org.openapitools.client.models
|
||||
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param id
|
||||
* @param name
|
||||
*/
|
||||
|
||||
|
||||
data class ApiTag (
|
||||
|
||||
@Json(name = "id")
|
||||
val id: kotlin.Long? = null,
|
||||
|
||||
@Json(name = "name")
|
||||
val name: kotlin.String? = null
|
||||
|
||||
) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"ArrayInDataClass",
|
||||
"EnumEntryName",
|
||||
"RemoveRedundantQualifierName",
|
||||
"UnusedImport"
|
||||
)
|
||||
|
||||
package org.openapitools.client.models
|
||||
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param propertyValues
|
||||
*/
|
||||
|
||||
|
||||
data class ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter (
|
||||
|
||||
@Json(name = "values")
|
||||
val propertyValues: kotlin.collections.List<kotlin.String>? = null
|
||||
|
||||
) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
package org.openapitools.client
|
||||
|
||||
import io.kotlintest.matchers.string.shouldContain
|
||||
import io.kotlintest.specs.ShouldSpec
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.openapitools.client.apis.BodyApi
|
||||
import java.io.File
|
||||
import java.io.FileWriter
|
||||
|
||||
class CustomTests : ShouldSpec({
|
||||
val bodyApi = BodyApi()
|
||||
|
||||
should("send a single file as null") {
|
||||
val result = bodyApi.testBodyMultipartFormdataSingleBinary(null)
|
||||
val parsedResult = EchoServerResponseParser(result)
|
||||
|
||||
parsedResult.body shouldContain """
|
||||
Content-Disposition: form-data; name="my-file"
|
||||
Content-Length: 0
|
||||
""".trimIndent()
|
||||
}
|
||||
|
||||
should("send a single file") {
|
||||
val result = bodyApi.testBodyMultipartFormdataSingleBinary(createTestFile())
|
||||
val parsedResult = EchoServerResponseParser(result)
|
||||
|
||||
parsedResult.body shouldContain """
|
||||
Content-Disposition: form-data; name="my-file"; filename="test.txt"
|
||||
Content-Type: text/plain
|
||||
Content-Length: 12
|
||||
|
||||
testing only
|
||||
""".trimIndent()
|
||||
}
|
||||
|
||||
should("send several files") {
|
||||
val result = bodyApi.testBodyMultipartFormdataArrayOfBinary(listOf(createTestFile(), createOtherTestFile()))
|
||||
val parsedResult = EchoServerResponseParser(result)
|
||||
|
||||
parsedResult.body shouldContain """
|
||||
Content-Disposition: form-data; name="files"; filename="test.txt"
|
||||
Content-Type: text/plain
|
||||
Content-Length: 12
|
||||
|
||||
testing only
|
||||
""".trimIndent()
|
||||
|
||||
parsedResult.body shouldContain """
|
||||
Content-Disposition: form-data; name="files"; filename="otherTestFile.txt"
|
||||
Content-Type: text/plain
|
||||
Content-Length: 17
|
||||
|
||||
Another test file
|
||||
""".trimIndent()
|
||||
}
|
||||
})
|
||||
|
||||
private fun createTestFile(): File {
|
||||
val myFile = File("test.txt")
|
||||
if (!myFile.exists()) {
|
||||
Assertions.assertTrue(myFile.createNewFile())
|
||||
}
|
||||
val fw = FileWriter(myFile)
|
||||
fw.write("testing only")
|
||||
fw.close()
|
||||
myFile.deleteOnExit()
|
||||
return myFile
|
||||
}
|
||||
|
||||
private fun createOtherTestFile(): File {
|
||||
val myFile = File("otherTestFile.txt")
|
||||
if (!myFile.exists()) {
|
||||
Assertions.assertTrue(myFile.createNewFile())
|
||||
}
|
||||
val fw = FileWriter(myFile)
|
||||
fw.write("Another test file")
|
||||
fw.close()
|
||||
myFile.deleteOnExit()
|
||||
return myFile
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package org.openapitools.client
|
||||
|
||||
class EchoServerResponseParser(response: String) {
|
||||
lateinit var method: String
|
||||
lateinit var path: String
|
||||
lateinit var protocol: String
|
||||
val headers = hashMapOf<String, String>()
|
||||
val body: String
|
||||
|
||||
init {
|
||||
require(response.isNotEmpty()) { "Echo server response cannot be null" }
|
||||
|
||||
val lines = response.lineSequence().iterator()
|
||||
var firstLine = true
|
||||
var bodyStart = false
|
||||
val bodyBuilder = StringBuilder()
|
||||
for (line in lines) {
|
||||
if (firstLine) {
|
||||
val items = line.split(" ")
|
||||
method = items[0]
|
||||
path = items[1]
|
||||
protocol = items[2]
|
||||
firstLine = false
|
||||
continue
|
||||
}
|
||||
if (bodyStart) {
|
||||
bodyBuilder.append(line)
|
||||
bodyBuilder.append("\n")
|
||||
}
|
||||
if (line.isEmpty()) {
|
||||
bodyStart = true
|
||||
continue
|
||||
}
|
||||
|
||||
val keyValue = line.split(": ")
|
||||
if (keyValue.size == 2) {
|
||||
headers[keyValue[0]] = keyValue[1]
|
||||
}
|
||||
}
|
||||
body = bodyBuilder.toString().trimEnd()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"ArrayInDataClass",
|
||||
"EnumEntryName",
|
||||
"RemoveRedundantQualifierName",
|
||||
"UnusedImport"
|
||||
)
|
||||
|
||||
package org.openapitools.client.apis
|
||||
|
||||
import io.kotlintest.shouldBe
|
||||
import io.kotlintest.specs.ShouldSpec
|
||||
|
||||
import org.openapitools.client.apis.AuthApi
|
||||
|
||||
class AuthApiTest : ShouldSpec() {
|
||||
init {
|
||||
// uncomment below to create an instance of AuthApi
|
||||
//val apiInstance = AuthApi()
|
||||
|
||||
// to test testAuthHttpBasic
|
||||
should("test testAuthHttpBasic") {
|
||||
// uncomment below to test testAuthHttpBasic
|
||||
//val result : kotlin.String = apiInstance.testAuthHttpBasic()
|
||||
//result shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test testAuthHttpBearer
|
||||
should("test testAuthHttpBearer") {
|
||||
// uncomment below to test testAuthHttpBearer
|
||||
//val result : kotlin.String = apiInstance.testAuthHttpBearer()
|
||||
//result shouldBe ("TODO")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
/**
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"ArrayInDataClass",
|
||||
"EnumEntryName",
|
||||
"RemoveRedundantQualifierName",
|
||||
"UnusedImport"
|
||||
)
|
||||
|
||||
package org.openapitools.client.apis
|
||||
|
||||
import io.kotlintest.shouldBe
|
||||
import io.kotlintest.specs.ShouldSpec
|
||||
|
||||
import org.openapitools.client.apis.BodyApi
|
||||
import org.openapitools.client.models.ApiPet
|
||||
import org.openapitools.client.models.ApiTag
|
||||
|
||||
class BodyApiTest : ShouldSpec() {
|
||||
init {
|
||||
// uncomment below to create an instance of BodyApi
|
||||
//val apiInstance = BodyApi()
|
||||
|
||||
// to test testBinaryGif
|
||||
should("test testBinaryGif") {
|
||||
// uncomment below to test testBinaryGif
|
||||
//val result : java.io.File = apiInstance.testBinaryGif()
|
||||
//result shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test testBodyApplicationOctetstreamBinary
|
||||
should("test testBodyApplicationOctetstreamBinary") {
|
||||
// uncomment below to test testBodyApplicationOctetstreamBinary
|
||||
//val body : java.io.File = BINARY_DATA_HERE // java.io.File |
|
||||
//val result : kotlin.String = apiInstance.testBodyApplicationOctetstreamBinary(body)
|
||||
//result shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test testBodyMultipartFormdataArrayOfBinary
|
||||
should("test testBodyMultipartFormdataArrayOfBinary") {
|
||||
// uncomment below to test testBodyMultipartFormdataArrayOfBinary
|
||||
//val files : kotlin.collections.List<java.io.File> = /path/to/file.txt // kotlin.collections.List<java.io.File> |
|
||||
//val result : kotlin.String = apiInstance.testBodyMultipartFormdataArrayOfBinary(files)
|
||||
//result shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test testBodyMultipartFormdataSingleBinary
|
||||
should("test testBodyMultipartFormdataSingleBinary") {
|
||||
// uncomment below to test testBodyMultipartFormdataSingleBinary
|
||||
//val myFile : java.io.File = BINARY_DATA_HERE // java.io.File |
|
||||
//val result : kotlin.String = apiInstance.testBodyMultipartFormdataSingleBinary(myFile)
|
||||
//result shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test testEchoBodyFreeFormObjectResponseString
|
||||
should("test testEchoBodyFreeFormObjectResponseString") {
|
||||
// uncomment below to test testEchoBodyFreeFormObjectResponseString
|
||||
//val body : kotlin.Any = Object // kotlin.Any | Free form object
|
||||
//val result : kotlin.String = apiInstance.testEchoBodyFreeFormObjectResponseString(body)
|
||||
//result shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test testEchoBodyPet
|
||||
should("test testEchoBodyPet") {
|
||||
// uncomment below to test testEchoBodyPet
|
||||
//val apiPet : ApiPet = // ApiPet | Pet object that needs to be added to the store
|
||||
//val result : ApiPet = apiInstance.testEchoBodyPet(apiPet)
|
||||
//result shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test testEchoBodyPetResponseString
|
||||
should("test testEchoBodyPetResponseString") {
|
||||
// uncomment below to test testEchoBodyPetResponseString
|
||||
//val apiPet : ApiPet = // ApiPet | Pet object that needs to be added to the store
|
||||
//val result : kotlin.String = apiInstance.testEchoBodyPetResponseString(apiPet)
|
||||
//result shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test testEchoBodyTagResponseString
|
||||
should("test testEchoBodyTagResponseString") {
|
||||
// uncomment below to test testEchoBodyTagResponseString
|
||||
//val apiTag : ApiTag = // ApiTag | Tag object
|
||||
//val result : kotlin.String = apiInstance.testEchoBodyTagResponseString(apiTag)
|
||||
//result shouldBe ("TODO")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"ArrayInDataClass",
|
||||
"EnumEntryName",
|
||||
"RemoveRedundantQualifierName",
|
||||
"UnusedImport"
|
||||
)
|
||||
|
||||
package org.openapitools.client.apis
|
||||
|
||||
import io.kotlintest.shouldBe
|
||||
import io.kotlintest.specs.ShouldSpec
|
||||
|
||||
import org.openapitools.client.apis.FormApi
|
||||
|
||||
class FormApiTest : ShouldSpec() {
|
||||
init {
|
||||
// uncomment below to create an instance of FormApi
|
||||
//val apiInstance = FormApi()
|
||||
|
||||
// to test testFormIntegerBooleanString
|
||||
should("test testFormIntegerBooleanString") {
|
||||
// uncomment below to test testFormIntegerBooleanString
|
||||
//val integerForm : kotlin.Int = 56 // kotlin.Int |
|
||||
//val booleanForm : kotlin.Boolean = true // kotlin.Boolean |
|
||||
//val stringForm : kotlin.String = stringForm_example // kotlin.String |
|
||||
//val result : kotlin.String = apiInstance.testFormIntegerBooleanString(integerForm, booleanForm, stringForm)
|
||||
//result shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test testFormOneof
|
||||
should("test testFormOneof") {
|
||||
// uncomment below to test testFormOneof
|
||||
//val form1 : kotlin.String = form1_example // kotlin.String |
|
||||
//val form2 : kotlin.Int = 56 // kotlin.Int |
|
||||
//val form3 : kotlin.String = form3_example // kotlin.String |
|
||||
//val form4 : kotlin.Boolean = true // kotlin.Boolean |
|
||||
//val id : kotlin.Long = 789 // kotlin.Long |
|
||||
//val name : kotlin.String = name_example // kotlin.String |
|
||||
//val result : kotlin.String = apiInstance.testFormOneof(form1, form2, form3, form4, id, name)
|
||||
//result shouldBe ("TODO")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"ArrayInDataClass",
|
||||
"EnumEntryName",
|
||||
"RemoveRedundantQualifierName",
|
||||
"UnusedImport"
|
||||
)
|
||||
|
||||
package org.openapitools.client.apis
|
||||
|
||||
import io.kotlintest.shouldBe
|
||||
import io.kotlintest.specs.ShouldSpec
|
||||
|
||||
import org.openapitools.client.apis.HeaderApi
|
||||
import org.openapitools.client.models.ApiStringEnumRef
|
||||
|
||||
class HeaderApiTest : ShouldSpec() {
|
||||
init {
|
||||
// uncomment below to create an instance of HeaderApi
|
||||
//val apiInstance = HeaderApi()
|
||||
|
||||
// to test testHeaderIntegerBooleanStringEnums
|
||||
should("test testHeaderIntegerBooleanStringEnums") {
|
||||
// uncomment below to test testHeaderIntegerBooleanStringEnums
|
||||
//val integerHeader : kotlin.Int = 56 // kotlin.Int |
|
||||
//val booleanHeader : kotlin.Boolean = true // kotlin.Boolean |
|
||||
//val stringHeader : kotlin.String = stringHeader_example // kotlin.String |
|
||||
//val enumNonrefStringHeader : kotlin.String = enumNonrefStringHeader_example // kotlin.String |
|
||||
//val enumRefStringHeader : ApiStringEnumRef = // ApiStringEnumRef |
|
||||
//val result : kotlin.String = apiInstance.testHeaderIntegerBooleanStringEnums(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader)
|
||||
//result shouldBe ("TODO")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"ArrayInDataClass",
|
||||
"EnumEntryName",
|
||||
"RemoveRedundantQualifierName",
|
||||
"UnusedImport"
|
||||
)
|
||||
|
||||
package org.openapitools.client.apis
|
||||
|
||||
import io.kotlintest.shouldBe
|
||||
import io.kotlintest.specs.ShouldSpec
|
||||
|
||||
import org.openapitools.client.apis.PathApi
|
||||
import org.openapitools.client.models.ApiStringEnumRef
|
||||
|
||||
class PathApiTest : ShouldSpec() {
|
||||
init {
|
||||
// uncomment below to create an instance of PathApi
|
||||
//val apiInstance = PathApi()
|
||||
|
||||
// to test testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath
|
||||
should("test testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath") {
|
||||
// uncomment below to test testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath
|
||||
//val pathString : kotlin.String = pathString_example // kotlin.String |
|
||||
//val pathInteger : kotlin.Int = 56 // kotlin.Int |
|
||||
//val enumNonrefStringPath : kotlin.String = enumNonrefStringPath_example // kotlin.String |
|
||||
//val enumRefStringPath : ApiStringEnumRef = // ApiStringEnumRef |
|
||||
//val result : kotlin.String = apiInstance.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath)
|
||||
//result shouldBe ("TODO")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/**
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"ArrayInDataClass",
|
||||
"EnumEntryName",
|
||||
"RemoveRedundantQualifierName",
|
||||
"UnusedImport"
|
||||
)
|
||||
|
||||
package org.openapitools.client.apis
|
||||
|
||||
import io.kotlintest.shouldBe
|
||||
import io.kotlintest.specs.ShouldSpec
|
||||
|
||||
import org.openapitools.client.apis.QueryApi
|
||||
import org.openapitools.client.models.ApiPet
|
||||
import org.openapitools.client.models.ApiStringEnumRef
|
||||
import org.openapitools.client.models.ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||
|
||||
class QueryApiTest : ShouldSpec() {
|
||||
init {
|
||||
// uncomment below to create an instance of QueryApi
|
||||
//val apiInstance = QueryApi()
|
||||
|
||||
// to test testEnumRefString
|
||||
should("test testEnumRefString") {
|
||||
// uncomment below to test testEnumRefString
|
||||
//val enumNonrefStringQuery : kotlin.String = enumNonrefStringQuery_example // kotlin.String |
|
||||
//val enumRefStringQuery : ApiStringEnumRef = // ApiStringEnumRef |
|
||||
//val result : kotlin.String = apiInstance.testEnumRefString(enumNonrefStringQuery, enumRefStringQuery)
|
||||
//result shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test testQueryDatetimeDateString
|
||||
should("test testQueryDatetimeDateString") {
|
||||
// uncomment below to test testQueryDatetimeDateString
|
||||
//val datetimeQuery : java.time.OffsetDateTime = 2013-10-20T19:20:30+01:00 // java.time.OffsetDateTime |
|
||||
//val dateQuery : java.time.LocalDate = 2013-10-20 // java.time.LocalDate |
|
||||
//val stringQuery : kotlin.String = stringQuery_example // kotlin.String |
|
||||
//val result : kotlin.String = apiInstance.testQueryDatetimeDateString(datetimeQuery, dateQuery, stringQuery)
|
||||
//result shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test testQueryIntegerBooleanString
|
||||
should("test testQueryIntegerBooleanString") {
|
||||
// uncomment below to test testQueryIntegerBooleanString
|
||||
//val integerQuery : kotlin.Int = 56 // kotlin.Int |
|
||||
//val booleanQuery : kotlin.Boolean = true // kotlin.Boolean |
|
||||
//val stringQuery : kotlin.String = stringQuery_example // kotlin.String |
|
||||
//val result : kotlin.String = apiInstance.testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery)
|
||||
//result shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test testQueryStyleDeepObjectExplodeTrueObject
|
||||
should("test testQueryStyleDeepObjectExplodeTrueObject") {
|
||||
// uncomment below to test testQueryStyleDeepObjectExplodeTrueObject
|
||||
//val queryObject : ApiPet = // ApiPet |
|
||||
//val result : kotlin.String = apiInstance.testQueryStyleDeepObjectExplodeTrueObject(queryObject)
|
||||
//result shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test testQueryStyleFormExplodeTrueArrayString
|
||||
should("test testQueryStyleFormExplodeTrueArrayString") {
|
||||
// uncomment below to test testQueryStyleFormExplodeTrueArrayString
|
||||
//val queryObject : ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter = // ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter |
|
||||
//val result : kotlin.String = apiInstance.testQueryStyleFormExplodeTrueArrayString(queryObject)
|
||||
//result shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test testQueryStyleFormExplodeTrueObject
|
||||
should("test testQueryStyleFormExplodeTrueObject") {
|
||||
// uncomment below to test testQueryStyleFormExplodeTrueObject
|
||||
//val queryObject : ApiPet = // ApiPet |
|
||||
//val result : kotlin.String = apiInstance.testQueryStyleFormExplodeTrueObject(queryObject)
|
||||
//result shouldBe ("TODO")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"ArrayInDataClass",
|
||||
"EnumEntryName",
|
||||
"RemoveRedundantQualifierName",
|
||||
"UnusedImport"
|
||||
)
|
||||
|
||||
package org.openapitools.client.models
|
||||
|
||||
import io.kotlintest.shouldBe
|
||||
import io.kotlintest.specs.ShouldSpec
|
||||
|
||||
import org.openapitools.client.models.ApiBird
|
||||
|
||||
class ApiBirdTest : ShouldSpec() {
|
||||
init {
|
||||
// uncomment below to create an instance of ApiBird
|
||||
//val modelInstance = ApiBird()
|
||||
|
||||
// to test the property `propertySize`
|
||||
should("test propertySize") {
|
||||
// uncomment below to test the property
|
||||
//modelInstance.propertySize shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test the property `color`
|
||||
should("test color") {
|
||||
// uncomment below to test the property
|
||||
//modelInstance.color shouldBe ("TODO")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"ArrayInDataClass",
|
||||
"EnumEntryName",
|
||||
"RemoveRedundantQualifierName",
|
||||
"UnusedImport"
|
||||
)
|
||||
|
||||
package org.openapitools.client.models
|
||||
|
||||
import io.kotlintest.shouldBe
|
||||
import io.kotlintest.specs.ShouldSpec
|
||||
|
||||
import org.openapitools.client.models.ApiCategory
|
||||
|
||||
class ApiCategoryTest : ShouldSpec() {
|
||||
init {
|
||||
// uncomment below to create an instance of ApiCategory
|
||||
//val modelInstance = ApiCategory()
|
||||
|
||||
// to test the property `id`
|
||||
should("test id") {
|
||||
// uncomment below to test the property
|
||||
//modelInstance.id shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test the property `name`
|
||||
should("test name") {
|
||||
// uncomment below to test the property
|
||||
//modelInstance.name shouldBe ("TODO")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"ArrayInDataClass",
|
||||
"EnumEntryName",
|
||||
"RemoveRedundantQualifierName",
|
||||
"UnusedImport"
|
||||
)
|
||||
|
||||
package org.openapitools.client.models
|
||||
|
||||
import io.kotlintest.shouldBe
|
||||
import io.kotlintest.specs.ShouldSpec
|
||||
|
||||
import org.openapitools.client.models.ApiDefaultValue
|
||||
import org.openapitools.client.models.ApiStringEnumRef
|
||||
|
||||
class ApiDefaultValueTest : ShouldSpec() {
|
||||
init {
|
||||
// uncomment below to create an instance of ApiDefaultValue
|
||||
//val modelInstance = ApiDefaultValue()
|
||||
|
||||
// to test the property `arrayStringEnumRefDefault`
|
||||
should("test arrayStringEnumRefDefault") {
|
||||
// uncomment below to test the property
|
||||
//modelInstance.arrayStringEnumRefDefault shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test the property `arrayStringEnumDefault`
|
||||
should("test arrayStringEnumDefault") {
|
||||
// uncomment below to test the property
|
||||
//modelInstance.arrayStringEnumDefault shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test the property `arrayStringDefault`
|
||||
should("test arrayStringDefault") {
|
||||
// uncomment below to test the property
|
||||
//modelInstance.arrayStringDefault shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test the property `arrayIntegerDefault`
|
||||
should("test arrayIntegerDefault") {
|
||||
// uncomment below to test the property
|
||||
//modelInstance.arrayIntegerDefault shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test the property `arrayString`
|
||||
should("test arrayString") {
|
||||
// uncomment below to test the property
|
||||
//modelInstance.arrayString shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test the property `arrayStringNullable`
|
||||
should("test arrayStringNullable") {
|
||||
// uncomment below to test the property
|
||||
//modelInstance.arrayStringNullable shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test the property `arrayStringExtensionNullable`
|
||||
should("test arrayStringExtensionNullable") {
|
||||
// uncomment below to test the property
|
||||
//modelInstance.arrayStringExtensionNullable shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test the property `stringNullable`
|
||||
should("test stringNullable") {
|
||||
// uncomment below to test the property
|
||||
//modelInstance.stringNullable shouldBe ("TODO")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"ArrayInDataClass",
|
||||
"EnumEntryName",
|
||||
"RemoveRedundantQualifierName",
|
||||
"UnusedImport"
|
||||
)
|
||||
|
||||
package org.openapitools.client.models
|
||||
|
||||
import io.kotlintest.shouldBe
|
||||
import io.kotlintest.specs.ShouldSpec
|
||||
|
||||
import org.openapitools.client.models.ApiNumberPropertiesOnly
|
||||
|
||||
class ApiNumberPropertiesOnlyTest : ShouldSpec() {
|
||||
init {
|
||||
// uncomment below to create an instance of ApiNumberPropertiesOnly
|
||||
//val modelInstance = ApiNumberPropertiesOnly()
|
||||
|
||||
// to test the property `number`
|
||||
should("test number") {
|
||||
// uncomment below to test the property
|
||||
//modelInstance.number shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test the property `float`
|
||||
should("test float") {
|
||||
// uncomment below to test the property
|
||||
//modelInstance.float shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test the property `double`
|
||||
should("test double") {
|
||||
// uncomment below to test the property
|
||||
//modelInstance.double shouldBe ("TODO")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"ArrayInDataClass",
|
||||
"EnumEntryName",
|
||||
"RemoveRedundantQualifierName",
|
||||
"UnusedImport"
|
||||
)
|
||||
|
||||
package org.openapitools.client.models
|
||||
|
||||
import io.kotlintest.shouldBe
|
||||
import io.kotlintest.specs.ShouldSpec
|
||||
|
||||
import org.openapitools.client.models.ApiPet
|
||||
import org.openapitools.client.models.ApiCategory
|
||||
import org.openapitools.client.models.ApiTag
|
||||
|
||||
class ApiPetTest : ShouldSpec() {
|
||||
init {
|
||||
// uncomment below to create an instance of ApiPet
|
||||
//val modelInstance = ApiPet()
|
||||
|
||||
// to test the property `name`
|
||||
should("test name") {
|
||||
// uncomment below to test the property
|
||||
//modelInstance.name shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test the property `photoUrls`
|
||||
should("test photoUrls") {
|
||||
// uncomment below to test the property
|
||||
//modelInstance.photoUrls shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test the property `id`
|
||||
should("test id") {
|
||||
// uncomment below to test the property
|
||||
//modelInstance.id shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test the property `category`
|
||||
should("test category") {
|
||||
// uncomment below to test the property
|
||||
//modelInstance.category shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test the property `tags`
|
||||
should("test tags") {
|
||||
// uncomment below to test the property
|
||||
//modelInstance.tags shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test the property `status` - pet status in the store
|
||||
should("test status") {
|
||||
// uncomment below to test the property
|
||||
//modelInstance.status shouldBe ("TODO")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"ArrayInDataClass",
|
||||
"EnumEntryName",
|
||||
"RemoveRedundantQualifierName",
|
||||
"UnusedImport"
|
||||
)
|
||||
|
||||
package org.openapitools.client.models
|
||||
|
||||
import io.kotlintest.shouldBe
|
||||
import io.kotlintest.specs.ShouldSpec
|
||||
|
||||
import org.openapitools.client.models.ApiQuery
|
||||
|
||||
class ApiQueryTest : ShouldSpec() {
|
||||
init {
|
||||
// uncomment below to create an instance of ApiQuery
|
||||
//val modelInstance = ApiQuery()
|
||||
|
||||
// to test the property `id` - Query
|
||||
should("test id") {
|
||||
// uncomment below to test the property
|
||||
//modelInstance.id shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test the property `outcomes`
|
||||
should("test outcomes") {
|
||||
// uncomment below to test the property
|
||||
//modelInstance.outcomes shouldBe ("TODO")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"ArrayInDataClass",
|
||||
"EnumEntryName",
|
||||
"RemoveRedundantQualifierName",
|
||||
"UnusedImport"
|
||||
)
|
||||
|
||||
package org.openapitools.client.models
|
||||
|
||||
import io.kotlintest.shouldBe
|
||||
import io.kotlintest.specs.ShouldSpec
|
||||
|
||||
import org.openapitools.client.models.ApiStringEnumRef
|
||||
|
||||
class ApiStringEnumRefTest : ShouldSpec() {
|
||||
init {
|
||||
// uncomment below to create an instance of ApiStringEnumRef
|
||||
//val modelInstance = ApiStringEnumRef()
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"ArrayInDataClass",
|
||||
"EnumEntryName",
|
||||
"RemoveRedundantQualifierName",
|
||||
"UnusedImport"
|
||||
)
|
||||
|
||||
package org.openapitools.client.models
|
||||
|
||||
import io.kotlintest.shouldBe
|
||||
import io.kotlintest.specs.ShouldSpec
|
||||
|
||||
import org.openapitools.client.models.ApiTag
|
||||
|
||||
class ApiTagTest : ShouldSpec() {
|
||||
init {
|
||||
// uncomment below to create an instance of ApiTag
|
||||
//val modelInstance = ApiTag()
|
||||
|
||||
// to test the property `id`
|
||||
should("test id") {
|
||||
// uncomment below to test the property
|
||||
//modelInstance.id shouldBe ("TODO")
|
||||
}
|
||||
|
||||
// to test the property `name`
|
||||
should("test name") {
|
||||
// uncomment below to test the property
|
||||
//modelInstance.name shouldBe ("TODO")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
*
|
||||
* Please note:
|
||||
* This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"ArrayInDataClass",
|
||||
"EnumEntryName",
|
||||
"RemoveRedundantQualifierName",
|
||||
"UnusedImport"
|
||||
)
|
||||
|
||||
package org.openapitools.client.models
|
||||
|
||||
import io.kotlintest.shouldBe
|
||||
import io.kotlintest.specs.ShouldSpec
|
||||
|
||||
import org.openapitools.client.models.ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||
|
||||
class ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTest : ShouldSpec() {
|
||||
init {
|
||||
// uncomment below to create an instance of ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||
//val modelInstance = ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter()
|
||||
|
||||
// to test the property `propertyValues`
|
||||
should("test propertyValues") {
|
||||
// uncomment below to test the property
|
||||
//modelInstance.propertyValues shouldBe ("TODO")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user