Package com.algorithmia.algo
Class Algorithm
- java.lang.Object
-
- com.algorithmia.algo.Algorithm
-
public final class Algorithm extends java.lang.Object
Represents an Algorithmia algorithm that can be called.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Algorithm.AlgorithmOptions
static class
Algorithm.AlgorithmOutputType
-
Constructor Summary
Constructors Constructor Description Algorithm(HttpClient client, AlgorithmRef algoRef)
Algorithm(HttpClient client, AlgorithmRef algoRef, java.util.Map<java.lang.String,java.lang.String> options)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Long
getTimeout()
AlgoResponse
pipe(java.lang.Object input)
Calls the Algorithmia API for a given input.FutureAlgoResponse
pipeAsync(java.lang.Object input)
Calls the Algorithmia API asynchronously for a given input.AlgoResponse
pipeJson(java.lang.String inputJson)
Calls the Algorithmia API for given input that will be treated as JSONFutureAlgoResponse
pipeJsonAsync(java.lang.String inputJson)
Calls the Algorithmia API asynchronously for given input that will be treated as JSON The future response will complete when the algorithm has completed or erroredAlgorithm
setOption(java.lang.String key, java.lang.String value)
Algorithm
setOptions(java.util.Map<java.lang.String,java.lang.String> options)
Algorithm
setOutputType(Algorithm.AlgorithmOutputType outputType)
Algorithm
setStdout(boolean showStdout)
Algorithm
setTimeout(java.lang.Long timeout, java.util.concurrent.TimeUnit unit)
-
-
-
Constructor Detail
-
Algorithm
public Algorithm(HttpClient client, AlgorithmRef algoRef)
-
Algorithm
public Algorithm(HttpClient client, AlgorithmRef algoRef, java.util.Map<java.lang.String,java.lang.String> options)
-
-
Method Detail
-
setOptions
public Algorithm setOptions(java.util.Map<java.lang.String,java.lang.String> options)
-
setOption
public Algorithm setOption(java.lang.String key, java.lang.String value)
-
setTimeout
public Algorithm setTimeout(java.lang.Long timeout, java.util.concurrent.TimeUnit unit)
-
getTimeout
public java.lang.Long getTimeout()
-
setStdout
public Algorithm setStdout(boolean showStdout)
-
setOutputType
public Algorithm setOutputType(Algorithm.AlgorithmOutputType outputType)
-
pipe
public AlgoResponse pipe(java.lang.Object input) throws APIException
Calls the Algorithmia API for a given input. Attempts to automatically serialize the input to JSON.- Parameters:
input
- algorithm input, will automatically be converted into JSON- Returns:
- algorithm result (AlgoSuccess or AlgoFailure)
- Throws:
APIException
- if there is a problem communication with the Algorithmia API.
-
pipeAsync
public FutureAlgoResponse pipeAsync(java.lang.Object input)
Calls the Algorithmia API asynchronously for a given input. Attempts to automatically serialize the input to JSON. The future response will complete when the algorithm has completed or errored- Parameters:
input
- algorithm input, will automatically be converted into JSON- Returns:
- future algorithm result (AlgoSuccess or AlgoFailure)
-
pipeJson
public AlgoResponse pipeJson(java.lang.String inputJson) throws APIException
Calls the Algorithmia API for given input that will be treated as JSON- Parameters:
inputJson
- json input value- Returns:
- success or failure
- Throws:
APIException
- if there is a problem communication with the Algorithmia API.
-
pipeJsonAsync
public FutureAlgoResponse pipeJsonAsync(java.lang.String inputJson)
Calls the Algorithmia API asynchronously for given input that will be treated as JSON The future response will complete when the algorithm has completed or errored- Parameters:
inputJson
- json input value- Returns:
- success or failure
-
-