Kotlin SDK
Official Misar.Dev SDK for Kotlin — build, deploy, and manage apps via api.misar.io/dev.
The official Misar.Dev client SDK for Kotlin (JVM).
Installation
Gradle Kotlin DSL (build.gradle.kts):
dependencies {
implementation("io.misar.dev:misar-dev-sdk:1.0.0")
}
Built on com.squareup.okhttp3:okhttp and com.google.code.gson:gson.
Quick start
import io.misar.dev.MisarDevClient
val client = MisarDevClient(apiKey = "mdk_your_api_key")
val projects = client.projectsList()
println(projects)
The constructor accepts optional base URL and retry overrides:
val client = MisarDevClient(
apiKey = "mdk_your_api_key",
baseUrl = "https://api.misar.io/dev",
maxRetries = 3
)
Configuration
Base URL https://api.misar.io/dev; auth Authorization: Bearer <key> (set on every request). Retries (default 3) apply to 429 and 5xx with exponential backoff (base 500 ms); 401 is never retried. Connect, read, and write timeouts are 30 s. Every method returns a Map<String, Any?> parsed by Gson.
Resources
This Kotlin port (v1.0.0) implements a subset of the full Misar.Dev API:
fun projectsList(): Map<String, Any?>
fun projectsCreate(params: Map<String, Any>): Map<String, Any?>
fun apiKeysList(): Map<String, Any?>
fun usageGet(): Map<String, Any?>
fun chatComplete(params: Map<String, Any>): Map<String, Any?>
fun templatesList(): Map<String, Any?>
projects—projectsList,projectsCreateapiKeys—apiKeysListusage—usageGetchat—chatCompletetemplates—templatesList
Error handling
All failures throw MisarDevException (open class) exposing statusCode and body. Status-specific subclasses are thrown automatically:
AuthException—401RateLimitException—429(after retries are exhausted)ServerException—5xx(after retries are exhausted)
import io.misar.dev.AuthException
import io.misar.dev.MisarDevException
try {
client.projectsList()
} catch (e: AuthException) {
System.err.println("Auth failed: ${e.statusCode}")
} catch (e: MisarDevException) {
System.err.println("Request failed (${e.statusCode}): ${e.body}")
}