forked from loafle/openapi-generator-original
[Kotlin][Client] replace java.nio.* to avoid crash on Android API 25 and bellow (#12529)
* [Kotlin][Client] replace java.nio.* to avoid crash on Android API 25 and bellow * [Kotlin][Client] update sample projects * [Kotlin][Client] update sample projects
This commit is contained in:
parent
45a3b15b69
commit
fe8187ba6d
@ -206,22 +206,26 @@ import com.squareup.moshi.adapter
|
||||
return null
|
||||
}
|
||||
if (T::class.java == File::class.java) {
|
||||
// return tempfile
|
||||
// return tempFile
|
||||
{{^supportAndroidApiLevel25AndBelow}}
|
||||
// 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.{{packageName}}", null).toFile()
|
||||
val tempFile = java.nio.file.Files.createTempFile("tmp.{{packageName}}", null).toFile()
|
||||
{{/supportAndroidApiLevel25AndBelow}}
|
||||
{{#supportAndroidApiLevel25AndBelow}}
|
||||
val f = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
val tempFile = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
java.nio.file.Files.createTempFile("tmp.net.medicineone.teleconsultationandroid.openapi.openapicommon", null).toFile()
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
createTempFile("tmp.net.medicineone.teleconsultationandroid.openapi.openapicommon", null)
|
||||
}
|
||||
{{/supportAndroidApiLevel25AndBelow}}
|
||||
f.deleteOnExit()
|
||||
body.byteStream().use { java.nio.file.Files.copy(it, f.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING) }
|
||||
return f as T
|
||||
tempFile.deleteOnExit()
|
||||
body.byteStream().use { inputStream ->
|
||||
tempFile.outputStream().use { tempFileOutputStream ->
|
||||
inputStream.copyTo(tempFileOutputStream)
|
||||
}
|
||||
}
|
||||
return tempFile as T
|
||||
}
|
||||
val bodyContent = body.string()
|
||||
if (bodyContent.isEmpty()) {
|
||||
|
@ -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()) {
|
||||
|
@ -118,12 +118,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()) {
|
||||
|
@ -118,12 +118,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()) {
|
||||
|
@ -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()) {
|
||||
|
@ -118,12 +118,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()) {
|
||||
|
@ -118,12 +118,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()) {
|
||||
|
@ -117,12 +117,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()) {
|
||||
|
@ -117,12 +117,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()) {
|
||||
|
@ -119,16 +119,20 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie
|
||||
return null
|
||||
}
|
||||
if (T::class.java == File::class.java) {
|
||||
// return tempfile
|
||||
val f = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
// return tempFile
|
||||
val tempFile = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
java.nio.file.Files.createTempFile("tmp.net.medicineone.teleconsultationandroid.openapi.openapicommon", null).toFile()
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
createTempFile("tmp.net.medicineone.teleconsultationandroid.openapi.openapicommon", null)
|
||||
}
|
||||
f.deleteOnExit()
|
||||
body.byteStream().use { java.nio.file.Files.copy(it, f.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING) }
|
||||
return f as T
|
||||
tempFile.deleteOnExit()
|
||||
body.byteStream().use { inputStream ->
|
||||
tempFile.outputStream().use { tempFileOutputStream ->
|
||||
inputStream.copyTo(tempFileOutputStream)
|
||||
}
|
||||
}
|
||||
return tempFile as T
|
||||
}
|
||||
val bodyContent = body.string()
|
||||
if (bodyContent.isEmpty()) {
|
||||
|
@ -120,12 +120,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()) {
|
||||
|
@ -118,12 +118,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()) {
|
||||
|
@ -118,12 +118,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()) {
|
||||
|
@ -118,12 +118,16 @@ internal open class ApiClient(val baseUrl: String, val client: OkHttpClient = de
|
||||
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()) {
|
||||
|
@ -118,12 +118,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()) {
|
||||
|
@ -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()) {
|
||||
|
@ -118,12 +118,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()) {
|
||||
|
@ -118,12 +118,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()) {
|
||||
|
@ -118,12 +118,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()) {
|
||||
|
@ -118,12 +118,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()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user