cosmic_files/sequencing/
ntfy_notify.rs1pub async fn send_report_ntfy(
5 topic: &str,
6 pdf_bytes: Vec<u8>,
7 n_records: usize,
8) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
9 let url = if topic.starts_with("http://") || topic.starts_with("https://") {
10 topic.to_string()
11 } else {
12 format!("https://ntfy.sh/{topic}")
13 };
14
15 reqwest::Client::new()
16 .put(&url)
17 .header("Content-Type", "application/pdf")
18 .header("Filename", "ab1_susceptibility_report.pdf")
19 .header("Title", format!("AB1 scan complete ({n_records} records)"))
20 .body(pdf_bytes)
21 .send()
22 .await?
23 .error_for_status()?;
24
25 Ok(())
26}