Crate twrs_sms

Source

Structs§

TwilioReply
Struct to deserialize the Twilio reply from the post to the API This is used to inspect the response to ensure the message was delivered
TwilioSend
Custom struct to serialize the HTTP POST data into a url encoded objecting using serde_urlencoded For a description of these fields see the Official Twilio Developer Documentation All fields must exist so none of them is given the Serde ignore on None tag

Enums§

TWRSError
Creating a custom error for mapping Errors to return result from the library handles The possible errors are URLEncodeFailure, URLDecodeFailure, HTTPRequestError, and NotDelivered URLDecodeFailure maps to a serde_json::error::Error URLEncodeFailure maps to a serde_urlencoded::ser::Error HTTPRequestError maps to a reqwest::error::Error NotDelivered is a custom error that is sent when an SMS was not delivered

Functions§

is_delivered
This will check if the status is set to delivered within the Twilio API Within this function is a while loop that breaks on the API returning anything other than delivered, if the response is not delivered this will return TWRSError::NotDelivered
send_message
Main function of the library which sends the request and returns the response response. Will error out on a TWRSError::HTTPRequestError if the send results in a failure