Package com.flagsmith

Class FlagsmithApiWrapper

    • Constructor Detail

      • 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 Detail

      • 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:
      • 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