A simple wrapper around the Goodreads public API written in pure Swift.
This is a very early version consisting of only a couple of features.
GoodreadsService is a Swift Package and can be added to a project by the help of the Swift Package Manager using the git link https://github.com/lazarevzubov/GoodreadsService.git
GoodreadsService
class is the one. It's created using only your own developer API key:
let key = "YOUR_DEVELOPER_KEY"
let service = GoodreadsService(key: key)
Books are represented by the Book
type values. They consist of:
id
– The string representing the Goodreads ID of the book.authors
– The string array of author full names.title
– The book title.imageURL
– The URL
of the book cover in small resolution or nil
if no cover found.similarBookIDs
– The string array of similar (recommended) books IDs.Books can be queried by a book title, an author name, or any part of either.
let query = "Harry Potter"
let bookIDs = await service.searchBooks(query)
The completion argument value returned is an array of book ID strings. If nothing is found or an error has occurred, the empty array is passed.
Book info can be retrieved using IDs returned by the search books query.
let bookID = "3"
let book = await service.getBook(by: bookID)
The completion argument value returned is a book with the specified ID. If no book with the ID found or an error has occurred, nil
is passed.
Code style guidelines shall be kept in mind.
link |
Stars: 0 |
Last commit: 6 weeks ago |
If a better image quality is available, it's saved to the Book.
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics