Commit 0d1be892 authored by Aaron Tidwell's avatar Aaron Tidwell

add contributors and repository info to package. Update readme

parent f75aa593
......@@ -4,6 +4,25 @@
"author": "Aaron Tiwell <aaron.tidwell@gmail.com>",
"main": "./lib/challonge.js",
"version": "1.0.0",
"contributors": [
{
"name": "Ricardo Reis",
"email": "ricardojoaoreis@gmail.com"
},
{
"name": "Jonas Vanen",
"email": "jonas.vanen@gmail.com"
}
],
"repository": {
"type": "git",
"url": "https://github.com/Tidwell/node-challonge"
},
"keywords": [
"challonge",
"api-wrapper",
"wrapper"
],
"dependencies": {
},
"devDependencies": {
......
##Usage
## Usage
###Get all tournaments on your account
### Get all tournaments on your account
```
var challonge = require('./node-challonge');
......@@ -19,7 +19,7 @@ client.tournaments.index({
```
###Create a tournament
### Create a tournament
```
var challonge = require('./node-challonge');
......@@ -42,7 +42,7 @@ client.tournaments.create({
});
```
##API Client
## API Client
_createClient_ takes one argument for configuration and returns an instance of the api client. The configuration object can contain the following options:
......@@ -76,22 +76,18 @@ tournament: { tournamentType: 'single elimination' }
tournament: { tournament_type: 'single elimination' }
```
##TODO
## TODO
1. validate required params
2. docs
3. tests
##Bugs in the API / docs
## Bugs in the API / docs
Some minor gatchas:
* server 500s if trying to finalize() a tournament that has not yet been start()ed
* http://api.challonge.com/v1/documents/participants/create shows participant_id as a required field when the server does not respect passing it, and is not required.
* http://api.challonge.com/v1/documents/participants/randomize shows participant_id as a required field when the server does not respect passing it, and is not required.
---
The structure of this api wrapper is ripped off from https://github.com/nodejitsu/nodejitsu-api
\ No newline at end of file
The structure of this api wrapper is ripped off from https://github.com/nodejitsu/nodejitsu-api
var challonge = require('./../');
var client = challonge.createClient({
apiKey: require('./../key.js').challonge,
format: 'json',
version: 1,
});
var tourneyName = 'mytesttournament' + Math.floor(Math.random()*10000);
client.tournaments.create({
tournament: {
name: 'name-'+tourneyName,
url: tourneyName,
signupCap: 8,
tournamentType: 'single elimination',
},
callback: function(err,data){
if (err) { console.log(err); return; }
console.log(data);
pcreate('player1');
}
});
function pcreate(name) {
client.participants.create({
id: tourneyName,
participant: {
name: name
},
callback: function(err,data){
if (err) { console.log(err); return; }
console.log(data);
if (name === 'player1') {
pcreate('player2');
} else {
start();
}
}
});
}
function start() {
client.tournaments.start({
id: tourneyName,
callback: function(err,data){
if (err) { console.log(err); return; }
console.log(data);
mindex();
}
});
}
function mindex() {
client.matches.index({
id: tourneyName,
callback: function(err,data){
if (err) { console.log(err); return; }
mupdate(data[0].match.id, data[0].match.player1Id);
}
});
}
function mupdate(matchId, winnerId) {
client.matches.update({
id: tourneyName,
matchId: matchId,
match: {
scoresCsv: '3-0',
winnerId: winnerId
},
callback: function(err,data){
if (err) { console.log(err); return; }
console.log(data);
}
});
}
var challonge = require('./../');
var client = challonge.createClient({
apiKey: require('./../key.js'),
apiKey: require('./../key.js').challonge,
format: 'json',
version: 1,
});
var tourneyName = 'nodeapite3stcamel';
var tourneyName = 'nodeapite3stcamel24333341111';
function index() {
client.tournaments.index({
......@@ -203,7 +203,7 @@ function mupdate() {
//index();
//client.setSubdomain('nodeapitest');
client.setSubdomain('nodeapitest');
create();
//show();
//update();
......@@ -222,4 +222,4 @@ create();
//mindex();
//mshow();
//mupdate();
\ No newline at end of file
//mupdate();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment