The client factory
A client is generated from an object that names the services it fronts.
This page covers that declaration.
Annotate an object with @ClientEndpointServiceFactory.
It is repeatable, so one object can front several services; name becomes the generated extension function’s name:
APIServices.kt
@ClientEndpointServiceFactory(ArticlesService::class, "articles")
object APIServices
APIServices.articles(client) now returns a ServiceCaller<ArticlesService> for any ktor HttpClient you hand it.
There is one such function on that object per service it fronts.
Configuring the HttpClient lists what that HttpClient must be configured with.
|