NEW:
-
Field parameters can now be nullable, null values will be ignored in requests
-
Add option to turn of error checking
ksp { arg("Ktorfit_Errors", "1") }
You can set it in your build.gradle.kts file,
0: Turn off all Ktorfit related error checking
1: Check for errors
2: Turn errors into warnings
-
Added RequestConverter support #84
⬆️ Deps updates
- based on Ktor 2.1.3
- Kotlin 1.7.21
- KSP 1.0.8
- update Android TargetSdk to 33
🐛 Bugs fixed
- FlowResponseConverter #81
⬆️ Deps updates
- based on Ktor 2.1.2
🐛 Bugs fixed
- kotlinx.coroutines.JobCancellationException: Parent job is Completed #70
💥 Breaking changes
- reverted the api of converters to the state of beta13, see #71
- when you are updating from beta13, this is the only change to converters: returnTypeName is replaced through typeData, you can use typeData.qualifiedName to get the same value as returnTypeName
NEW:
- Query parameters can now be nullable, null values will be ignored in requests
- Function return types can now be nullable
FIX:
- Url annotation not resolved correctly #65
BREAKING CHANGES:
-
Changed naming of Converters:
- SuspendResponseConverter:
- is now called RequestConverter
- the wrapSuspendResponse is now called convertRequest.
- returnTypeName is replaced through typeData, you can use typeData.qualifiedName to get the same value as returnTypeName RequestConverter need to be added with the requestConverter() on your Ktorfit object.
- https://foso.github.io/Ktorfit/requestconverter/
- ResponseConverters:
- returnTypeName is replaced through typeData, you can use typeData.qualifiedName to get the same value as returnTypeName https://foso.github.io/Ktorfit/responseconverter/
- SuspendResponseConverter:
- KtorfitCallResponseConverter and KtorfitSuspendCallResponseConverter are now combined in KtorfitCallResponseConverter
- based on Ktor 2.1.1
Fixed:
- Url annotation not resolved correctly #52
wrapResponse from SuspendResponseConverter got renamed to wrapSuspendResponse. This add the possibility to have ResponseConverter and SuspendResponseConverter implemented in the same class.
- throw compiler time error when you use @Path without the corresponding value inside the relative url path
- every generated implementation class of an interface that Ktorfit generates will now contain a "create" ext function that can be used instead of the generic create() function e.g. Let's say you have a interface GithubService, then you can create an instance like this:
val ktorfit = ktorfit {
baseUrl("http://example.com/")
}.create<GithubService>()
or this
val ktorfit = ktorfit {
baseUrl("http://example.com/")
}.createGithubService()
By default, IntelliJ/Android Studio can't find the generated code, you need to add the KSP generated folder to the sourcesets like this: (See more here: https://kotlinlang.org/docs/ksp-quickstart.html#make-ide-aware-of-generated-code)
kotlin.srcDir("build/generated/ksp/jvm/jvmMain/")
- you can now use ResponseConverter in combination with suspend functions. Implement the SuspendResponseConverter
- KtorfitCallResponseConverter and FlowResponseConverter moved to de.jensklingenberg.ktorfit.converter.builtin
- based on Ktor 2.0.2
- added windows target #26
- @PATCH, @POST, @PUT now have a default value #22
- Ktorfit now uses a builder pattern for setup e.g. change this:
Ktorfit("https://example.com/", HttpClient {})
to this:
Ktorfit.Builder()
.baseUrl("https://example.com/")
.httpClient(HttpClient {})
.build()
@Headers now requires a vararg of String instead of an Array e.g. you need to change from:
@Headers(
["Authorization: token ghp_abcdefgh",
"Content-Type: application/json"]
)
to this:
@Headers(
"Authorization: token ghp_abcdefgh",
"Content-Type: application/json"
)
- #15 fix encoding of query parameters
- fix issue with Koin Annotations
- fix issue with FormUrlEncoded
- based on Ktor 2.0.2
- fix issue with KSP 1.0.5 #19
- fixed: Custom Http Method with @Body is now possible #6
- based on Ktor 2.0.1
- cleanup example project @mattrob33
initial release