pub struct GotifyService { /* private fields */ }Expand description
Business-logic facade over GotifyClient: the same endpoints, plus
client-side filtering and pagination shaping that any embedder is likely
to want (Gotify’s own API has no server-side text search, and its
applications/clients listings have no filter parameter at all).
Consumers embedding this crate (CLI commands, MCP tools, HTTP handlers)
should depend on GotifyService, not GotifyClient directly — it is
the stable seam for adding cross-cutting behavior without touching every
call site.
Deliberately not included here: request counters, uptime/status
reporting, or a destructive-action confirmation gate. Those are
server/product policy (how your MCP tool or CLI chooses to expose
delete_*), not something this crate should bake in — same reasoning as
unifi’s AuthScope being metadata only, not enforced by the crate.
Implementations§
Source§impl GotifyService
impl GotifyService
Sourcepub fn new(client: GotifyClient) -> Self
pub fn new(client: GotifyClient) -> Self
Wraps an already-built GotifyClient.
Sourcepub async fn messages(
&self,
app_id: Option<i64>,
limit: Option<i64>,
since: Option<i64>,
offset: Option<i64>,
query: Option<&str>,
) -> Result<Value>
pub async fn messages( &self, app_id: Option<i64>, limit: Option<i64>, since: Option<i64>, offset: Option<i64>, query: Option<&str>, ) -> Result<Value>
Lists messages with client-side text search and offset pagination on
top of GotifyClient::messages’s server-paginated result.
limit is capped at 200 and defaults to 50. query, when given,
keeps only messages whose message or title contains it
(case-insensitive). offset skips that many matching results before
the page starts.
§Errors
See crate::GotifyError for the failure cases this can return.
Sourcepub async fn send_message(
&self,
message: &str,
title: Option<&str>,
priority: Option<i64>,
extras: Option<Value>,
) -> Result<Value>
pub async fn send_message( &self, message: &str, title: Option<&str>, priority: Option<i64>, extras: Option<Value>, ) -> Result<Value>
Sourcepub async fn delete_message(&self, id: i64) -> Result<Value>
pub async fn delete_message(&self, id: i64) -> Result<Value>
Sourcepub async fn delete_all_messages(&self) -> Result<Value>
pub async fn delete_all_messages(&self) -> Result<Value>
Sourcepub async fn applications(&self, name_filter: Option<&str>) -> Result<Value>
pub async fn applications(&self, name_filter: Option<&str>) -> Result<Value>
Lists applications, optionally filtered by a case-insensitive
substring match on name — Gotify’s own API has no filter parameter
for this listing.
§Errors
See crate::GotifyError for the failure cases this can return.
Sourcepub async fn create_application(
&self,
name: &str,
description: Option<&str>,
default_priority: Option<i64>,
) -> Result<Value>
pub async fn create_application( &self, name: &str, description: Option<&str>, default_priority: Option<i64>, ) -> Result<Value>
Sourcepub async fn update_application(
&self,
app_id: i64,
name: Option<&str>,
description: Option<&str>,
default_priority: Option<i64>,
) -> Result<Value>
pub async fn update_application( &self, app_id: i64, name: Option<&str>, description: Option<&str>, default_priority: Option<i64>, ) -> Result<Value>
Sourcepub async fn delete_application(&self, app_id: i64) -> Result<Value>
pub async fn delete_application(&self, app_id: i64) -> Result<Value>
Sourcepub async fn create_client(&self, name: &str) -> Result<Value>
pub async fn create_client(&self, name: &str) -> Result<Value>
Sourcepub async fn delete_client(&self, client_id: i64) -> Result<Value>
pub async fn delete_client(&self, client_id: i64) -> Result<Value>
Trait Implementations§
Source§impl Clone for GotifyService
impl Clone for GotifyService
Source§fn clone(&self) -> GotifyService
fn clone(&self) -> GotifyService
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more