https://github.com/spikehd/gamebanana
Game Banana API wrapper for NodeJS
https://github.com/spikehd/gamebanana
Last synced: 11 months ago
JSON representation
Game Banana API wrapper for NodeJS
- Host: GitHub
- URL: https://github.com/spikehd/gamebanana
- Owner: SpikeHD
- Created: 2021-03-25T06:26:54.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-04-02T06:48:32.000Z (about 5 years ago)
- Last Synced: 2025-07-21T15:05:20.334Z (11 months ago)
- Language: JavaScript
- Size: 43 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GameBanana
Async API wrapper for Gamebanana, written for NodeJS.
  
## Jump to
* [Installation](#installation)
* [Quick-start](#quick-start)
* [Documentation](#documentation)
* [Examples](#examples)
* [Contributing](#contributing)
# Installation
* With `npm`:
```sh
npm install gamebanana
```
* With `yarn`:
```sh
yarn add gamebanana
```
# Quick-start
Import into your project:
```js
const gb = require('gamebanana')
```
or with ES6 import/exports:
```js
import gb from 'gamebanana'
```
# Documentation
TODO (too lazy rn, just look at JSDocs for now)
# Examples
### Initializing a client
```js
const { Client } = require('gamebanana')
// Without an API key, since it's not required
const client = new Client()
// With an API key n' stuff (for client.login())
const client = new Client({
api_key: 'myapikey',
userid: 'myuserid',
appid: 'myappid'
})
```
### Initializing an Item
```js
const item = await client.Item.getItem({
itemtype: 'type',
itemid: 'id',
fields: ['fields']
})
// OR with the class directly
const { Item } = require('gamebanana')
const item = new Item({
itemtype: 'type',
itemid: 'id',
fields: ['fields']
})
const data = await item.data()
```
### Initializing a List query
```js
const list = await client.List.list({
itemtype: 'type',
field: 'field',
query: 'searchquery'
})
// OR with the class directly
const { List } = require('gamebanana')
const list = new List({
itemtype: 'type',
field: 'field',
query: 'searchquery'
})
const results = await list.data()
```
### Initializing a Section query
```js
const section = await client.Section.list({
itemtype: 'type',
sort: 'sort',
direction: 'desc',
page: 1
})
// OR with the class directly
const { Section } = require('gamebanana')
const section = new Section({
itemtype: 'type',
sort: 'sort',
direction: 'desc',
page: 1
})
const results = await section.data()
```
### Initializing a NewItems submissions query
```js
const submissions = await client.NewItems.getNewItems({
page: 1
})
// OR with the class directly
const { NewItems } = require('gamebanana')
const submissions = new NewItems({
page: 1
})
const results = await submissions.data()
```
### Initializing a Member
```js
// Via ID
const member = await client.Member.findByID({
userid: 1
})
// Via username
const member = await client.Member.findByName({
username: 'myuser'
})
// OR with the class directly
const { Member } = require('gamebanana')
// With ID
const member = new Member({
userid: 1
})
// With username
const member = new Member({
username: 'myuser'
})
const results = await member.find()
```
# Contributing
Issues, PRs, etc. are all welcome!