Package com.flagsmith
Class FlagsmithApiWrapper
java.lang.Object
com.flagsmith.FlagsmithApiWrapper
- All Implemented Interfaces:
FlagsmithSdk
public class FlagsmithApiWrapper extends Object implements FlagsmithSdk
-
Constructor Summary
Constructors Constructor Description FlagsmithApiWrapper(FlagsmithConfig defaultConfig, HashMap<String,String> customHeaders, FlagsmithLogger logger, String apiKey)Instantiate with config, custom headers, logger and apikey.FlagsmithApiWrapper(FlagsmithConfig defaultConfig, HashMap<String,String> customHeaders, FlagsmithLogger logger, String apiKey, RequestProcessor requestProcessor)Instantiate with config, custom headers, logger, apikey and request processor.FlagsmithApiWrapper(FlagsmithCache cache, FlagsmithConfig defaultConfig, HashMap<String,String> customHeaders, FlagsmithLogger logger, String apiKey)Instantiate with cache. -
Method Summary
Modifier and Type Method Description voidclose()Close the FlagsmithAPIWrapper instance, cleaning up any dependent threads or services which need cleaning up before the instance can be fully destroyed.FlagsmithCachegetCache()FlagsmithConfiggetConfig()EnvironmentModelgetEnvironment()FlagsgetFeatureFlags(boolean doThrow)Get Feature Flags from API.FlagsmithLoggergetLogger()RequestProcessorgetRequestor()FlagsidentifyUserWithTraits(String identifier, List<? extends TraitModel> traits, boolean isTransient, boolean doThrow)okhttp3.RequestnewGetRequest(okhttp3.HttpUrl url)Returns a build request with GET.okhttp3.RequestnewPostRequest(okhttp3.HttpUrl url, okhttp3.RequestBody body)Returns a build request with GET.voidsetRequestor(RequestProcessor requestor)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.flagsmith.interfaces.FlagsmithSdk
assertValidUser
-
Constructor Details
-
FlagsmithApiWrapper
public FlagsmithApiWrapper(FlagsmithCache cache, FlagsmithConfig defaultConfig, HashMap<String,String> customHeaders, FlagsmithLogger logger, String apiKey)Instantiate with cache.- Parameters:
cache- cache objectdefaultConfig- config objectcustomHeaders- custom headers listlogger- logger objectapiKey- api key
-
FlagsmithApiWrapper
public FlagsmithApiWrapper(FlagsmithConfig defaultConfig, HashMap<String,String> customHeaders, FlagsmithLogger logger, String apiKey)Instantiate with config, custom headers, logger and apikey.- Parameters:
defaultConfig- config objectcustomHeaders- custom headers listlogger- logger instanceapiKey- api key
-
FlagsmithApiWrapper
public FlagsmithApiWrapper(FlagsmithConfig defaultConfig, HashMap<String,String> customHeaders, FlagsmithLogger logger, String apiKey, RequestProcessor requestProcessor)Instantiate with config, custom headers, logger, apikey and request processor.- Parameters:
defaultConfig- config objectcustomHeaders- custom headers listlogger- logger instanceapiKey- api keyrequestProcessor- request processor
-
-
Method Details
-
getFeatureFlags
Get Feature Flags from API.- Specified by:
getFeatureFlagsin interfaceFlagsmithSdk- Parameters:
doThrow- - whether throw exception or not
-
identifyUserWithTraits
public Flags identifyUserWithTraits(String identifier, List<? extends TraitModel> traits, boolean isTransient, boolean doThrow)- Specified by:
identifyUserWithTraitsin interfaceFlagsmithSdk
-
getEnvironment
- Specified by:
getEnvironmentin interfaceFlagsmithSdk
-
getRequestor
- Specified by:
getRequestorin interfaceFlagsmithSdk
-
setRequestor
-
getConfig
- Specified by:
getConfigin interfaceFlagsmithSdk
-
getCache
- Specified by:
getCachein interfaceFlagsmithSdk
-
getLogger
-
newGetRequest
public okhttp3.Request newGetRequest(okhttp3.HttpUrl url)Returns a build request with GET.- Specified by:
newGetRequestin interfaceFlagsmithSdk- Parameters:
url- - URL to invoke
-
newPostRequest
public okhttp3.Request newPostRequest(okhttp3.HttpUrl url, okhttp3.RequestBody body)Returns a build request with GET.- Specified by:
newPostRequestin interfaceFlagsmithSdk- Parameters:
url- - URL to invokebody- - body to post
-
close
public void close()Close the FlagsmithAPIWrapper instance, cleaning up any dependent threads or services which need cleaning up before the instance can be fully destroyed.- Specified by:
closein interfaceFlagsmithSdk
-