[][src]Struct azure_functions::bindings::TwilioSmsMessage

pub struct TwilioSmsMessage {
    pub to: String,
    pub from: Option<String>,
    pub body: Option<String>,
}

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

impl Clone for TwilioSmsMessage[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Default for TwilioSmsMessage[src]

impl Debug for TwilioSmsMessage[src]

impl Serialize for TwilioSmsMessage[src]

impl<'de> Deserialize<'de> for TwilioSmsMessage[src]

Auto Trait Implementations

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> Erased for T