zotero/data_structure/item/item_data/
note.rs

1use serde::Deserialize;
2use serde::Serialize;
3use std::collections::HashMap;
4
5use derive_builder::Builder;
6
7/// A standalone note. Notes can be used for organizing and annotating in Zotero. If you cite a standalone note, Zotero will use the first 120 characters as the item title (and will treat the note as an author-less and date-less item). Citing notes is not a reliable way to add standalone commentary to a bibliography or reference list.
8#[derive(Default, Deserialize, Serialize, Clone, Debug, Builder)]
9#[serde(rename_all(deserialize = "camelCase", serialize = "camelCase"))]
10#[builder(setter(into), default)]
11pub struct NoteData {
12    #[serde(skip_serializing_if = "String::is_empty", default)]
13    pub key: String,
14    #[builder(setter(skip))]
15    pub version: usize,
16    #[serde(skip_serializing_if = "String::is_empty", default)]
17    pub parent_item: String,
18    #[builder(setter(skip))]
19    #[serde(default = "default_document_type")]
20    pub item_type: String,
21    #[serde(skip_serializing_if = "String::is_empty", default)]
22    pub note: String,
23    pub tags: Vec<String>,
24    pub relations: HashMap<String, String>,
25    #[serde(skip_serializing)]
26    pub date_added: String,
27    #[serde(skip_serializing)]
28    pub date_modified: String,
29}
30
31fn default_document_type() -> String {
32    "note".to_string()
33}
34
35use crate::data_structure::ToJson;
36impl ToJson for NoteData {}