summaryrefslogtreecommitdiffstats
path: root/src/types/payload.rs
blob: e6ddb0fac430e86f84956e961344d5ab8ed0a8d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use crate::types::DateTime;

#[derive(Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize, getset::Getters)]
pub struct Payload {
    // TODO: Make this a mime::Mime, but as this type does not impl Serialize/Deserialize, we
    // cannot do this trivially yet
    #[getset(get = "pub")]
    mime: String,

    #[getset(get = "pub")]
    timestamp: DateTime,

    #[getset(get = "pub")]
    content: crate::cid::Cid,
}

impl Payload {
    pub fn new(mime: String, timestamp: DateTime, content: crate::cid::Cid) -> Self {
        Self { mime, timestamp, content }
    }
}