Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

challonge-js

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

challonge-js

Wrapper for the challonge api.

  • 1.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

##Usage

###Get all tournaments on your account

const challonge = require('./node-challonge');
const client = challonge.createClient({
  apiKey: '<yourApiKey>'
});

client.tournaments.index({
  callback: function (error, data) {
    if (error) { console.log(error); return; }
    console.log(data);
  }
});

###Create a tournament

const challonge = require('./node-challonge');
const client = challonge.createClient({
  apiKey: '<yourApiKey>'
});

client.tournaments.create({
  tournament: {
    name: 'new_tournament_name',
    url: 'new_tournament_url',
    tournamentType: 'single elimination'
  },
  callback: function (error, data) {
    if (error) { console.log(error); return; }
    console.log(data);
  }
});

##API Client

createClient takes one argument for configuration and returns an instance of the api client. The configuration object can contain the following options:

  • apiKey string (required) - Your challonge API Key

  • subdomain string (optional) - Setting the subdomain automatically passes tournament[subdomain] and prefixes the subdomain to tournament urls. If you don't want to pass a subdomain to the constructor, and want to use an organization (or multiple organizations), you must use client.setSubdomain('subdomain') before making api calls.

  • format string (optional) - The format of the response data. Defaults to 'json'. If set to 'json', will return javascript objects. 'xml' will return the raw text string.

  • massageProperties boolean (optional) - If the response object should be massaged into camelCase properties when using json format. Defaults to true.

The wrapper is organized into resource.method to match the API

For API calls that require nested params (eg: http://api.challonge.com/v1/documents/tournaments/create) properties should be specified as a nested object:

{
	tournament: {
		name: 'new_tournament_name',
		url: 'new_tournament_url',
		tournamentType: 'single elimination'
	},
	callback: function (error, data) {}
}

All properties can be specified camelCase instead of using under_scores Both of the following are valid:

tournament: { tournamentType: 'single elimination' }
tournament: { tournament_type: 'single elimination' }

##TODO

  1. validate required params
  2. docs
  3. tests

##Bugs in the API / docs

Some minor gatchas:


The structure of this api wrapper is ripped off from https://github.com/nodejitsu/nodejitsu-api
This repository was forked from https://github.com/Tidwell/node-challonge

Keywords

FAQs

Package last updated on 17 Dec 2016

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc