Package dev.runabout
Class RunaboutApiBuilder
- java.lang.Object
-
- dev.runabout.RunaboutApiBuilder
-
public class RunaboutApiBuilder extends java.lang.ObjectA builder for creating a RunaboutAPI. The default implementation will
-
-
Constructor Summary
Constructors Constructor Description RunaboutApiBuilder(java.util.function.Supplier<java.lang.String> tokenSupplier)Constructor for RunaboutAPIBuilder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RunaboutApibuild()java.util.concurrent.ExecutorgetExecutor()RunaboutListenergetListener()java.util.Queue<RunaboutScenario>getQueue()longgetTimeout()java.util.function.Supplier<java.lang.String>getTokenSupplier()java.net.URIgetUri()RunaboutApiBuildersetExecutor(java.util.concurrent.Executor executor)Set the executor used to make requests.RunaboutApiBuildersetListener(RunaboutListener listener)Sets the listener to invoke on errors.RunaboutApiBuildersetQueue(java.util.Queue<RunaboutScenario> queue)Set the queue implementation used to hand off scenarios to the executor service, which will make the requests.RunaboutApiBuildersetTimeout(long timeout)Set the connection timeout used when connecting to the ingest URL.RunaboutApiBuildersetUri(java.net.URI uri)Sets the URI to post scenarios to.
-
-
-
Constructor Detail
-
RunaboutApiBuilder
public RunaboutApiBuilder(java.util.function.Supplier<java.lang.String> tokenSupplier)
Constructor for RunaboutAPIBuilder. The only required parameter is the apiTokenSupplier, which should supply an organization's API token. To get an API token, visit runabout.dev.- Parameters:
tokenSupplier- Supplier of an organization's API token.
-
-
Method Detail
-
getTimeout
public long getTimeout()
-
setTimeout
public RunaboutApiBuilder setTimeout(long timeout)
Set the connection timeout used when connecting to the ingest URL.- Parameters:
timeout- long timeout in milliseconds.- Returns:
- The RunaboutApiBuilder instance.
-
getExecutor
public java.util.concurrent.Executor getExecutor()
-
setExecutor
public RunaboutApiBuilder setExecutor(java.util.concurrent.Executor executor)
Set the executor used to make requests. Default is a fixed thread pool with a single thread.- Parameters:
executor- Executor service to use.- Returns:
- The RunaboutApiBuilder instance.
-
getQueue
public java.util.Queue<RunaboutScenario> getQueue()
-
setQueue
public RunaboutApiBuilder setQueue(java.util.Queue<RunaboutScenario> queue)
Set the queue implementation used to hand off scenarios to the executor service, which will make the requests.- Parameters:
queue- Queue implementation to use.- Returns:
- The RunaboutApiBuilder instance.
-
getUri
public java.net.URI getUri()
-
setUri
public RunaboutApiBuilder setUri(java.net.URI uri)
Sets the URI to post scenarios to.- Parameters:
uri- URI to make requests to.- Returns:
- The RunaboutApiBuilder instance.
-
getListener
public RunaboutListener getListener()
-
setListener
public RunaboutApiBuilder setListener(RunaboutListener listener)
Sets the listener to invoke on errors.- Parameters:
listener- RunaboutListener instance.- Returns:
- The RunaboutApiBuilder instance.
-
getTokenSupplier
public java.util.function.Supplier<java.lang.String> getTokenSupplier()
-
build
public RunaboutApi build()
-
-