[kotlin][client] small improvements (#9640)

* [kotlin][client] standardize adapter type names

* [kotlin][client] remove unused class

* [kotlin][client] fix IDE warning

* [kotlin][client] improve import layout

* [kotlin][client] update sample projects
This commit is contained in:
Bruno Coelho
2021-06-02 04:07:26 +01:00
committed by GitHub
parent 9bce71656c
commit 0f51662650
68 changed files with 64 additions and 114 deletions

View File

@@ -20,7 +20,6 @@ src/main/kotlin/org/openapitools/client/apis/UserApi.kt
src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt
src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt
src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt
src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt
src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt
src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt
src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt

View File

@@ -1,7 +1,6 @@
package org.openapitools.client.infrastructure
import android.os.Build
import okhttp3.Credentials
import okhttp3.OkHttpClient
import okhttp3.RequestBody
import okhttp3.RequestBody.Companion.asRequestBody

View File

@@ -12,7 +12,7 @@ object Serializer {
.add(LocalDateAdapter())
.add(UUIDAdapter())
.add(ByteArrayAdapter())
.add(UriAdapter())
.add(URIAdapter())
.add(KotlinJsonAdapterFactory())
.add(BigDecimalAdapter())
.add(BigIntegerAdapter())

View File

@@ -4,10 +4,10 @@ import com.squareup.moshi.FromJson
import com.squareup.moshi.ToJson
import java.net.URI
class UriAdapter {
class URIAdapter {
@ToJson
fun toJson(uri: URI) = uri.toString()
@FromJson
fun fromJson(s: String) = URI.create(s)
fun fromJson(s: String): URI = URI.create(s)
}

View File

@@ -9,5 +9,5 @@ class UUIDAdapter {
fun toJson(uuid: UUID) = uuid.toString()
@FromJson
fun fromJson(s: String) = UUID.fromString(s)
fun fromJson(s: String): UUID = UUID.fromString(s)
}