Ktorfit

HTTP client generator / KSP plugin for Kotlin Multiplatform (Android, iOS, Js, Jvm, Native) using KSP and Ktor clients inspired by Retrofit https://foso.github.io/Ktorfit

APACHE-2.0 License

Stars
1.3K

Bot releases are visible (Hide)

Ktorfit - v1.0.0

Published by Foso over 1 year ago

v1.0.0 (02-03-2023)

This project is now following semver

NEW:

  • internal optimizations
  • throw compile error when generated class can not be found

🐛 Bugs fixed

  • Timeout throws exception outside of scope of SuspendResponseConverter #127
  • Fix broken/outdated docs link (#140) by @T-Spoon

⬆️ Deps updates

  • based on Ktor 2.2.4
Ktorfit - v1.0.0-beta18

Published by Foso over 1 year ago

NEW:

  • You can now disable the check if the baseUrl ends with a /
Ktorfit.Builder().baseUrl(testBaseUrl, checkUrl = false).build()

🐛 Bugs fixed

  • Fixed Ktorfit breaking incremental compilation #110

⬆️ Deps updates

  • based on Ktor 2.2.3
Ktorfit - v1.0.0-beta17

Published by Foso over 1 year ago

BREAKING CHANGE:

  • Ktorfit now needs an additional gradle plugin. This will solve serveral issues with multi-module projects.

Add this plugin:

plugins {
  id "de.jensklingenberg.ktorfit" version "1.0.0"
}

NEW

  • interfaces can now be internal

FIXED

  • Ktorfit multiple module support #92
  • Add support for 'internal' parameter type #13
  • Duplicate class KtorfitExtKt found in modules moduleA and moduleB #86
  • Android overload resolution ambiguity #64
  • Form data is double encoded #95

⬆️ Deps updates

  • based on Ktor 2.2.2
  • Kotlin 1.8.0
  • KSP 1.8.0-1.0.8
  • update Android TargetSdk to 33
Ktorfit - v1.0.0-beta16

Published by Foso almost 2 years ago

1.0.0-beta16 (13-11-2022)

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

What's Changed

Full Changelog: https://github.com/Foso/Ktorfit/compare/v1.0.0-beta15...v1.0.0-beta16

Ktorfit - v1.0.0-beta15

Published by Foso about 2 years ago

1.0.0-beta15 (05-10-2022)

⬆️ 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
Ktorfit - v1.0.0-beta14

Published by Foso about 2 years ago

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/

Full Changelog: https://github.com/Foso/Ktorfit/compare/v1.0.0-beta13...v1.0.0-beta14

Ktorfit - v1.0.0-beta13

Published by Foso about 2 years ago

1.0.0-beta13 (10-09-2022)

  • KtorfitCallResponseConverter and KtorfitSuspendCallResponseConverter are now combined in KtorfitCallResponseConverter
  • based on Ktor 2.1.1

Fixed:

  • Url annotation not resolved correctly #52

Full Changelog: https://github.com/Foso/Ktorfit/compare/v1.0.0-beta12...v1.0.0-beta13

Ktorfit - v1.0.0-beta12

Published by Foso about 2 years ago

1.0.0-beta12 (31-08-2022)

Breaking Changes:

wrapResponse from SuspendResponseConverter got renamed to wrapSuspendResponse. This add the possibility to have ResponseConverter and SuspendResponseConverter implemented in the same class.

Changes:

  • 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 kttorfit = ktorfit {
baseUrl("http://example.com/")
}.create<GithubService>()

or this

val kttorfit = 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/")

Commits

Full Changelog: https://github.com/Foso/Ktorfit/compare/v1.0.0-beta11...v1.0.0-beta12

Ktorfit - v1.0.0-beta11

Published by Foso about 2 years ago

What's Changed

  • you can now use ResponseConverter in combination with suspend functions. Implement the SuspendResponseConverter
  • KtorfitCallResponseConverter and FlowResponseConverter moved to de.jensklingenberg.ktorfit.converter.builtin

New Contributors

Full Changelog: https://github.com/Foso/Ktorfit/compare/v1.0.0-beta10...v1.0.0-beta11

Ktorfit - v1.0.0-beta10

Published by Foso about 2 years ago

What's Changed

  • based on Ktor 2.0.2
  • added windows target #26
  • annotations 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()

Breaking Changes:

@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" )

New Contributors

Thanks to @DATL4G, @hadiyarajesh, @DanielNovak for reporting bugs

Full Changelog: https://github.com/Foso/Ktorfit/compare/v1.0.0-beta08...v1.0.0-beta10

Ktorfit - v1.0.0-beta09

Published by Foso over 2 years ago

What's Changed

  • #15 fix encoding of query parameters

Full Changelog: https://github.com/Foso/Ktorfit/compare/v1.0.0-beta08...v1.0.0-beta09

Ktorfit - v1.0.0-beta08

Published by Foso over 2 years ago

fixed issue with Koin Annotations

Full Changelog: https://github.com/Foso/Ktorfit/compare/v1.0.0-beta07...v1.0.0-beta08

Ktorfit - v1.0.0-beta07

Published by Foso over 2 years ago

========================================

  • fix issue with FormUrlEncoded
  • based on Ktor 2.0.2
Ktorfit - v1.0.0-beta06

Published by Foso over 2 years ago

  • fix issue with KSP 1.0.5 #19
Ktorfit - v1.0.0-beta05

Published by Foso over 2 years ago

1.0.0-beta05

  • fixed: Custom Http Method with @Body is now possible #6
  • based on Ktor 2.0.1
  • cleanup example project @mattrob33
Ktorfit - v1.0.0-beta04

Published by Foso over 2 years ago

First beta version

Package Rankings
Top 22.37% on Repo1.maven.org
Badges
Extracted from project README
Maven PRs Welcome License Platforms GitHub stars GitHub forks Twitter Follow Maven Central Maven Central Maven Central Maven Central Maven Central Maven Central Maven Central Maven Central Maven Central Maven Central Maven Central Maven Central Maven Central