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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
//! Wrapper for [Openlibrary's Web API](https://openlibrary.org/developers/api)
//!
//! # Overview
//!
//! **PLEASE NOTE**: this crate is currently in an experimental stage.
//! Meaning expect frequent, large breaking changes from version to version until we are in a stable state.
//!
//! There are currently 8 sub APIs offered by Openlibrary's Web API.
//! You can check the table below to see the status of each.
//!
//! - [X] [Books](https://openlibrary.org/dev/docs/api/books)
//! - [X] [Authors](https://openlibrary.org/dev/docs/api/authors)
//! - [ ] [Subjects](https://openlibrary.org/dev/docs/api/subjects)
//! - [X] [Search](https://openlibrary.org/dev/docs/api/search)
//! - [ ] [Search inside](https://openlibrary.org/dev/docs/api/search_inside)
//! - [ ] [Partner](https://openlibrary.org/dev/docs/api/read)
//! - [ ] [Covers](https://openlibrary.org/dev/docs/api/covers)
//! - [ ] [Recent Changes](https://openlibrary.org/dev/docs/api/recentchanges)
//!
//! # Books
//!
//! You can view information about books by Works, Editions, and ISBN ids by using the [`books::Books`] struct
//!
//! ``` rust
//! use openlibrary_rs::books::{BookType, BooksBuilder};
//! use openlibrary_rs::OpenlibraryRequest;
//!
//! let books = BooksBuilder::default()
//! .book_type(BookType::Works)
//! .id("OL45883W")
//! .build()
//! .unwrap();
//!
//! println!("{:#?}", books.execute());
//! ```
//!
//! You can view information about multiple books by using the [`books::BooksGeneric`] struct
//!
//! ``` rust
//! use openlibrary_rs::books::{BookType, BooksGenericBuilder};
//! use openlibrary_rs::OpenlibraryRequest;
//!
//! let books_generic = BooksGenericBuilder::default()
//! .bibkeys(vec![
//! "ISBN:0201558025".to_string(),
//! "LCCN:93005405".to_string(),
//! ])
//! .build()
//! .unwrap();
//!
//! println!("{:#?}", books_generic.execute());
//! ```
//!
//! # Authors
//!
//! You can view information about authors or their works by using the [`authors::Authors`] struct
//!
//! ``` rust
//! use openlibrary_rs::{authors::AuthorsBuilder, OpenlibraryRequest};
//!
//! let authors = AuthorsBuilder::default().id("OL23919A").build().unwrap();
//!
//! println!("{:#?}", authors.execute());
//! ```
//!
//! # Search
//!
//! You can search for books, authors, and more using the [`search::Search`] struct
//!
//! ``` rust
//! use openlibrary_rs::search::SearchBuilder;
//! use openlibrary_rs::OpenlibraryRequest;
//!
//! let search = SearchBuilder::default()
//! .query("the lord of the rings")
//! .build()
//! .unwrap();
//!
//! println!("{:#?}", search.execute());
//! ```
//!
use Url;
use Value;
const OPENLIBRARY_HOST: &str = "https://openlibrary.org";
/// Trait representation of an Openlibrary request