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
All Methods Instance Methods Concrete Methods 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()FlagsidentifyUserWithTraits(String identifier, List<TraitModel> traits, 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.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.flagsmith.interfaces.FlagsmithSdk
assertValidUser, getRequestor
-
-
-
-
Constructor Detail
-
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 Detail
-
getFeatureFlags
public Flags getFeatureFlags(boolean doThrow)
Get Feature Flags from API.- Specified by:
getFeatureFlagsin interfaceFlagsmithSdk- Parameters:
doThrow- - whether throw exception or not- Returns:
-
identifyUserWithTraits
public Flags identifyUserWithTraits(String identifier, List<TraitModel> traits, boolean doThrow)
- Specified by:
identifyUserWithTraitsin interfaceFlagsmithSdk
-
getEnvironment
public EnvironmentModel getEnvironment()
- Specified by:
getEnvironmentin interfaceFlagsmithSdk
-
getConfig
public FlagsmithConfig getConfig()
- Specified by:
getConfigin interfaceFlagsmithSdk
-
getCache
public FlagsmithCache getCache()
- Specified by:
getCachein interfaceFlagsmithSdk
-
getLogger
public FlagsmithLogger getLogger()
-
newGetRequest
public okhttp3.Request newGetRequest(okhttp3.HttpUrl url)
Returns a build request with GET.- Specified by:
newGetRequestin interfaceFlagsmithSdk- Parameters:
url- - URL to invoke- Returns:
-
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- Returns:
-
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
-
-