/*
* 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};
/// InboxWebhookMessage : The message object included in inbox webhook payloads.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct InboxWebhookMessage {
/// 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 (retained on deleted messages for API consumers; Zernio dashboard UI hides this)
#[serde(rename = "text", deserialize_with = "Option::deserialize")]
pub text: Option<String>,
#[serde(rename = "attachments")]
pub attachments: Vec<models::InboxWebhookMessageAttachmentsInner>,
#[serde(rename = "sender")]
pub sender: Box<models::InboxWebhookMessageSender>,
#[serde(rename = "sentAt")]
pub sent_at: String,
#[serde(rename = "isRead")]
pub is_read: bool,
}
impl InboxWebhookMessage {
/// The message object included in inbox webhook payloads.
pub fn new(
id: String,
conversation_id: String,
platform: Platform,
platform_message_id: String,
direction: Direction,
text: Option<String>,
attachments: Vec<models::InboxWebhookMessageAttachmentsInner>,
sender: models::InboxWebhookMessageSender,
sent_at: String,
is_read: bool,
) -> InboxWebhookMessage {
InboxWebhookMessage {
id,
conversation_id,
platform,
platform_message_id,
direction,
text,
attachments,
sender: Box::new(sender),
sent_at,
is_read,
}
}
}
///
#[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,
#[serde(rename = "sms")]
Sms,
}
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
}
}