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
//! 
//! [![Build Status](https://travis-ci.org/Eonm/zotero.svg?branch=master)](https://travis-ci.org/Eonm/zotero)
//! [![Coverage Status](https://coveralls.io/repos/github/Eonm/zotero/badge.svg?branch=master)](https://coveralls.io/github/Eonm/zotero?branch=master)
//! [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
//! [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](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));
//! };
//! ```

mod api_error_parser;
mod api_request;
mod consts;
mod zotero_api;

pub mod data_structure;
pub use api_request::delete::Delete;
pub use api_request::get::Get;
pub use api_request::patch::Patch;
pub use api_request::post::Post;
pub use zotero_api::{Zotero, ZoteroInit};