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 properties file
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.

import io.indico.Indico;
import io.indico.api.IndicoResult;

# option 1: pass to instantiation
String yourApiKey = "YOUR_API_KEY"
String yourPrivateCloud = "YOUR_SUBDOMAIN"
Indico indico = new Indico(yourApiKey, yourPrivateCloud);

# option 2: loading from a properties file
String filePath = "my/file.properties"
Indico indico = new Indico(new File(filePath));

IndicoResult results = indico.sentiment.predict("indico is so easy to use!");
Double sentiment = results.getSentiment();

System.out.println(sentiment);
// 0.9782025594088044