warptrixy 0.1.3

Simple API Wrapper for the AWTRIX 3
Documentation
use crate::client::Warptrixy;
use crate::{Config, CustomAppDto};
use reqwest::{Error, StatusCode};

impl Warptrixy {
    pub async fn send_notification(&self, dto: CustomAppDto) -> Result<StatusCode, Error> {
        self.client
            .post(format!("{}/api/notify", &self.config.url))
            .json(&dto)
            .basic_auth(&self.config.username, Some(&self.config.password))
            .send()
            .await
            .and_then(|resp| Ok(resp.status()))
    }

    pub async fn dismiss_notification(&self) -> Result<StatusCode, Error> {
        self.client
            .post(format!("{}/api/notify/dismiss", &self.config.url))
            .basic_auth(&self.config.username, Some(&self.config.password))
            .send()
            .await
            .and_then(|resp| Ok(resp.status()))
    }
}