Package com.flagsmith

Class FlagsmithApiWrapper

java.lang.Object
com.flagsmith.FlagsmithApiWrapper
All Implemented Interfaces:
FlagsmithSdk

public class FlagsmithApiWrapper
extends Object
implements FlagsmithSdk
  • Constructor Details

    • FlagsmithApiWrapper

      public FlagsmithApiWrapper​(FlagsmithCache cache, FlagsmithConfig defaultConfig, HashMap<String,​String> customHeaders, FlagsmithLogger logger, String apiKey)
      Instantiate with cache.
      Parameters:
      cache - cache object
      defaultConfig - config object
      customHeaders - custom headers list
      logger - logger object
      apiKey - 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 object
      customHeaders - custom headers list
      logger - logger instance
      apiKey - 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 object
      customHeaders - custom headers list
      logger - logger instance
      apiKey - api key
      requestProcessor - request processor
  • Method Details

    • getFeatureFlags

      public Flags getFeatureFlags​(boolean doThrow)
      Get Feature Flags from API.
      Specified by:
      getFeatureFlags in interface FlagsmithSdk
      Parameters:
      doThrow - - whether throw exception or not
      Returns:
    • identifyUserWithTraits

      public Flags identifyUserWithTraits​(String identifier, List<TraitModel> traits, boolean doThrow)
      Specified by:
      identifyUserWithTraits in interface FlagsmithSdk
    • getEnvironment

      public EnvironmentModel getEnvironment()
      Specified by:
      getEnvironment in interface FlagsmithSdk
    • getConfig

      public FlagsmithConfig getConfig()
      Specified by:
      getConfig in interface FlagsmithSdk
    • getCache

      public FlagsmithCache getCache()
      Specified by:
      getCache in interface FlagsmithSdk
    • getLogger

      public FlagsmithLogger getLogger()
    • newGetRequest

      public okhttp3.Request newGetRequest​(okhttp3.HttpUrl url)
      Returns a build request with GET.
      Specified by:
      newGetRequest in interface FlagsmithSdk
      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:
      newPostRequest in interface FlagsmithSdk
      Parameters:
      url - - URL to invoke
      body - - 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:
      close in interface FlagsmithSdk