@balsick/gatsby-source-goodreads
v0.3.4
Published
Get the public shelves and books for a Goodreads user for use in Gatsby.
Downloads
4
Maintainers
Readme
gatsby-source-goodreads
Source plugin for pulling your shelved books into Gatsby from Goodreads API.
How to use
Install the plugin
npm i @balsick/gatsby-source-goodreads
Then configure the plugin in gatsby-config.js
// In your gatsby-config.js
module.exports = {
plugins: [
{
resolve: "@balsick/gatsby-source-goodreads",
options: {
developerKey: "IAmDeveloperKey",
goodReadsUserId: "IAmGoodreadsUserId",
userShelf: "to-read" //optional
userShelves: ['to-read','currently-reading','custom-shelf',...] //optional
}
}
],
}
Plugin options
- developerKey: Use your Goodreads developer API key
- goodReadsUserId: The Goodreads user ID of the user to get data for.
- userShelf: OPTIONAL. read, currently-reading, to-read, etc.
- userShelves: OPTIONAL. An array containing the names of the shelves to query.
If neither userShelf nor userShelves are set, all the user shelves are queried.
How to query your Goodread data using GraphQL
Below is a sample query for fetching the shelf's books.
query goodRead {
goodreadsShelves {
goodreadsShelf {
shelfName
reviews {
book {
title
smallImageUrl
link
description
}
dateAdded
rating
}
}
}
}
You can query all the set shelves, some shelves only or a single shelf. For querying a single shelf, a query like this can be used.
query goodRead {
goodreadsShelf(shelfName: {eq: "to-read"}) {
shelfName
reviews {
reviewID
rating
votes
spoilerFlag
spoilersState
dateAdded
dateUpdated
book {
bookID
}
}
}
}