bspradling / open-library Goto Github PK
View Code? Open in Web Editor NEWA Rust API client to interact with the Open Library API
License: MIT License
A Rust API client to interact with the Open Library API
License: MIT License
Need to have a user session in order to retrieve session information like Reading Log and Lists
By default, Reading Logs are public which doesn't make authentication required. However, users are able to change that setting.
In order to access private information programmatically, it's possible to log in via /account/login
with your username and password. This hands back a cookie to use in subsequent requests.
The DateTime fields that appear across the OpenLibrary responses are extremely inconsistent. Figure out the best way to handle the unknown formats.
It's useful to have a GUI to play around with the API while in development of the client. It would be worth sharing, if completed.
Once you have the identifier key of an author of interest, e.g. /authors/OL23919A, you can fetch their complete data by visiting their Author page as .json, .rdf, .yml:
Within the Open Library Reading Log, there are three subsections (Currently Reading
, Want to Read
, and Already Read
) which need to be retrievable via the client.
These are public by default but changeable in the settings which would be dependent on #3 to retrieve.
Endpoint: https://openlibrary.org/people/{{ _.username }}/books/already-read.json
Currently there is limited testing and it would be nice if there was a layer of unit tests that leverages wiremock
. While we could use the public APIs, we don't need to spam them until the master
branch.
A Work is a logical collection of similar Editions. "Fantastic Mr. Fox" could be a Work which contains a Spanish translation edition, or perhaps a 2nd edition which has an additional chapter or corrections. Work metadata will include general umbrella information about a book, whereas an Edition will have a publisher, an ISBN, a book-jacket, and other specific information.
Both Work and Edition pages on Open Library (i.e. the pages you navigate to) may also be returned as json or yml (in addition to HTML) by modifying the page URL.
Work pages are available on /works
.
https://openlibrary.org/authors/OL23919A/works.json
The above URL will return 50 works by an author.
You can append ?limit=1000 to return the first 1000 works by an author like so:
https://openlibrary.org/authors/OL1394244A/works.json?limit=100If you want to paginate, you can set offset like so:
https://openlibrary.org/authors/OL1394244A/works.json?offset=50
A Work is a logical collection of similar Editions. "Fantastic Mr. Fox" could be a Work which contains a Spanish translation edition, or perhaps a 2nd edition which has an additional chapter or corrections. Work metadata will include general umbrella information about a book, whereas an Edition will have a publisher, an ISBN, a book-jacket, and other specific information.
Both Work and Edition pages on Open Library (i.e. the pages you navigate to) may also be returned as json or yml (in addition to HTML) by modifying the page URL.
The Edition pages are available on /books
.
Right now the release process is manual via cargo release
, it would be nice to automatically release with every new merge into main
and increment the version automatically based on the information contained in the commits or PR directly.
A Pull Request template should be introduced to ensure that the information is contained there.
You can retrieve the currently reading on https://openlibrary.org/people/{username}/books/currently-reading.json.
By default, Reading Logs are public which doesn't make authentication required. However, users are able to change that setting.
In order to access private information programmatically, it's possible to log in via /account/login with your username and password. This hands back a cookie to use in subsequent requests. This would be dependent on #3
Some of the original APIs added tended to rewrite a lot of the same API functionality and error handling. As of #37, there is a more generic GET request implementation that could be adopted around the repository.
Leverage GitHub Actions to build and unit test the code. This should be required to succeed before merging.
Currently the README is still empty. It would be nice to have some walkthroughs on how to use, etc. It should be noted that this is an opinionated client at times.
Right now the release process is manual via cargo release
, it would be nice to automatically release with every new merge into main
and increment the version automatically based on the information contained in the commits or PR directly.
A Pull Request template should be introduced to ensure that the information is contained there.
The master
build should and release the newest version of the package to crates.io
You can retrieve the want to read list on https://openlibrary.org/people/{username}/books/want-to-read.json
.
By default, Reading Logs are public which doesn't make authentication required. However, users are able to change that setting.
In order to access private information programmatically, it's possible to log in via /account/login
with your username and password. This hands back a cookie to use in subsequent requests. This would be dependent on #3
You can search for authors using the https://openlibrary.org/search/authors.json search API which accepts q as a query parameter.
Often nice to include an example on how someone would use the client. Should include a small example, under examples
at the root of the repository.
Original implementation thought that BookIdentifier could be the sole way to identify a Book. Now understanding the API more, that's not the case. We should refactor the existing implementation into something more specific to Book Search endpoint and think about a more broader generic Identifier struct.
The ISBN API is a special case and alternative approach to arriving at an Editions page. Instead of "/books", a path of "/isbn" is used, followed by a valid ISBN 10 or 13.
Regardless if the Reading Log endpoints return an error, the status code is always 200.
If the user is not authorized to view the private Reading Log, the following response body will be returned:
{
"error": "Shelf want-to-read not found or not accessible"
}
If it is a valid authenticated request:
{
"page": 1,
"reading_log_entries": [
{
"work": {
"title": "Atomic Habits",
"key": "/works/OL17930368W",
"author_keys": [
"/authors/OL7422948A"
],
"author_names": [
"James Clear"
],
"first_publish_year": 2018,
"lending_edition_s": null,
"edition_key": [
"OL32336498M",
"OL27918581M",
"OL26502528M",
"OL31936190M",
"OL30515574M",
"OL30515575M",
"OL31844060M"
],
"cover_id": null,
"cover_edition_key": "OL32336498M"
},
"logged_edition": "/books/OL32336498M",
"logged_date": "2021/09/06, 00:44:47"
}
]
}
https://github.com/serde-rs/json/issues/181
There have been new iterations of identifier implementations that have popped up as we learn more about the overall API. We should consolidate these as possible.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.