Skip to content

Kotlin SDK

com.revieve:revieve-sdk — a thin, typed client for analyzeImage. Source lives in sdks/kotlin/.

build.gradle.kts
dependencies {
implementation("com.revieve:revieve-sdk:0.1.0")
}

Targets JVM 17+ and Android (minimum API level depends on your Ktor configuration; OkHttp engine works back to API 21).

import com.revieve.*
SkinAnalysisClient(partnerId = "jmlv6b2qtS").use { revieve ->
val result = revieve.analyzeImage(
image = imageBytes,
components = listOf(Component.WRINKLES, Component.REDNESS, Component.SKIN_AGE),
gender = Gender.UNKNOWN,
skintone = 0,
)
println(result.message)
}
try {
val result = revieve.analyzeImage(image = imageBytes)
render(result)
} catch (err: RevieveException.Analysis) {
showToast(err.message ?: "Analysis failed")
log(err.firstErrorIdx)
} catch (err: RevieveException.Network) {
log(err)
throw err
}

Pass a mock HttpClient to swap the underlying engine for unit tests:

val mock = HttpClient(MockEngine) {
install(ContentNegotiation) { json() }
engine {
addHandler { request -> respond(fixtureBody, HttpStatusCode.OK) }
}
}
val revieve = SkinAnalysisClient(partnerId = "test", http = mock)

analyzeImage is suspend. Call from a coroutine scope; on Android use viewModelScope or lifecycleScope. Kotlin Multiplatform support is on the roadmap but not v0.1.