whatsapp_cloud_api/models/
image_message.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Clone, Debug, Serialize, Deserialize)]
4pub struct Image {
5    link: Option<String>,
6    id: Option<String>,
7    caption: Option<String>,
8}
9
10impl Image {
11    pub fn new(link: &str, caption: Option<String>) -> Self {
12        Self {
13            link: Some(link.into()),
14            id: None,
15            caption,
16        }
17    }
18
19    pub fn for_id(id: &str, caption: Option<String>) -> Self {
20        Self {
21            link: None,
22            id: Some(id.into()),
23            caption,
24        }
25    }
26}