Package io.flipt.client
Class FliptClient
java.lang.Object
io.flipt.client.FliptClient
- All Implemented Interfaces:
AutoCloseable
A client for interacting with Flipt feature flags.
This client is thread-safe and should be reused across your application. Use the builder to create a new instance:
var client = FliptClient.builder()
.url("http://localhost:8080")
.build();
// With TLS configuration
var tlsClient = FliptClient.builder()
.url("https://flipt.example.com")
.tlsConfig(TlsConfig.builder().caCertFile("/path/to/ca.pem").build())
.build();
- Since:
- 1.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic classPartial builder definition to add deprecation onauthentication. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()evaluateBatch(List<EvaluationRequest> batchEvaluationRequests) evaluateBatch evaluates a batch of flags.evaluateBoolean evaluates a boolean flag.evaluateVariant evaluates a variant flag.getSnapshot gets the snapshot from the Flipt client.listFlags lists all flags in the namespace.
-
Method Details
-
evaluateVariant
public VariantEvaluationResponse evaluateVariant(String flagKey, String entityId, Map<String, String> context) evaluateVariant evaluates a variant flag.- Parameters:
flagKey- the key for the flag to evaluateentityId- the ID for the entity to evaluatecontext- the context for the evaluation- Returns:
- the evaluation response
-
evaluateBoolean
public BooleanEvaluationResponse evaluateBoolean(String flagKey, String entityId, Map<String, String> context) evaluateBoolean evaluates a boolean flag.- Parameters:
flagKey- the key for the flag to evaluateentityId- the ID for the entity to evaluatecontext- the context for the evaluation- Returns:
- the evaluation response
-
evaluateBatch
evaluateBatch evaluates a batch of flags.- Parameters:
batchEvaluationRequests- the batch of flags to evaluate- Returns:
- the evaluation response
-
listFlags
listFlags lists all flags in the namespace.- Returns:
- the list of flags
-
getSnapshot
getSnapshot gets the snapshot from the Flipt client.- Returns:
- the snapshot
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-