gotify-rs

Build Status Crates.io Documentation License: MIT

An idiomatic Rust client for Gotify.

Overview

By default, this crate only exposes the Client::health(), Client::version() methods. All other categories of endpoints must be enabled by the correspondig feature flags.

| Feature flag | Enabled methods | Note | | ------------ | --------------- | ---- | | app | Client::create_message() | | | manage-clients | Client::get_clients(), Client::create_client(), Client::update_client(), Client::delete_client() | | | manage-messages | Client::get_application_messages(), Client::delete_application_messages(), Client::get_messages(), Client::delete_messages(), Client::delete_message() | doesn't include Client::create_message() and Client::message_stream() | | manage-plugins | Client::get_plugins(), Client::get_plugin_config(), Client::update_plugin_config(), Client::disable_plugin(), Client::get_plugin_display(), Client::enable_plugin() | | | websocket | Client::message_stream() | enables additional dependencies (mainly tokio-tungstenite) |

Examples

Creating a message

```rust let client: gotify::AppClient = gotify::Client::new(GOTIFYURL, GOTIFYAPP_TOKEN)?;

client.createmessage("Lorem ipsum dolor sit amet").withtitle("Lorem Ipsum").await?; ```

Listening for new messages

```rust use futures_util::StreamExt;

let client: gotify::ClientClient = gotify::Client::new(GOTIFYURL, GOTIFYCLIENT_TOKEN)?;

let mut messages = client.message_stream().await?;

while let Some(result) = messages.next().await { let message = result?;

println!("{message:#?}")

} ```

License

This project is licensed under the MIT License.

See LICENSE for more information.