infraqueue-twilio 0.1.0

Twilio client for INFRAQUEUE
Documentation
use serde::{Deserialize, Serialize};

#[cfg(feature = "utoipa")]
use utoipa::ToSchema;
#[cfg(feature = "validator")]
use validator::Validate;

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "utoipa", derive(ToSchema))]
#[cfg_attr(feature = "validator", derive(Validate))]
pub struct MessageCreateRequest {
    /// The recipient's phone number in E.164 format (e.g., +14155551212).
    #[cfg_attr(feature = "validator", validate(length(min = 8, max = 20)))]
    pub to: String,
    /// The message content. Limited to 1600 characters for SMS.
    #[cfg_attr(feature = "validator", validate(length(min = 1, max = 1600)))]
    pub body: String,
    /// Optional sender SID; if both from and messaging_service_sid are omitted,
    /// the client will use its default from the config.
    pub messaging_service_sid: Option<String>,
    /// Optional sender phone number; if both from and messaging_service_sid are omitted,
    /// the client will use its default from the config.
    pub from: Option<String>,
    /// Optional list of media URLs for MMS.
    pub media_urls: Option<Vec<String>>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "utoipa", derive(ToSchema))]
pub struct MessageCreateResponse {
    /// The unique Twilio identifier for the message (prefix SM... or MM...).
    pub sid: String,
    /// The destination phone number.
    pub to: String,
    /// Initial status (usually "queued" or "sent").
    pub status: String,
}