Comments (5)
If you pass classes as parameters, you could define reified inline extension functions afterwards, like so:
import kotlin.reflect.KClass
interface ApiClient {
fun <T: Any> get(clazz: KClass<T>): T
}
inline fun <reified T: Any> ApiClient.get(): T = get(T::class)
from jellyfin-sdk-kotlin.
The reified fun's are not in the interface so we won't be able to use the interface in the generated API classes with that approach, besides. Ktor doesn't allow passing the return type as a class, they ONLY support reified types (not sure why they chose to do that..).
from jellyfin-sdk-kotlin.
You could import the extension function, or only support the extension functions (aka syntactic sugar) for consumers of the API. Also, if I'm not mistaken, reified actually means simply passing the class to the function as a parameter, hidden behind compiler magic.
from jellyfin-sdk-kotlin.
I get your point but the problem is that Ktor doesn't support passing the class as a parameter. It requires a reified type send via generic (https://ktor.io/docs/response.html) but interfaces do not support it.
from jellyfin-sdk-kotlin.
I'm thinking we might want to switch from Ktor to something more low-level (like okhttp). This would give us more control and reduce the libraries dependencies. Besides, we don't use most of the Ktor stuff. The biggest change would be to do the JSON serialization ourselves (using kotlinx of course).
from jellyfin-sdk-kotlin.
Related Issues (20)
- how to understand the docs for Jellyfin API HOT 2
- Follow index redirect in discovery HOT 4
- Is permission READ_EXTERNAL_STORAGE required? HOT 1
- Logo doesn't work in documentation with light theme
- TranscodingInfo.TranscodeReasons incorrectly generated HOT 1
- NoClassDefFoundError on API 23 HOT 2
- JsonDecodingException: TranscodeReasons is not a string HOT 5
- Automatically add labels to openapi update pull requests
- Send Message is not getting received on android HOT 4
- Use Duration instead of Long in HttpClientOptions
- Follow HTTP redirect when discovering servers HOT 3
- Reconnect behaviour HOT 3
- Dependency Dashboard
- Two endpoints called every hours HOT 1
- Optimize RegEx validation pattern usage
- SocketInstance / ReconnectHelper can get stuck disconnected HOT 3
- v1.5.0 checklist (Jellyfin 10.9)
- searchApi.getSearchHints indicates an error when SearchHint.matchedTerm is null HOT 4
- Add a third party client (Homedia) HOT 2
- Using client.imageApi.postUserImage reports 400 error HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jellyfin-sdk-kotlin.