pub struct TwilioRequest { /* private fields */ }Expand description
Generic Twilio request builder.
Data is encoded as application/x-www-form-urlencode.
When performing GET should be appended to URL as query string.
When performing POST should be placed as body of HTTP Request with Content-Type equal to application/x-www-form-urlencode.
While it implements Serialize, there is no need to employ it as internally data is already encoded.
Implementations§
Source§impl TwilioRequest
impl TwilioRequest
Sourcepub const CONTENT_TYPE: &'static str = "application/x-www-form-urlencode"
pub const CONTENT_TYPE: &'static str = "application/x-www-form-urlencode"
Content type of Twilio API request.
To be used for HTTP Post requests
Sourcepub fn into_bytes(self) -> Vec<u8> ⓘ
pub fn into_bytes(self) -> Vec<u8> ⓘ
Returns raw application/x-www-form-urlencoded data.
Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Returns string application/x-www-form-urlencoded data.
Sourcepub fn as_form(&self) -> &str
pub fn as_form(&self) -> &str
Returns reference as string application/x-www-form-urlencoded data.
Sourcepub fn account_sid(&mut self, sid: &str) -> &mut Self
pub fn account_sid(&mut self, sid: &str) -> &mut Self
Adds AccountSid to specify owner of the resource.
Sourcepub fn from(&mut self, from: &str) -> &mut Self
pub fn from(&mut self, from: &str) -> &mut Self
Adds From field, which is identifier of caller.
Type should be the same as for To
Sourcepub fn to(&mut self, to: &str) -> &mut Self
pub fn to(&mut self, to: &str) -> &mut Self
Adds To field, which is identifier of callee.
Type should be the same as for To
Sourcepub fn post_status_callback(&mut self, url: &str) -> &mut Self
pub fn post_status_callback(&mut self, url: &str) -> &mut Self
Adds StatusCallback field, which is url where to perform POST request
Sourcepub fn provide_feedback(&mut self, value: bool) -> &mut Self
pub fn provide_feedback(&mut self, value: bool) -> &mut Self
Sets ProvideFeedback field, to specify whether message delivery should be tracked.
Sourcepub fn attempt(&mut self, attempt: u32) -> &mut Self
pub fn attempt(&mut self, attempt: u32) -> &mut Self
Sets Attempt field, to indicate total number of attempts to post message.
Sourcepub fn validity_period(&mut self, attempt: u16) -> &mut Self
pub fn validity_period(&mut self, attempt: u16) -> &mut Self
Sets ValidityPeriod field, to indicate number of seconds allowed in waiting queue.
If message is enqueuedfor longer, it is discarded by Twilio
Sourcepub fn send_at(&mut self, date: &str) -> &mut Self
pub fn send_at(&mut self, date: &str) -> &mut Self
Sets SendAt field, to indicate where message is to be sent.
Sourcepub fn twiml(&mut self, twiml: &str) -> &mut Self
pub fn twiml(&mut self, twiml: &str) -> &mut Self
Sets Twiml field, to provide call’s content as xml string.
Sourcepub fn url(&mut self, url: &str) -> &mut Self
pub fn url(&mut self, url: &str) -> &mut Self
Sets Url field, to provide call’s content via GET to the provided url
Sourcepub fn url_with_method(&mut self, method: TwilioMethod, url: &str) -> &mut Self
pub fn url_with_method(&mut self, method: TwilioMethod, url: &str) -> &mut Self
Sets Url field, to provide call’s content via GET to the provided url.
With option of setting HTTP method to access URL.
Sourcepub fn status_url(&mut self, url: &str) -> &mut Self
pub fn status_url(&mut self, url: &str) -> &mut Self
Sets StatusCallback field, to provide URL where to post status information.
Sourcepub fn status_url_with_method(
&mut self,
method: TwilioMethod,
url: &str,
) -> &mut Self
pub fn status_url_with_method( &mut self, method: TwilioMethod, url: &str, ) -> &mut Self
Sets StatusCallback field, to provide URL where to post status information.
With option of setting HTTP method to access URL.
Sourcepub fn caller_id(&mut self, id: &str) -> &mut Self
pub fn caller_id(&mut self, id: &str) -> &mut Self
Sets CallerId field, to provide caller identification.
Sourcepub fn send_digits(&mut self, digits: &str) -> &mut Self
pub fn send_digits(&mut self, digits: &str) -> &mut Self
Sets SendDigits field, to provide set of keys to dial after call is established.
Sourcepub fn page_size(&mut self, size: u32) -> &mut Self
pub fn page_size(&mut self, size: u32) -> &mut Self
Sets PageSize field, to provide number of resources max for when reading multiple resources
Sourcepub fn start_date(&mut self, date: &str) -> &mut Self
pub fn start_date(&mut self, date: &str) -> &mut Self
Sets StartDate field, to provide starting date for when reading multiple calls