twilio-async
Breaking Change 0.2.0
When updating to hyper@0.12
I decided to change the API slightly. I never liked that twilio-async made decisions about the Core
and event loop that the requests would run in, so .run()
now returns a Box<Future>
. I would have made it return an impl Future
but this is currently impossible on stable as long as we lack existential return types from trait functions.
There is a runtime
feature I've added that includes tokio_core
as a dependency, in this case, .run()
will execute the request in an event loop that's provided by the library. i.e. We will keep a reference to Core
and run requests there instead of returning Futures
.
Example Usage
An async and ergonomic wrapper around Twilio API & TwiML.
All types can run run()
or a similar function. They return a value that implements Deserialize
.
The examples/
dir has up to date working example code.
Messages:
let twilio = new?;
let mut core = new?;
// sending a message
core.run?;
// sending a body-less message with media
core.run?;
// get details about a message
core.run?;
// redact a message
core.run?;
// get a msg media url
core.run?;
// delete a msg
core.run?;
// get all messages
core.run?;
// get all messages between some time
core.run?;
// get all messages on a specific date
core.run?;
Calls:
let twilio = new?;
let = core.run?;
Twiml:
use Response;
let resp = new
.say // builder pattern also supports say(Say::new("Hello World").lang("de")...)
.play
.build;
let s = "<Response><Say voice=\"man\" language=\"en\" loop=\"1\">Hello World</Say><Play loop=\"1\">https://api.twilio.com/Cowbell.mp3</Play></Response>";
assert_eq!;
Early release
This library is a work in progress, messages and calls are tested, there is untested code for conferences/recordings.
The TwiML work is complete and has some test coverage. Webhooks will be added.
PRs and suggestions are welcome.