ift-webhook
a simple lib binding to the ifttt's webhook api.
there is a async interface can be activate in feature non-blocking
.
and a time delay trigger function for delay the trigger in feature delay
.
the blocking interface use ureq, and the non-blocking interface use reqwest internally.
about ifttt webhook usage: For example,You can call a url (supplied by ifttt) then receive a notification (could include data* you supplied) on you phone.
*sometimes you can set some json data (up to three fields in it) on the request, which is depends on the service webhook connected with.
Installation
-
find in crates.io
-
use cargo-edit
Usage
blocking api
code
extern crate ift-webhook
extern crate dotenv
use ift-*
dotenv.unwrap;
let event_name = var.unwrap;
let api_key = var.unwrap;
let client = new;
let data = new;
let res = client.trigger;
assert!
non-blocking api
Cargo.toml
={=*,= false,=["non-blocking"]}
code
extern crate ift-webhook
extern crate dotenv
use ift-*
dotenv.unwrap;
let event_name = var.unwrap;
let api_key = var.unwrap;
let client = new;
let res = client.trigger.await;
assert!
non-blocking api with time delay
Cargo.toml
={=*,= false,=["delay"]}
code
extern crate ift-webhook
extern crate dotenv
use ift-*
dotenv.unwrap;
let event_name = var.unwrap;
let api_key = var.unwrap;
let client = new;
let res_handler: DelayResultHandler =
client.trigger_with_delay;
///do something else
let res = res_handler.await;
assert!