
Security News
PEP 810 Proposes Explicit Lazy Imports for Python 3.15
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
exoplay-node-sdk
Advanced tools
A library for interacting with the exoplay API over javscript. Works with both node and client-side javascript.
The Exoplay API is highly RESTful, and therefore predictable.
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.
npm test
, which runs mocha.Copyright 2016 Exoplay, LLC. GPLv3 Licensed. Free for personal or commercial use. See LICENSE for details.
FAQs
sdk for accessing exoplay apis
We found that exoplay-node-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.