Add ID type for attachments
This commit is contained in:
parent
547d994d13
commit
9f4327f546
|
@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
|
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
|
||||||
pub struct Attachment {
|
pub struct Attachment {
|
||||||
/// ID of the attachment.
|
/// ID of the attachment.
|
||||||
pub id: String,
|
pub id: AttachmentId,
|
||||||
/// The media type of an attachment.
|
/// The media type of an attachment.
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
pub media_type: MediaType,
|
pub media_type: MediaType,
|
||||||
|
@ -24,6 +24,16 @@ pub struct Attachment {
|
||||||
/// Noop will be removed.
|
/// Noop will be removed.
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
}
|
}
|
||||||
|
/// Wrapper type for a attachment ID string
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||||
|
#[serde(transparent)]
|
||||||
|
pub struct AttachmentId(String);
|
||||||
|
|
||||||
|
impl AsRef<str> for AttachmentId {
|
||||||
|
fn as_ref(&self) -> &str {
|
||||||
|
&self.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Information about the attachment itself.
|
/// Information about the attachment itself.
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
|
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
|
||||||
|
|
Loading…
Reference in New Issue