From 8777dcf3919f4a90d6b4645239bbe1e0e140c102 Mon Sep 17 00:00:00 2001 From: Jens Klingenberg Date: Sat, 3 Jun 2023 10:51:55 +0200 Subject: [PATCH] relase: 1.4.1 --- docs/CHANGELOG.md | 10 ++++++++++ example/AndroidOnlyExample/app/build.gradle.kts | 2 +- .../androidonlyexample/MainActivity.kt | 2 +- .../jensklingenberg/androidonlyexample/StarWarsApi.kt | 4 ++++ example/MultiplatformExample/shared/build.gradle.kts | 2 +- .../kotlin/com/example/ktorfittest/Greeting.kt | 11 ++++------- .../kotlin/com/example/ktorfittest/StarWarsApi.kt | 4 ++++ gradle/libs.versions.toml | 4 ++-- .../jensklingenberg/ktorfit/internal/KtorfitClient.kt | 4 ++-- 9 files changed, 29 insertions(+), 14 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index f8283e3d7..75874a5e0 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Added +### Changed +### Deprecated +### Removed +### Fixed +### Security + +1.4.1 - 2023-06-03 +======================================== + ### Added ### Changed diff --git a/example/AndroidOnlyExample/app/build.gradle.kts b/example/AndroidOnlyExample/app/build.gradle.kts index 3be326828..02fd30625 100644 --- a/example/AndroidOnlyExample/app/build.gradle.kts +++ b/example/AndroidOnlyExample/app/build.gradle.kts @@ -6,7 +6,7 @@ plugins { id ("de.jensklingenberg.ktorfit") version "1.0.0" } -val ktorfit = "1.4.0" +val ktorfit = "1.4.1" configure { version = ktorfit diff --git a/example/AndroidOnlyExample/app/src/main/java/de/jensklingenberg/androidonlyexample/MainActivity.kt b/example/AndroidOnlyExample/app/src/main/java/de/jensklingenberg/androidonlyexample/MainActivity.kt index c241400eb..8bbcdcbb0 100644 --- a/example/AndroidOnlyExample/app/src/main/java/de/jensklingenberg/androidonlyexample/MainActivity.kt +++ b/example/AndroidOnlyExample/app/src/main/java/de/jensklingenberg/androidonlyexample/MainActivity.kt @@ -22,7 +22,7 @@ import kotlinx.coroutines.launch import kotlinx.serialization.json.Json val ktorfit = ktorfit { - baseUrl("https://swapi.dev/api/") + baseUrl(StarWarsApi.baseUrl) httpClient(HttpClient { install(ContentNegotiation) { json(Json { isLenient = true; ignoreUnknownKeys = true }) diff --git a/example/AndroidOnlyExample/app/src/main/java/de/jensklingenberg/androidonlyexample/StarWarsApi.kt b/example/AndroidOnlyExample/app/src/main/java/de/jensklingenberg/androidonlyexample/StarWarsApi.kt index faa495e60..1ba0e3337 100644 --- a/example/AndroidOnlyExample/app/src/main/java/de/jensklingenberg/androidonlyexample/StarWarsApi.kt +++ b/example/AndroidOnlyExample/app/src/main/java/de/jensklingenberg/androidonlyexample/StarWarsApi.kt @@ -9,6 +9,10 @@ import kotlinx.coroutines.flow.Flow interface StarWarsApi { + companion object { + const val baseUrl = "https://swapi.dev/api/" + } + @GET("people/{id}/") suspend fun getPerson(@Path("id") personId: Int): Person diff --git a/example/MultiplatformExample/shared/build.gradle.kts b/example/MultiplatformExample/shared/build.gradle.kts index 15963263f..e31f5b3f0 100644 --- a/example/MultiplatformExample/shared/build.gradle.kts +++ b/example/MultiplatformExample/shared/build.gradle.kts @@ -9,7 +9,7 @@ plugins { version = "1.0" val ktorVersion = "2.3.1" -val ktorfitVersion = "1.4.0" +val ktorfitVersion = "1.4.1" configure { version = ktorfitVersion diff --git a/example/MultiplatformExample/shared/src/commonMain/kotlin/com/example/ktorfittest/Greeting.kt b/example/MultiplatformExample/shared/src/commonMain/kotlin/com/example/ktorfittest/Greeting.kt index 0f351aaa9..c8259b757 100644 --- a/example/MultiplatformExample/shared/src/commonMain/kotlin/com/example/ktorfittest/Greeting.kt +++ b/example/MultiplatformExample/shared/src/commonMain/kotlin/com/example/ktorfittest/Greeting.kt @@ -1,20 +1,17 @@ package com.example.ktorfittest import de.jensklingenberg.ktorfit.converter.builtin.CallConverterFactory -import de.jensklingenberg.ktorfit.converter.builtin.CallResponseConverter import de.jensklingenberg.ktorfit.converter.builtin.FlowConverterFactory -import de.jensklingenberg.ktorfit.converter.builtin.FlowResponseConverter -import de.jensklingenberg.ktorfit.create import de.jensklingenberg.ktorfit.ktorfit -import io.ktor.client.* -import io.ktor.client.plugins.contentnegotiation.* -import io.ktor.serialization.kotlinx.json.* +import io.ktor.client.HttpClient +import io.ktor.client.plugins.contentnegotiation.ContentNegotiation +import io.ktor.serialization.kotlinx.json.json import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch import kotlinx.serialization.json.Json val ktorfit = ktorfit { - baseUrl("https://swapi.dev/api/") + baseUrl(StarWarsApi.baseUrl) httpClient(HttpClient { install(ContentNegotiation) { json(Json { isLenient = true; ignoreUnknownKeys = true }) diff --git a/example/MultiplatformExample/shared/src/commonMain/kotlin/com/example/ktorfittest/StarWarsApi.kt b/example/MultiplatformExample/shared/src/commonMain/kotlin/com/example/ktorfittest/StarWarsApi.kt index 9e141a5d7..69e0875f6 100644 --- a/example/MultiplatformExample/shared/src/commonMain/kotlin/com/example/ktorfittest/StarWarsApi.kt +++ b/example/MultiplatformExample/shared/src/commonMain/kotlin/com/example/ktorfittest/StarWarsApi.kt @@ -8,6 +8,10 @@ import de.jensklingenberg.ktorfit.http.Query import kotlinx.coroutines.flow.Flow interface StarWarsApi { + companion object { + const val baseUrl = "https://swapi.dev/api/" + } + @GET("people/{id}/") suspend fun getPersonByIdResponse(@Path("id") peopleId: Int): Person diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1cf62dfce..e9af109c8 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,8 +6,8 @@ kctfork = "0.2.1" kotlin = "1.8.21" kotlinPoet = "1.14.2" kspVersion = "1.8.21-1.0.11" -ktorfit = "1.4.0" -ktorfit-lib = "1.4.0" +ktorfit = "1.4.1" +ktorfit-lib = "1.4.1" ktorVersion = "2.3.1" dokkaVersion = "1.8.10" gradleMavenPublishPlugin = "0.24.0" diff --git a/ktorfit-lib-common/src/commonMain/kotlin/de/jensklingenberg/ktorfit/internal/KtorfitClient.kt b/ktorfit-lib-common/src/commonMain/kotlin/de/jensklingenberg/ktorfit/internal/KtorfitClient.kt index 3693f4996..ad8fcd156 100644 --- a/ktorfit-lib-common/src/commonMain/kotlin/de/jensklingenberg/ktorfit/internal/KtorfitClient.kt +++ b/ktorfit-lib-common/src/commonMain/kotlin/de/jensklingenberg/ktorfit/internal/KtorfitClient.kt @@ -94,12 +94,12 @@ internal class KtorfitClient(private val ktorfit: Ktorfit) : Client { */ handleDeprecatedSuspendResponseConverters(requestData)?.let { return it - } ?: DefaultSuspendResponseConverterFactory().suspendResponseConverter(returnTypeData, ktorfit)?.let { + } ?: DefaultSuspendResponseConverterFactory().suspendResponseConverter(returnTypeData, ktorfit).let { val response = httpClient.request { requestBuilder(requestData) } return it.convert(response) as ReturnType? - } ?: throw IllegalStateException("No SuspendResponseConverter found for " + returnTypeData.qualifiedName) + } } catch (exception: Exception) { val typeIsNullable = returnTypeData.isNullable