The Ozone project for the AT Protocol consists of 3 components:
- A Gradle plugin to compile AT Protocol schemas into usable Kotlin classes.
- Compiled bindings for the Bluesky Social service.
- An example Android/Desktop client for Bluesky Social that uses those generated bindings.
Warning
🚧 🚧 🚧 Everything in here is very much a work-in-progress! The upstream schemas are still subject to breaking changes and may break at any moment if used in production code. Use at your own risk!
O3 exists at all levels in the ATmosphere.
# Desktop app
./gradlew :desktop:run
# Android app
./gradlew :android:installDebug
// build.gradle[.kts]
dependencies {
api("sh.christian.ozone:bluesky:0.0.2")
}
// build.gradle[.kts]
plugins {
id("sh.christian.ozone.generator") version "0.0.2"
}
dependencies {
// This is where you have your schema files stored in your project.
lexicons(fileTree("lexicons") { include("**/*.json") })
}
lexicons {
// Generates an additional interface for the target schemas.
// This method can be called more than once to generate multiple API interfaces.
generateApi("BlueskyApi") {
// Determines the package name of the generated API. Defaults to "sh.christian.ozone".
packageName.set("com.example.myapp")
// Generates an additional class that implements this interface by sending corresponding
// XRPC requests to a provided host conforming to the AT Protocol.
// Inherits the same package name as the generated interface.
withKtorImplementation("XrpcBlueskyApi")
// Determines the return type for each generated API method. Defaults to Raw.
// - Raw: the raw data type
// - Result: Result<T>
// - Response: AtpResponse<T>
returnType.set(ApiReturnType.Result)
// Determines whether the generated methods should be marked as suspend functions.
// When generating a Ktor implementation as well, execution will block the current thread
// for non-suspending methods. Defaults to true.
suspending.set(true)
}
// File path where Kotlin source files will be written to. Defaults to "/build/generated/lexicons".
outputDirectory.set(project.layout.buildDirectory.dir("out"))
}