npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

exoplay-node-sdk

v0.2.0

Published

sdk for accessing exoplay apis

Readme

exoplay-node-sdk

A library for interacting with the exoplay API over javscript. Works with both node and client-side javascript.

Installation

Usage

The Exoplay API is highly RESTful, and therefore predictable.

  • GET gets data based on a query. Most data fields on a resource type are queryable (refer to exoplay.net API documentaion for exceptions)
  • POST posts new data to a resource type
  • PUT replaces data at a given ID
  • PATCH merges data changes at a given ID
  • DELETE deletes data matching a query or ID

Basic example:

var ExoplayAPI = require('exoplay-node-sdk');
var gameId = 'myawesomegame';

function handleError(error) {
  console.log(error.statusCode, error.message);
}

exoplayAPI = new ExoplayAPI('myawesomegame', {
  origin: 'https://api.exoplay.net', // optional, defaults to exoplay production url
  defaultErrorHandler: handleError // optional, catches API errors
});

// get the token from oauth, and use it below.
var token = session.get('token'); 

// Format: <api instance>.<api>.<method>([... destructuring paramaters], query);
// Returns: promise, which evaluates to (meta, data)
// Meta is information from the headers, shuch as an updated oauth token
// Data is the raw data from the API

// Get scope information for users who have an "owner" or "manager" role
// attached to the "clan" resource of id "theAwesomeClan"

exoplayAPI.withAuth(token).scopes.get('clan', 'theAwesomeClan', {
    role: ['owner', 'manager']
  })
  .then(function(meta, scopes) {
    console.log('There are ' + scopes.length + ' owners or managers.');
  })

/* ---------------------------------------------------------------------------
Note: you can clean up the code a bit, if your execution path is safe. But, if
you're doing async work on a web server and you're not careful about where your
token is coming from, you could accidentally serve requests with the wrong
token, which is very bad. Watch your async flows!

As a benefit, if `meta` contains an updated `token`, your token will be
automatically applied to the next new request.
*/

var myAPI = exoplayAPI.withAuth(token);
myAPI.scopes.get(...);
myAPI.scopes.patch(...);
/* -------------------------------------------------------------------------- */


// Add the "manager" role to the user "ajacksified" for the "clan" resource
// of id "theAwesomeClan"

exoplayAPI.withAuth(token).scopes.put('clan', 'theAwesomeClan', 'ajacksified', 'manager')
  .then(function(meta, scopes) {
    console.log('Updated self, and got a new token', meta.token);
    token = meta.token;
  })
  // supply a custom error handling function instead of using the default
  .catch(function(error) {
    if (error.statusCode === 403) {
      console.log('You do not have permissions for that!');
    }
  });


// Add the "manager" and "owner" roles to the user "ajacksified" for the "clan"
// resource of id "theAwesomeClan"

exoplayAPI.withAuth(token).scopes.post('clan', 'theAwesomeClan', 'ajacksified' {
    scope: ['owner', 'manager']
  })
  .then(function(res) {})


// Replace the roles of the user "ajacksified" for the "clan" resource of id
// "theAwesomeClan" with ['owner, manager']

exoplayAPI.withAuth(token).scopes.put('clan', 'theAwesomeClan', 'ajacksified' {
    scope: ['owner', 'manager']
  })
  .then(function(res) {})


// Delete a role from the user "ajacksified" for the "clan" resource of id
// "theAwesomeClan"

exoplayAPI.withAuth(token).scopes.del('clan', 'theAwesomeClan', 'ajacksified', 'owner')
  .then(function(res) {})


// Delete all roles from the user "ajacksified" for the "clan" resource of id
// "theAwesomeClan"

exoplayAPI.withAuth(token).scopes.del('clan', 'theAwesomeClan', 'ajacksified')
  .then(function(res) {})

// Delete all roles from the user "ajacksified" and "doriangray" for the "clan"
// resource of id "theAwesomeClan"

exoplayAPI.withAuth(token).scopes.del('clan', 'theAwesomeClan', {
    userId: [ 'ajacksified', 'doriangray' ]
  })
  .then(function(res) {})

Per-endpoint documentation is available in ./docs.

Development

  • Read the contribution guide and browse existing issues and PRs for similar changes or issues. If in doubt, create an issue before writing code. The contribution guide contains guidelines for code standards and git flow.
  • Fork this repository
  • Install node (v0.10+)
  • Make changes, and add or modify tests where necessary. Run tests using npm test, which runs mocha.
  • Create a pull request

License

Copyright 2016 Exoplay, LLC. GPLv3 Licensed. Free for personal or commercial use. See LICENSE for details.