Pushover
A Rust wrapper for the Pushover API (https://pushover.net/api).
Installation
Usage
Add the following to Cargo.toml
:
[dependencies]
pushover = "0.3.0"
Synchronous example:
extern crate pushover;
use pushover::SyncAPIBuilder;
use pushover::requests::message::SendMessage;
fn main() {
let api = SyncAPIBuilder::new().build().expect("Error creating API");
let msg = SendMessage::new("token", "user_key", "hello");
let response = api.send(&msg);
println!("{:?}", response);
}
Asynchronous example:
extern crate pushover;
extern crate tokio_core;
use pushover::AsyncAPIBuilder;
use pushover::requests::message::SendMessage;
use tokio_core::reactor::Core;
fn main() {
let mut core = Core::new().expect("Error creating core");
let handle = core.handle();
let api = AsyncAPIBuilder::new().build(&handle).expect("Error creating API");
let msg = SendMessage::new("token", "user_key", "hello");
let work = api.send(&msg);
println!("{:?}", core.run(work).expect("Error sending message"));
}