# barkust
A Rust client library and CLI for the [Bark](https://bark.day.app/) push notification service.
## Features
- Async client built on [`reqwest`](https://crates.io/crates/reqwest)
- Type-safe notification builder
- Batch push to multiple devices
- Image, subtitle, markdown, critical level support
- Update or delete notifications by `id`
- Custom Bark server support
- Thin command-line wrapper
- MIT licensed
## Installation
### Library
Add to your `Cargo.toml`:
```toml
[dependencies]
barkust = "0.1"
tokio = { version = "1", features = ["full"] }
```
### CLI
```bash
cargo install barkust
```
## Usage
### Library
```rust
use barkust::{BarkClient, Level, Notification};
#[tokio::main]
async fn main() -> Result<(), barkust::Error> {
let client = BarkClient::new(Some("your-device-key".into()))?;
// Simple push
client.send_simple("Hello", "World").await?;
// Fully customized push
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?;
// Batch push
let batch = Notification::builder()
.title("Batch")
.body("Hello everyone")
.build();
client
.send_batch(&batch, vec!["key1".into(), "key2".into()])
.await?;
Ok(())
}
```
### CLI
Send a simple notification using the `BARK_KEY` environment variable:
```bash
export BARK_KEY="your-device-key"
barkust --title "Hello" --body "World"
```
With image and subtitle:
```bash
barkust --title "Hello" --subtitle "Subtitle" --body "World" \
--image "https://example.com/image.png"
```
Critical alert that ignores the mute switch:
```bash
barkust --title "Alert" --body "Critical!" --critical --volume 10
```
Batch push to multiple devices:
```bash
barkust --device-keys key1,key2 --title "Hello" --body "World"
```
Update or delete an existing notification by id:
```bash
barkust --id "msg-123" --title "Updated" --body "New content"
barkust --id "msg-123" --delete
```
Use a self-hosted Bark server:
```bash
barkust --url https://bark.example.com --title "Hello" --body "World"
```
See `barkust --help` for all options.
## License
Licensed under the [MIT license](LICENSE-MIT).