Merge remote-tracking branch 'origin/master' into 7.0.x

This commit is contained in:
William Cheng
2022-07-19 11:54:20 +08:00
2800 changed files with 126318 additions and 33030 deletions

View File

@@ -40,7 +40,7 @@ import org.openapitools.client.infrastructure.ResponseType
import org.openapitools.client.infrastructure.Success
import org.openapitools.client.infrastructure.toMultiValue
class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath) {
class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) {
companion object {
@JvmStatic
val defaultBasePath: String by lazy {

View File

@@ -116,12 +116,16 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie
return null
}
if (T::class.java == File::class.java) {
// return tempfile
// return tempFile
// Attention: if you are developing an android app that supports API Level 25 and bellow, please check flag supportAndroidApiLevel25AndBelow in https://openapi-generator.tech/docs/generators/kotlin#config-options
val f = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile()
f.deleteOnExit()
body.byteStream().use { java.nio.file.Files.copy(it, f.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING) }
return f as T
val tempFile = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile()
tempFile.deleteOnExit()
body.byteStream().use { inputStream ->
tempFile.outputStream().use { tempFileOutputStream ->
inputStream.copyTo(tempFileOutputStream)
}
}
return tempFile as T
}
val bodyContent = body.string()
if (bodyContent.isEmpty()) {