pub struct TwilioSmsMessage {
pub to: String,
pub from: Option<String>,
pub body: Option<String>,
}
Expand description
Represents the Twilio SMS message output binding.
The following binding attributes are supported:
Name | Description |
---|---|
name | The name of the parameter being bound. |
account_sid | The name of an app setting that holds your Twilio Account SID. If not set, the default app setting name is “AzureWebJobsTwilioAccountSid”. |
auth_token | The name of an app setting that holds your Twilio authentication token. If not set, the default app setting name is “AzureWebJobsTwilioAuthToken”. |
from | The default phone number that the SMS text is sent from. |
body | The default SMS message body to use. |
§Examples
An example HTTP-triggered function that outputs a Twilio SMS message:
use azure_functions::{
bindings::{HttpRequest, HttpResponse, TwilioSmsMessage},
func,
};
use std::borrow::ToOwned;
#[func]
#[binding(name = "output1", from = "+15555555555")]
pub fn send_sms(req: HttpRequest) -> (HttpResponse, TwilioSmsMessage) {
let params = req.query_params();
(
"Text message sent.".into(),
TwilioSmsMessage {
to: params.get("to").unwrap().to_owned(),
body: params.get("body").map(ToOwned::to_owned),
..Default::default()
},
)
}
Fields§
§to: String
The phone number to send the SMS message to.
from: Option<String>
The optional phone number to send the SMS message from. If None, the from
binding attribute is used.
body: Option<String>
The optional SMS message body. If None, the body
binding attribute is used.
Trait Implementations§
Source§impl Clone for TwilioSmsMessage
impl Clone for TwilioSmsMessage
Source§fn clone(&self) -> TwilioSmsMessage
fn clone(&self) -> TwilioSmsMessage
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for TwilioSmsMessage
impl Debug for TwilioSmsMessage
Source§impl Default for TwilioSmsMessage
impl Default for TwilioSmsMessage
Source§fn default() -> TwilioSmsMessage
fn default() -> TwilioSmsMessage
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for TwilioSmsMessage
impl<'de> Deserialize<'de> for TwilioSmsMessage
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TwilioSmsMessage
impl RefUnwindSafe for TwilioSmsMessage
impl Send for TwilioSmsMessage
impl Sync for TwilioSmsMessage
impl Unpin for TwilioSmsMessage
impl UnwindSafe for TwilioSmsMessage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request