bark-apns 0.1.0

Direct APNs client for sending Bark notifications.
Documentation
//! Direct APNs client for sending [Bark](https://github.com/Finb/Bark)
//! notifications.
//!
//! This crate talks to Apple Push Notification service directly with an iOS
//! device token. It does not call a Bark server, but it keeps Bark's payload
//! semantics: fields such as `title`, `body`, `markdown`, `sound`, `group`,
//! `isArchive`, `id`, and `delete` are encoded the way Bark's notification
//! service extension expects them.
//!
//! # Examples
//!
//! ## Send a Simple Message
//!
//! ```no_run
//! use bark_apns::{Bark, Message};
//!
//! fn main() -> bark_apns::Result<()> {
//!     let bark = Bark::new()?;
//!     let message = Message::new()
//!         .title("Deploy")
//!         .body("done")
//!         .group("ops");
//!
//!     bark.send(&message, ["device-token-from-bark-app"])?;
//!     Ok(())
//! }
//! ```
//!
//! ## Send a Markdown Message
//!
//! ```no_run
//! use bark_apns::{Bark, Message};
//!
//! fn main() -> bark_apns::Result<()> {
//!     let bark = Bark::new()?;
//!     let message = Message::new()
//!         .title("Deploy")
//!         .markdown("## Deploy\n\n- status: **done**\n- target: `production`");
//!
//!     bark.send(&message, ["device-token-from-bark-app"])?;
//!     Ok(())
//! }
//! ```
//!
//! ## Send an Encrypted Message
//!
//! ```no_run
//! use bark_apns::{Bark, Encryption, EncryptionAlgorithm, EncryptionMode, Message};
//!
//! fn main() -> bark_apns::Result<()> {
//!     let bark = Bark::new()?;
//!     let encryption = Encryption::new(
//!         EncryptionAlgorithm::AES128,
//!         EncryptionMode::CBC,
//!         "1234567890123456",
//!     )?;
//!
//!     let message = Message::new()
//!         .title("Deploy")
//!         .body("done")
//!         .markdown("**Deploy** finished")
//!         .group("ops")
//!         .encryption(encryption);
//!
//!     bark.send(&message, ["device-token-from-bark-app"])?;
//!     Ok(())
//! }
//! ```
//!
//! # Notes
//!
//! - `markdown` follows Bark's documented behavior: when present, Bark renders it
//!   and ignores `body` for display.
//! - Bark parses Markdown with Apple's Swift Markdown package and its own
//!   renderer. It supports paragraphs, headings, block quotes, bold, italic,
//!   strikethrough, inline code, code blocks, links, images, ordered and
//!   unordered lists, nested lists, task-list checkboxes, soft breaks, and hard
//!   line breaks. In notification banners, Bark uses the rendered plain-text body
//!   and collapses repeated blank lines, so styling such as bold, italic, link
//!   color, and code font is not preserved there.
//! - Encrypted pushes serialize Bark request fields to JSON, encrypt that JSON,
//!   and put the result in the top-level `ciphertext` field. CBC and GCM pushes
//!   also include a top-level `iv`, matching Bark's client-side decryptor.

#![warn(missing_docs)]

mod apns;
mod crypto;
mod error;
mod message;

pub use apns::Bark;
pub use crypto::{Encryption, EncryptionAlgorithm, EncryptionMode};
pub use error::{Error, Result};
pub use message::{InterruptionLevel, Message};