Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/erickzhao/gatsby-source-itchio

🕹 itch.io server-side API as a data source for GatsbyJS
https://github.com/erickzhao/gatsby-source-itchio

gamedev gatsby gatsby-source-plugin itchio javascript

Last synced: 16 days ago
JSON representation

🕹 itch.io server-side API as a data source for GatsbyJS

Awesome Lists containing this project

README

        

# gatsby-source-itchio

A source plugin for [GatsbyJS](https://www.gatsbyjs.org/) to query game information from the [itch.io](https://itch.io/) serverside API.

## Install

```
# npm
npm install --save gatsby-source-itchio

#yarn
yarn add gatsby-source-itchio
```

Then add the following to your `gatsby-config.js`:

```javascript
module.exports = {
/* ... */
plugins: [
/* ... */
{
resolve: "gatsby-source-itchio",
options: {
key: // YOUR_API_KEY
}
}
]
};
```

To use this plugin, you'll need a web API key for your itch.io account (get one [here](https://itch.io/user/settings/api-keys)).

## How to query

See [API documentation](https://itch.io/docs/api/serverside#reference/profilegames-httpsitchioapi1keymy-games) for the endpoint here.

```javascript
const gameQuery = `
query GameQuery {
allItchioGame(limit: 10) {
edges {
node {
user {
display_name,
id,
url,
cover_url,
username
},
id,
url,
created_at,
title,
classification,
type,
short_text,
published,
published_at,
views_count,
can_be_bought,
min_price,
purchases_count,
p_osx,
p_android,
p_linux,
p_windows,
in_press_system,
}
}
}
}
`;
```