Programming Language-specific syntax

Passing as a function argument
In addition to the methods above, our client libraries each support passing in settings as function arguments. See the code example below for details.

Using a module variable
This method allows you to specify your API key a single time within a program or once per interpreter session by defining the module variable. This method eliminates the need to specify your API key or private cloud address more than one time and can help keep your code more readable.

var indico = require('indico.io');

# option 1: pass configuration as a function argument
var settings = {"api_key": "YOUR_API_KEY"};
var results = indico.sentiment('indico is so easy to use!', settings)

# option 2: set module variable
indico.apiKey = "YOUR_API_KEY";
var results = indico.sentiment('indico is so easy to use!')

var response = function(res) { console.log(res); }
var logError = function(err) { console.log(err); }

results.then(response).catch(logError);
// 0.9782025594088044