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
Creating a custom error for mapping Errors to return result from the library handles
The possible errors are URLEncodeFailure, URLDecodeFailure, HTTPRequestError, and NotDeliveredURLDecodeFailure maps to a serde_json::error::ErrorURLEncodeFailure maps to a serde_urlencoded::ser::ErrorHTTPRequestError maps to a reqwest::error::ErrorNotDelivered is a custom error that is sent when an SMS was not 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
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