1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//! # Zotero
//!
//! [](https://travis-ci.org/Eonm/zotero)
//! [](https://coveralls.io/github/Eonm/zotero?branch=master)
//! [](https://opensource.org/licenses/MIT)
//! [](https://github.com/Eonm/zotero/issues)
//!
//! [API documentation](https://docs.rs/zotero/)
//!
//! ## Creating items and collections
//!
//! ```no_run
//! extern crate zotero;
//!
//! use zotero::ZoteroInit;
//! use zotero::Post;
//! use zotero::data_structure::item::{BookData, BookDataBuilder, Creator, CreatorBuilder};
//!
//! let z = ZoteroInit::set_user("123456789", "bZARysJ579K5SdmYuaAJ");
//!
//! let creators : Vec<Creator> = vec![
//! CreatorBuilder::default()
//! .creator_type("author")
//! .first_name("John")
//! .last_name("Doe")
//! .build()
//! .unwrap()
//! ];
//!
//! let new_book : BookData = BookDataBuilder::default()
//! .title("Sample_2")
//! .creators(creators)
//! .item_type("book")
//! .build()
//! .unwrap();
//!
//! z.create_new_item(new_book);
//! ```
//!
//! ## Updating items and collections
//!
//! ```no_run
//! extern crate zotero;
//!
//! use zotero::ZoteroInit;
//! use zotero::Patch;
//! use zotero::Get;
//! use zotero::data_structure::item::ItemType;
//!
//! let z = ZoteroInit::set_user("123456789", "bZARysJ579K5SdmYuaAJ");
//! let item = z.get_item("Q8GNE36F", None);
//! if let Ok(mut result) = item {
//! if let ItemType::Book(bookdata) = &mut result.data {
//! bookdata.title = "A new title".to_string();
//! bookdata.publisher = "A new publisher".to_string();
//! z.update_item(&bookdata.key, &bookdata);
//! };
//!
//! println!("{:?}", serde_json::to_string(&result.data));
//! };
//! ```
pub use Delete;
pub use Get;
pub use Patch;
pub use Post;
pub use ;