Skip to content

A browser and node library for interfacing with the Game Jolt game API.

License

Notifications You must be signed in to change notification settings

ttbowen/joltite.js

Repository files navigation

joltite.js

tests @latest npm bundle size

joltite.js is a library for browsers & node that allows you to easily interact with the Game Jolt API.

This library supports version 1.2 of the Game Jolt API and implements user authentication, sessions, scores, trophies, data storage and more.

Table of Contents

Installing

Using npm:

$ npm install joltite.js

Using yarn:

$ yarn add joltite.js

Using unpkg CDN:

<script src="https://unpkg.com/[email protected]/dist/joltite.min.js"></script>

Usage

First you need to create a new GameJolt instance:

import { GameJolt } from 'joltite.js';

const api = new GameJolt({ gameId, privateKey });

Then you can call the API endpoints. Below is an example of score fetching:

const response = await api.scores.fetch();
if (response.success) {
  console.log(response.scores);
}

Some endpoints require an authenticated user. Below is an example of user authentication:

const response = await api.login({ username, token });

if (response.success) {
  // Successfully logged in.
}

Documentation

The documentation for this library can be found here

Contributing

Feel free to dive in! Open an issue or submit PRs.

This project follows the Contributor Covenant Code of Conduct.

License

MIT © Thomas Bowen