Closed tinahollygb closed 1 year ago
Initial `GBFeatureRepository` class. # Acceptance Criteria * ✅ should fetch features with provided endpoint and optional encryptionKey config. * ✅ expose method `getFeaturesJson()` * ✅ should send a user agent string to identify itself as the Java SDK with version
The existing `GBFeatureRepository` class should be: * ✅ Configurable TTL for the caching * ✅ Have functionality to refresh the features when the cache has expired * ✅ Support a list of callbacks to allow implementations to listen for feature updates.
Adds networking via the new
GBFeaturesRepository
class, allowing developers to fetch both unencrypted and encrypted features.An instance of this class can be created with an endpoint URL, TTL (seconds), and optional encryption key for decrypting encrypted payloads.
Features
ttlSeconds
(defaults to 60)gbFeaturesRepository.initialize()
makes the network request to the GrowthBook SDK endpoint to get the features, and caches the response in-memory.gbFeaturesRepository.getFeaturesJson()
allows you to get the features JSON as a string, which simplifies the implementation of fetching and initializing aGBContext
.User-Agent
header when fetching features, e.g.growthbook-sdk-java/0.3.0
onFeaturesRefresh(FeatureRefreshCallback callback)
Issues