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};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct SendTemplateRequest {
    /// Approved template name (template `name`, not the old HSM `element_name`)
    #[serde(rename = "template", skip_serializing_if = "Option::is_none")]
    pub template: Option<String>,
    #[serde(rename = "language", skip_serializing_if = "Option::is_none")]
    pub language: Option<Box<models::SendTemplateRequestLanguage>>,
    /// Template namespace from `list_templates`
    #[serde(rename = "namespace", skip_serializing_if = "Option::is_none")]
    pub namespace: Option<String>,
    /// Template components in WhatsApp Cloud API format. Each item is an object with `type` (`body`, `header`, `button`) and `parameters` (objects with `type` + `text` / media / action). Never a list of strings. Never HSM `localizable_params`. 
    #[serde(rename = "params", skip_serializing_if = "Option::is_none")]
    pub params: Option<Vec<std::collections::HashMap<String, serde_json::Value>>>,
    /// Recipient phone with country code (use phone or chatId)
    #[serde(rename = "phone", skip_serializing_if = "Option::is_none")]
    pub phone: Option<String>,
    /// Recipient chat ID (`phone@c.us`, group `@g.us`, or BSUID `@lid`). Use phone or chatId.
    #[serde(rename = "chatId", skip_serializing_if = "Option::is_none")]
    pub chat_id: Option<String>,
    /// Optional Cloud API wamid to quote
    #[serde(rename = "quotedMsgId", skip_serializing_if = "Option::is_none")]
    pub quoted_msg_id: Option<String>,
    /// Force Marketing Messages API (POST marketing_messages). If omitted, and the channel has mm_lite_enabled and mm_lite_available: MARKETING templates and templates with an unknown category use marketing_messages. An unknown category falls back to messages (mmLiteFallback) when Meta rejects it. Known AUTHENTICATION and UTILITY templates stay on messages. useMMlite:false forces messages. 
    #[serde(rename = "useMMlite", skip_serializing_if = "Option::is_none")]
    pub use_m_mlite: Option<bool>,
    /// Sets message_activity_sharing on WABA payload. Enables click tracking webhooks. Requires MM Lite path. Ignored on Cloud API fallback. 
    #[serde(rename = "messageActivitySharing", skip_serializing_if = "Option::is_none")]
    pub message_activity_sharing: Option<bool>,
    /// Template message TTL in seconds (message_send_ttl_seconds). MARKETING via MM Lite: 43200–2592000. AUTHENTICATION: 30–900. UTILITY: 30–43200. AUTH/UTILITY also accept -1 (30-day custom TTL). 
    #[serde(rename = "messageSendTtlSeconds", skip_serializing_if = "Option::is_none")]
    pub message_send_ttl_seconds: Option<i32>,
}

impl SendTemplateRequest {
    pub fn new() -> SendTemplateRequest {
        SendTemplateRequest {
            template: None,
            language: None,
            namespace: None,
            params: None,
            phone: None,
            chat_id: None,
            quoted_msg_id: None,
            use_m_mlite: None,
            message_activity_sharing: None,
            message_send_ttl_seconds: None,
        }
    }
}