/*
* Zernio API
*
* API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema).
*
* 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 WebhookPayloadMessageSentMessage {
/// Internal message ID
#[serde(rename = "id")]
pub id: String,
/// Internal conversation ID
#[serde(rename = "conversationId")]
pub conversation_id: String,
#[serde(rename = "platform")]
pub platform: Platform,
/// Platform's message ID
#[serde(rename = "platformMessageId")]
pub platform_message_id: String,
#[serde(rename = "direction")]
pub direction: Direction,
/// Message text content
#[serde(rename = "text", deserialize_with = "Option::deserialize")]
pub text: Option<String>,
#[serde(rename = "attachments")]
pub attachments: Vec<models::WebhookPayloadMessageSentMessageAttachmentsInner>,
#[serde(rename = "sender")]
pub sender: Box<models::WebhookPayloadMessageSentMessageSender>,
#[serde(rename = "sentAt")]
pub sent_at: String,
#[serde(rename = "isRead")]
pub is_read: bool,
/// WhatsApp send origin. whatsapp_business_app when sent from the WhatsApp Business phone app on a Coexistence number; cloud_api when sent through Zernio (dashboard, API, or broadcasts). Absent on non-WhatsApp platforms. This is not the inbox metadata.source lineage field.
#[serde(rename = "source", skip_serializing_if = "Option::is_none")]
pub source: Option<Source>,
}
impl WebhookPayloadMessageSentMessage {
pub fn new(
id: String,
conversation_id: String,
platform: Platform,
platform_message_id: String,
direction: Direction,
text: Option<String>,
attachments: Vec<models::WebhookPayloadMessageSentMessageAttachmentsInner>,
sender: models::WebhookPayloadMessageSentMessageSender,
sent_at: String,
is_read: bool,
) -> WebhookPayloadMessageSentMessage {
WebhookPayloadMessageSentMessage {
id,
conversation_id,
platform,
platform_message_id,
direction,
text,
attachments,
sender: Box::new(sender),
sent_at,
is_read,
source: None,
}
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Platform {
#[serde(rename = "instagram")]
Instagram,
#[serde(rename = "facebook")]
Facebook,
#[serde(rename = "telegram")]
Telegram,
#[serde(rename = "whatsapp")]
Whatsapp,
}
impl Default for Platform {
fn default() -> Platform {
Self::Instagram
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Direction {
#[serde(rename = "incoming")]
Incoming,
#[serde(rename = "outgoing")]
Outgoing,
}
impl Default for Direction {
fn default() -> Direction {
Self::Incoming
}
}
/// WhatsApp send origin. whatsapp_business_app when sent from the WhatsApp Business phone app on a Coexistence number; cloud_api when sent through Zernio (dashboard, API, or broadcasts). Absent on non-WhatsApp platforms. This is not the inbox metadata.source lineage field.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Source {
#[serde(rename = "whatsapp_business_app")]
WhatsappBusinessApp,
#[serde(rename = "cloud_api")]
CloudApi,
}
impl Default for Source {
fn default() -> Source {
Self::WhatsappBusinessApp
}
}