Languages
Kotlin
The Kotlin SDK publishes to Maven Central and is the only language besides TypeScript with an HTTP engine choice.
Install
text
implementation 'com.your-org:api-client-kotlin:1.0.0'Options
| Option | Values | Default |
|---|---|---|
| HTTP engine | okhttp, ktor | okhttp |
| Client style | functions, namespaced, class, class-namespaced | functions |
| Argument style | object, positional | object |
| Namespace | tags, path | tags |
| Doc comments | full, minimal | full |
| File header | omit, include | omit |
| Usage example | full, concise | full |
HTTP engine
kotlin
// OkHttp (JVM)
client.newCall(req)The default. The JVM standard, already present in most Android and server codebases.
Ktor if your users target multiplatform
OkHttp is fine on Android and the server, but it won't build for Kotlin/Native or Kotlin/JS. If your SDK is meant to work anywhere Kotlin runs, ktor is the only option that gets there.
Package name
Same Maven coordinates as Java, and the same groupId ownership requirement:
text
com.acme:api-client-kotlinKotlin and Java both publish to Maven Central, so give them distinct artifactIds. Set Package name rather than a single project-wide name.
What callers write
kotlin
import com.acme.AcmeClient
val client = AcmeClient(token = System.getenv("ACME_TOKEN"))
client.users.list(limit = 100).collect { user ->
println(user.id)
}