icerockdev / moko-network

Network components with codegeneration of rest api for mobile (android & ios) Kotlin Multiplatform development
https://moko.icerock.dev
Apache License 2.0
151 stars 29 forks source link

TokenFeature.TokenProvider should be a fun interface #162

Closed dalewking closed 1 year ago

dalewking commented 3 years ago

Providing a TokenFeature.TokenProvider requires creating on object like this:

object : TokenFeature.TokenProvider {
      override fun getToken() = "Bearer ${authentication.accessToken}"`
}

With the Kotlin 1.4 feature of functional interfaces, this interface should be declared as a fun interface allowing to provide a lambda so above code can be replaced with:

{ "Bearer ${authentication.accessToken}" }