barkust
A Rust client library and CLI for the Bark push notification service.
Features
- Async client built on
reqwest
- Type-safe notification builder
- Custom Bark server support
- Thin command-line wrapper
- MIT licensed
Installation
Library
Add to your Cargo.toml:
[dependencies]
barkust = "0.1"
tokio = { version = "1", features = ["full"] }
CLI
cargo install barkust
Usage
Library
use barkust::{BarkClient, Level, Notification};
#[tokio::main]
async fn main() -> Result<(), barkust::Error> {
let client = BarkClient::new(Some("your-device-key".into()))?;
client.send_simple("Hello", "World").await?;
let notification = Notification::builder()
.title("Custom")
.body("Built with the builder API")
.sound("minuet")
.group("demo")
.level(Level::TimeSensitive)
.archive(true)
.build();
client.send(¬ification).await?;
Ok(())
}
CLI
Send a simple notification using the BARK_KEY environment variable:
export BARK_KEY="your-device-key"
barkust --title "Hello" --body "World"
Or pass the key directly:
barkust --device-key "your-device-key" --title "Hello" --body "World"
Use a self-hosted Bark server:
barkust --url https://bark.example.com --title "Hello" --body "World"
See barkust --help for all options.
License
Licensed under the MIT license.