wallabag_api/types/
new_entry.rs1use chrono::{DateTime, Utc};
5
6use serde::{Deserialize, Serialize};
7
8use crate::utils::serde::bool_to_int;
9
10#[derive(Deserialize, Serialize, Debug)]
15pub struct NewEntry {
16 pub url: String,
17 pub title: Option<String>,
18
19 pub tags: Option<Vec<String>>,
22
23 #[serde(serialize_with = "bool_to_int")]
24 pub archive: Option<bool>,
25 #[serde(serialize_with = "bool_to_int")]
26 pub starred: Option<bool>,
27 #[serde(serialize_with = "bool_to_int")]
28 pub public: Option<bool>,
29
30 pub content: Option<String>,
31 pub language: Option<String>,
32 pub preview_picture: Option<String>,
33 pub published_at: Option<DateTime<Utc>>,
34
35 pub authors: Option<String>,
37
38 pub origin_url: Option<String>,
39}
40
41impl NewEntry {
42 pub fn new_with_url(url: String) -> Self {
45 Self {
46 url,
47 title: None,
48 tags: None,
49 archive: None,
50 starred: None,
51 content: None,
52 language: None,
53 preview_picture: None,
54 published_at: None,
55 authors: None,
56 public: None,
57 origin_url: None,
58 }
59 }
60}