late 0.0.620

API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
Documentation
/*
 * Zernio API
 *
 * API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
 *
 * The version of the OpenAPI document: 1.0.4
 * Contact: support@zernio.com
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct SendInboxMessageRequest {
    /// Social account ID
    #[serde(rename = "accountId")]
    pub account_id: String,
    /// Message text
    #[serde(rename = "message", skip_serializing_if = "Option::is_none")]
    pub message: Option<String>,
    /// URL of the attachment to send (image, video, audio, or file). The URL must be publicly accessible. For binary file uploads, use multipart/form-data instead.
    #[serde(rename = "attachmentUrl", skip_serializing_if = "Option::is_none")]
    pub attachment_url: Option<String>,
    /// WhatsApp only (Meta Direct Send). Sends this message as a business-initiated UTILITY message without an approved template, for example outside the 24-hour customer service window; Meta matches or auto-creates a template asynchronously. The WhatsApp Business Account must be eligible for Direct Send, otherwise the send fails with an error telling you to use an approved message template instead. Supported only for text messages (link preview ok) and interactive messages (reply buttons, CTA URL buttons, voice-call button, header of text/image/video/document). Cannot be combined with template, attachments, location, or contacts. Utility messages only; marketing content is not allowed under this category. Accepted on the JSON body only, not on multipart requests.
    #[serde(rename = "category", skip_serializing_if = "Option::is_none")]
    pub category: Option<Category>,
    /// Type of attachment. Defaults to file if not specified.
    #[serde(rename = "attachmentType", skip_serializing_if = "Option::is_none")]
    pub attachment_type: Option<AttachmentType>,
    /// WhatsApp only. Display name for a document sent via attachmentUrl with attachmentType: file (e.g. \"Report.pdf\"). Maps to the recipient's file name; without it WhatsApp derives the name from the URL and shows \"Untitled\". Ignored for image/video/audio and for binary uploads (which use the uploaded file's name).
    #[serde(rename = "attachmentName", skip_serializing_if = "Option::is_none")]
    pub attachment_name: Option<String>,
    /// WhatsApp only. When `true` on an audio attachment, the message is sent as a voice message (PTT) — the recipient sees the waveform + voice-note UI instead of a basic audio attachment. The audio file MUST be `.ogg` encoded with the OPUS codec (mono) per Meta's voice-message contract; other formats are rejected by WhatsApp. Ignored for non-audio attachments.
    #[serde(rename = "voiceNote", skip_serializing_if = "Option::is_none")]
    pub voice_note: Option<bool>,
    /// Quick reply buttons. Mutually exclusive with buttons. Max 13 items.
    #[serde(rename = "quickReplies", skip_serializing_if = "Option::is_none")]
    pub quick_replies: Option<Vec<models::SendInboxMessageRequestQuickRepliesInner>>,
    /// Action buttons. Mutually exclusive with quickReplies. Max 3 items.  WhatsApp: buttons always render as interactive reply buttons. Only `title` and `payload` are used — `type`, `url`, and `phone` are ignored (WhatsApp has no URL/phone button in this field; use the `interactive` field with `type: cta_url` for a link button). `payload` becomes the button reply ID delivered on the `message.received` webhook when the user taps. To send a simple reply-button message, provide `title` + `payload` and set `type: postback`, e.g. `{ \"type\": \"postback\", \"title\": \"Yes\", \"payload\": \"yes\" }`.
    #[serde(rename = "buttons", skip_serializing_if = "Option::is_none")]
    pub buttons: Option<Vec<models::SendInboxMessageRequestButtonsInner>>,
    #[serde(rename = "template", skip_serializing_if = "Option::is_none")]
    pub template: Option<Box<models::SendInboxMessageRequestTemplate>>,
    #[serde(rename = "interactive", skip_serializing_if = "Option::is_none")]
    pub interactive: Option<Box<models::SendInboxMessageRequestInteractive>>,
    #[serde(rename = "replyMarkup", skip_serializing_if = "Option::is_none")]
    pub reply_markup: Option<Box<models::SendInboxMessageRequestReplyMarkup>>,
    /// Facebook messaging type. Required when using messageTag.
    #[serde(rename = "messagingType", skip_serializing_if = "Option::is_none")]
    pub messaging_type: Option<MessagingType>,
    /// Facebook message tag for messaging outside 24h window. Requires messagingType MESSAGE_TAG. Instagram only supports HUMAN_AGENT.
    #[serde(rename = "messageTag", skip_serializing_if = "Option::is_none")]
    pub message_tag: Option<MessageTag>,
    /// Platform message ID to quote-reply to. For WhatsApp, pass the wamid (available in message.platformMessageId from webhooks). For Telegram, pass the Telegram message ID.
    #[serde(rename = "replyTo", skip_serializing_if = "Option::is_none")]
    pub reply_to: Option<String>,
    #[serde(rename = "location", skip_serializing_if = "Option::is_none")]
    pub location: Option<Box<models::SendInboxMessageRequestLocation>>,
    /// WhatsApp-only. Send one or more contact cards.
    #[serde(rename = "contacts", skip_serializing_if = "Option::is_none")]
    pub contacts: Option<Vec<models::SendInboxMessageRequestContactsInner>>,
}

impl SendInboxMessageRequest {
    pub fn new(account_id: String) -> SendInboxMessageRequest {
        SendInboxMessageRequest {
            account_id,
            message: None,
            attachment_url: None,
            category: None,
            attachment_type: None,
            attachment_name: None,
            voice_note: None,
            quick_replies: None,
            buttons: None,
            template: None,
            interactive: None,
            reply_markup: None,
            messaging_type: None,
            message_tag: None,
            reply_to: None,
            location: None,
            contacts: None,
        }
    }
}
/// WhatsApp only (Meta Direct Send). Sends this message as a business-initiated UTILITY message without an approved template, for example outside the 24-hour customer service window; Meta matches or auto-creates a template asynchronously. The WhatsApp Business Account must be eligible for Direct Send, otherwise the send fails with an error telling you to use an approved message template instead. Supported only for text messages (link preview ok) and interactive messages (reply buttons, CTA URL buttons, voice-call button, header of text/image/video/document). Cannot be combined with template, attachments, location, or contacts. Utility messages only; marketing content is not allowed under this category. Accepted on the JSON body only, not on multipart requests.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Category {
    #[serde(rename = "utility")]
    Utility,
}

impl Default for Category {
    fn default() -> Category {
        Self::Utility
    }
}
/// Type of attachment. Defaults to file if not specified.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum AttachmentType {
    #[serde(rename = "image")]
    Image,
    #[serde(rename = "video")]
    Video,
    #[serde(rename = "audio")]
    Audio,
    #[serde(rename = "file")]
    File,
}

impl Default for AttachmentType {
    fn default() -> AttachmentType {
        Self::Image
    }
}
/// Facebook messaging type. Required when using messageTag.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum MessagingType {
    #[serde(rename = "RESPONSE")]
    Response,
    #[serde(rename = "UPDATE")]
    Update,
    #[serde(rename = "MESSAGE_TAG")]
    MessageTag,
}

impl Default for MessagingType {
    fn default() -> MessagingType {
        Self::Response
    }
}
/// Facebook message tag for messaging outside 24h window. Requires messagingType MESSAGE_TAG. Instagram only supports HUMAN_AGENT.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum MessageTag {
    #[serde(rename = "CONFIRMED_EVENT_UPDATE")]
    ConfirmedEventUpdate,
    #[serde(rename = "POST_PURCHASE_UPDATE")]
    PostPurchaseUpdate,
    #[serde(rename = "ACCOUNT_UPDATE")]
    AccountUpdate,
    #[serde(rename = "HUMAN_AGENT")]
    HumanAgent,
}

impl Default for MessageTag {
    fn default() -> MessageTag {
        Self::ConfirmedEventUpdate
    }
}