Class OfrepApi
java.lang.Object
dev.openfeature.contrib.providers.ofrep.internal.OfrepApi
The OfrepApi class is responsible for communicating with the OFREP server to evaluate flags.
-
Constructor Summary
ConstructorsConstructorDescriptionOfrepApi(Duration requestTimeout, Duration connectTimeout, ProxySelector proxySelector, Executor executor) Constructs an OfrepApi instance with a HTTP client and JSON serializers. -
Method Summary
Modifier and TypeMethodDescriptionresolve(String baseUrl, com.google.common.collect.ImmutableMap<String, com.google.common.collect.ImmutableList<String>> headers, String key, OfrepRequest requestBody) resolve is the method that interacts with the OFREP server to evaluate flags.voidsetNextAllowedRequestTime(Instant retryAfter) Sets the next allowed request time based on the Retry-After header.
-
Constructor Details
-
OfrepApi
public OfrepApi(Duration requestTimeout, Duration connectTimeout, ProxySelector proxySelector, Executor executor) Constructs an OfrepApi instance with a HTTP client and JSON serializers.- Parameters:
requestTimeout- - The request timeout duration for the request.connectTimeout- - The connect timeout duration for establishing HTTP connection.proxySelector- - The ProxySelector to use for HTTP requests.executor- - The Executor to use for operations.
-
-
Method Details
-
resolve
public Resolution resolve(String baseUrl, com.google.common.collect.ImmutableMap<String, com.google.common.collect.ImmutableList<String>> headers, String key, OfrepRequest requestBody) resolve is the method that interacts with the OFREP server to evaluate flags.- Parameters:
baseUrl- - The base URL of the OFREP server.headers- - headers to include in the request.key- - The flag key to evaluate.requestBody- - The evaluation context as a map of key-value pairs.- Returns:
- Resolution object, containing the response status, headers, and body.
-
setNextAllowedRequestTime
Sets the next allowed request time based on the Retry-After header. If the provided time is later than the current next allowed request time, it updates it.- Parameters:
retryAfter- The value of the Retry-After header, which can be a number of seconds or a date string.
-