1use chrono;
2use serde::{Deserialize, Serialize};
3
4#[derive(
5 Serialize,
6 Deserialize,
7 Debug,
8 Clone,
9 PartialEq,
10)]
11pub struct Block {
12 #[serde(rename(deserialize = "type"))]
13 pub value_type: String,
14 pub value: String
15}
16
17impl Block {
18 pub fn to_string(self) -> String {
19 self.value.to_string()
20 }
21
22 pub fn to_timestamp(self) -> chrono::NaiveDateTime {
23 chrono::NaiveDateTime::parse_from_str(&self.to_string(), "%Y-%m-%dT%H:%M:%S%.f").expect("Failed parse datetime")
24 }
25}