Class FliptClient

java.lang.Object
io.flipt.client.FliptClient
All Implemented Interfaces:
AutoCloseable

public class FliptClient extends Object implements 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
  • 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 evaluate
      entityId - the ID for the entity to evaluate
      context - 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 evaluate
      entityId - the ID for the entity to evaluate
      context - the context for the evaluation
      Returns:
      the evaluation response
    • evaluateBatch

      public BatchEvaluationResponse evaluateBatch(List<EvaluationRequest> batchEvaluationRequests)
      evaluateBatch evaluates a batch of flags.
      Parameters:
      batchEvaluationRequests - the batch of flags to evaluate
      Returns:
      the evaluation response
    • listFlags

      public List<Flag> listFlags()
      listFlags lists all flags in the namespace.
      Returns:
      the list of flags
    • getSnapshot

      public String getSnapshot()
      getSnapshot gets the snapshot from the Flipt client.
      Returns:
      the snapshot
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable