Swiftpack.co - lazarevzubov/GoodreadsService as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by lazarevzubov.
lazarevzubov/GoodreadsService 1.0.0
Goodreads API Swift Package wrapper
⭐️ 0
🕓 6 weeks ago
iOS macOS watchOS
.package(url: "https://github.com/lazarevzubov/GoodreadsService.git", from: "1.0.0")

GoodreadsService

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.

Setting Up

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

Usage

Initializing Entry Point

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

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.

Searching Books

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.

Getting Book Info

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.

For Contributors

Code style guidelines shall be kept in mind.

GitHub

link
Stars: 0
Last commit: 6 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

Image Quality Improvement
2 years 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