Swift, Kotlin and React Native

One call that wraps the HTTP API's bearer door, with nothing else in the dependency tree. A token that ships inside an app is public: an app sends through its own server, or through a source whose Reach you are happy to let strangers reach.

Swift

iOS 15, macOS 12, watchOS 8 and tvOS 15 and up. URLSession, async.

.package(url: "https://github.com/bylivebetter/youlmk-swift", from: "0.1.0")
import YouLMK
let youlmk = YouLMK(token: "ylk_…")
let sent = try await youlmk.notify("deploy finished", body: "production · 4 min 12 s", priority: .normal)

In Xcode: File, Add Package Dependencies, paste the URL. The answer is a YouLMK.Result with id, receipt, grouped and held; an error is a YouLMK.Error with status, code, field and retryAfter.

Kotlin and Java

Android 8 and up, and any JVM. HttpURLConnection, blocking: on Android call it off the main thread.

implementation("com.bylivebetter:youlmk:0.1.0")
import com.bylivebetter.youlmk.YouLMK
val youlmk = YouLMK("ylk_…")
withContext(Dispatchers.IO) {
youlmk.notify("deploy finished", body = "production · 4 min 12 s", priority = YouLMK.Priority.NORMAL)
}

The answer is a YouLMK.Result; an error is a YouLMK.Error, an IOException with status, code, field and retryAfter. From Java, new YouLMK(token).notify(title) and the overloads.

React Native and Expo

The Node package, as it is: it uses the platform's fetch and nothing from Node.

$ npm install youlmk
import { notify } from "youlmk";
await notify(token, "order placed", { body: "#2041 · $84.00", priority: "high" });

Next

Payload reference · Node and Python · Reach