README
GameBanana
Async API wrapper for Gamebanana, written for NodeJS.
Jump to
Installation
- With
npm
:npm install gamebanana
- With
yarn
:yarn add gamebanana
Quick-start
Import into your project:
const gb = require('gamebanana')
or with ES6 import/exports:
import gb from 'gamebanana'
Documentation
TODO (too lazy rn, just look at JSDocs for now)
Examples
Initializing a client
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
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
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
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
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
// 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!