Crate openlibrary_rs
source · [−]Expand description
Wrapper for Openlibrary’s Web 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.
Books
You can view information about books by Works, Editions, and ISBN ids by using the books::Books
struct
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
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
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
use openlibrary_rs::search::SearchBuilder;
use openlibrary_rs::OpenlibraryRequest;
let search = SearchBuilder::default()
.query("the lord of the rings")
.build()
.unwrap();
println!("{:#?}", search.execute());
Modules
Traits
Trait representation of an Openlibrary request