use serde::Serialize;
#[derive(Serialize, Debug)]
pub struct Attachment {
content: String,
#[serde(rename = "type")]
a_type: Option<String>,
filename: String,
disposition: Option<String>,
content_id: Option<String>,
}
pub struct AttachmentBuilder {
attachment: Attachment,
}
impl AttachmentBuilder {
pub fn new<S: Into<String>>(content: S, filename: S) -> Self {
AttachmentBuilder {
attachment: Attachment {
content: content.into(),
a_type: None,
filename: filename.into(),
disposition: None,
content_id: None,
},
}
}
pub fn attachment_type(mut self, t: impl Into<String>) -> Self {
self.attachment.a_type = Some(t.into());
self
}
pub fn disposition(mut self, disposition: impl Into<String>) -> Self {
self.attachment.disposition = Some(disposition.into());
self
}
pub fn content_id(mut self, id: impl Into<String>) -> Self {
self.attachment.content_id = Some(id.into());
self
}
pub fn build(self) -> Attachment {
self.attachment
}
}