one-msg-sdk 2.0.3

Official Rust SDK for the 1msg WhatsApp Business API
/*
 * 1MSG WhatsApp Business API (Public)
 *
 * Public client API for sending messages, managing groups, flows, and templates.  This is the API exposed to end customers via platform.1msg.io  **Authentication:** Pass the channel token in **one** place. The API checks JSON body (`token`), then query string (`?token=`), then `Authorization: Bearer` header (preferred in production).  **Documentation:** https://help.1msg.io/platform-1msg/getting-start/quick-start **API Docs:** https://docs.1msg.io/ 
 *
 * The version of the OpenAPI document: 2.0.0
 * Contact: support@1msg.io
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// SendMessageRequest : Request body for sending a text message
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct SendMessageRequest {
    /// Message text, UTF-8 or UTF-16 string with emoji
    #[serde(rename = "body")]
    pub body: String,
    /// Message ID to quote/reply to (Cloud API wamid)
    #[serde(rename = "quotedMsgId", skip_serializing_if = "Option::is_none")]
    pub quoted_msg_id: Option<String>,
    /// Recipient chat ID: phone@c.us, group@g.us, or BSUID@lid
    #[serde(rename = "chatId", skip_serializing_if = "Option::is_none")]
    pub chat_id: Option<String>,
    /// Phone number starting with country code (alternative to chatId)
    #[serde(rename = "phone", skip_serializing_if = "Option::is_none")]
    pub phone: Option<i32>,
    /// Optional Direct Send category. Direct Send is in beta: Meta has not enabled it on every business portfolio. `utility` or `authentication` enables it. `authentication` is part of that beta and is not recommended. Omit or `service` keeps a normal service message (and the marketing auto-template outside the 24-hour window). `marketing` is rejected. 
    #[serde(rename = "category", skip_serializing_if = "Option::is_none")]
    pub category: Option<Category>,
    #[serde(rename = "directSend", skip_serializing_if = "Option::is_none")]
    pub direct_send: Option<Box<models::SendMessageRequestDirectSend>>,
}

impl SendMessageRequest {
    /// Request body for sending a text message
    pub fn new(body: String) -> SendMessageRequest {
        SendMessageRequest {
            body,
            quoted_msg_id: None,
            chat_id: None,
            phone: None,
            category: None,
            direct_send: None,
        }
    }
}
/// Optional Direct Send category. Direct Send is in beta: Meta has not enabled it on every business portfolio. `utility` or `authentication` enables it. `authentication` is part of that beta and is not recommended. Omit or `service` keeps a normal service message (and the marketing auto-template outside the 24-hour window). `marketing` is rejected. 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Category {
    #[serde(rename = "utility")]
    Utility,
    #[serde(rename = "authentication")]
    Authentication,
    #[serde(rename = "service")]
    Service,
}

impl Default for Category {
    fn default() -> Category {
        Self::Utility
    }
}