new Client(options)
- Source:
Constructor function for the Client base responsible for communicating with Challonge API
createClient takes one argument for configuration and returns an instance of the api client.
You should never need to call new Client(). Instead, call challonge.createClient() and it will create
a new instance and set defaults.
Example
const challonge = require('challonge');
const client = challonge.createClient({
apiKey: '***yourAPIKey***'
});
Parameters:
Name |
Type |
Description |
options |
object
|
configuration options for this instance
Properties
Name |
Type |
Attributes |
Description |
apiKey |
string
|
|
Your challonge API Key |
subdomain |
string
|
<optional>
|
Sets the subdomain and 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. Anything else (including 'xml') will return the raw text string. |
timeout |
number
|
<optional>
|
Duration in ms to wait for a timeout, passed to https request as timeout option |
massageProperties |
boolean
|
<optional>
|
If the response object should be massaged into camelCase properties when using json format. Defaults to true. |
|