pipedrive_rs/models/
receive_message_request.rs

1/*
2 * Pipedrive API v1
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.0.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12
13
14#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
15pub struct ReceiveMessageRequest {
16    /// The ID of the message
17    #[serde(rename = "id")]
18    pub id: String,
19    /// The channel ID as in the provider
20    #[serde(rename = "channel_id")]
21    pub channel_id: String,
22    /// The ID of the provider's user that sent the message
23    #[serde(rename = "sender_id")]
24    pub sender_id: String,
25    /// The ID of the conversation
26    #[serde(rename = "conversation_id")]
27    pub conversation_id: String,
28    /// The body of the message
29    #[serde(rename = "message")]
30    pub message: String,
31    /// The status of the message
32    #[serde(rename = "status")]
33    pub status: Status,
34    /// The date and time when the message was created in the provider, in UTC. Format: YYYY-MM-DD HH:MM
35    #[serde(rename = "created_at")]
36    pub created_at: String,
37    /// The date and time when the message can no longer receive a reply, in UTC. Format: YYYY-MM-DD HH:MM
38    #[serde(rename = "reply_by", skip_serializing_if = "Option::is_none")]
39    pub reply_by: Option<String>,
40    /// A URL that can open the conversation in the provider's side
41    #[serde(rename = "conversation_link", skip_serializing_if = "Option::is_none")]
42    pub conversation_link: Option<String>,
43    /// The list of attachments available in the message
44    #[serde(rename = "attachments", skip_serializing_if = "Option::is_none")]
45    pub attachments: Option<Vec<crate::models::ReceiveMessageRequestAttachmentsInner>>,
46}
47
48impl ReceiveMessageRequest {
49    pub fn new(id: String, channel_id: String, sender_id: String, conversation_id: String, message: String, status: Status, created_at: String) -> ReceiveMessageRequest {
50        ReceiveMessageRequest {
51            id,
52            channel_id,
53            sender_id,
54            conversation_id,
55            message,
56            status,
57            created_at,
58            reply_by: None,
59            conversation_link: None,
60            attachments: None,
61        }
62    }
63}
64
65/// The status of the message
66#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
67pub enum Status {
68    #[serde(rename = "sent")]
69    Sent,
70    #[serde(rename = "delivered")]
71    Delivered,
72    #[serde(rename = "read")]
73    Read,
74    #[serde(rename = "failed")]
75    Failed,
76}
77
78impl Default for Status {
79    fn default() -> Status {
80        Self::Sent
81    }
82}
83