Urbit HTTP API library in Kotlin for connecting to an Urbit instance
- Copy
urbit.kt
in/src/main/kotlin/urbit.kt
to your Kotlin project - Add following dependencies to your project
build.gradle.kts
implementation("com.squareup.okhttp3:okhttp:4.9.0")
implementation("com.squareup.okhttp3:okhttp-sse:4.9.0")
- Import the
Urbit
class in your project with top-level statementimport urbit.http.api.Urbit
- Initialize the
Urbit
class. E.gval zod = Urbit(code, url)
- Call methods in your
main
function block. E.gzod.connect()
import urbit.http.api.Urbit
val zod = Urbit(code = "lidlut-tabwed-pillex-ridrup", url = "http://localhost:8080")
fun main() {
zod.connect()
zod.poke("zod","hood","helm-hi","openinggg airlock")
zod.subscribe("zod","chat-view","/primary")
zod.sseInit()
zod.unsubscribe(2)
zod.delete()
}
Look for more examples at test/urbitclient.kt
- improve documentation
- write methods for scry, spider | DONE
- handle timeouts better | DONE
- abstract away message boilerplate, let all actions call sendmessage()
- restructure code into Kotlin Multiplatform
- write graph-store interface | DONE
- write other urbit apps interfaces