diff --git a/clients/haskell/hs-cac-client/src/Client.hs b/clients/haskell/hs-cac-client/src/Client.hs index c283202f..f1350039 100644 --- a/clients/haskell/hs-cac-client/src/Client.hs +++ b/clients/haskell/hs-cac-client/src/Client.hs @@ -100,13 +100,13 @@ getCacClient tenant = do then Left <$> getError else Right <$> newForeignPtr c_free_cac_client cacClient -getFullConfigStateWithFilter :: ForeignPtr CacClient -> Maybe String -> Maybe String -> IO (Either Error Value) +getFullConfigStateWithFilter :: ForeignPtr CacClient -> Maybe String -> Maybe [String] -> IO (Either Error Value) getFullConfigStateWithFilter client mbFilters mbPrefix = do cFilters <- case mbFilters of Just filters -> newCAString filters Nothing -> return nullPtr cPrefix <- case mbPrefix of - Just prefix -> newCAString prefix + Just prefix -> newCAString (intercalate "," prefix) Nothing -> return nullPtr config <- withForeignPtr client $ \client -> c_get_config client cFilters cPrefix _ <- cleanup [cFilters] diff --git a/clients/haskell/hs-cac-client/src/Main.hs b/clients/haskell/hs-cac-client/src/Main.hs index 7ea48859..0e9cd698 100644 --- a/clients/haskell/hs-cac-client/src/Main.hs +++ b/clients/haskell/hs-cac-client/src/Main.hs @@ -23,7 +23,7 @@ main = do lastModified <- getCacLastModified client overrides <- getResolvedConfig client "{\"country\": \"India\"}" $ Just ["country_image_url", "hyperpay_version"] defaults <- getDefaultConfig client $ Just ["country_image_url", "hyperpay_version"] - filteredConfig <- getFullConfigStateWithFilter client (Just "{\"os\": \"android\"}") (Just "hyperpay") + filteredConfig <- getFullConfigStateWithFilter client (Just "{\"os\": \"android\"}") $ Just ["hyperpay"] print config print lastModified print overrides diff --git a/docs/client-context-aware-configuration.md b/docs/client-context-aware-configuration.md index ac131701..479dfc57 100644 --- a/docs/client-context-aware-configuration.md +++ b/docs/client-context-aware-configuration.md @@ -295,8 +295,14 @@ Get the full config definition of your tenants configuration from superposition. ##### Funtion Definition ``` -getFullConfigStateWithFilter :: ForeignPtr CacClient -> Maybe String -> IO (Either Error Value) +getFullConfigStateWithFilter :: ForeignPtr CacClient -> Maybe String -> Maybe [String] -> IO (Either Error Value) ``` +##### Params + +| Param | type | description | Example value | +| --------- | ------------------ | ----------------------------------------------------------------------------------------------- | --------------------------------------------- | +| `context` | Maybe (String) | Specifies the context for which you want the configurations, If empty, all contexts are returned | Just `{"os": "android", "merchant": "juspay"}` | +| `prefix` | Maybe([String]) | The keys for which you want the values. If empty, all configuration keys are returned | `Just ([payment, network, color])` | #### Get the last modified Time @@ -358,11 +364,11 @@ main = do getCacClient "dev" >>= \case Left err -> putStrLn err Right client -> do - config <- getFullConfigStateWithFilter client Nothing + config <- getFullConfigStateWithFilter client Nothing Nothing lastModified <- getCacLastModified client overrides <- getResolvedConfig client "{\"country\": \"India\"}" $ Just ["country_image_url", "hyperpay_version"] defaults <- getDefaultConfig client $ Just ["country_image_url", "hyperpay_version"] - filteredConfig <- getFullConfigStateWithFilter client $ Just "{\"prefix\": \"hyperpay\"}" + filteredConfig <- getFullConfigStateWithFilter client (Just "{\"os\": \"android\"}") $ Just ["hyperpay"] print config print lastModified print overrides