Copyright | Copyright © FINN.no AS Inc. All rights reserved. |
---|---|
License | MIT |
Stability | experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Functions and types that constitute an Unleash client SDK.
This module re-exports select constructors from unleash-client-haskell-core.
Synopsis
- makeUnleashConfig :: MonadIO m => Text -> Text -> BaseUrl -> Maybe Text -> m UnleashConfig
- data UnleashConfig = UnleashConfig {}
- class HasUnleash r where
- getUnleashConfig :: r -> UnleashConfig
- registerClient :: (HasUnleash r, MonadReader r m, MonadIO m) => m (Either ClientError ())
- pollToggles :: (HasUnleash r, MonadReader r m, MonadIO m) => m (Either ClientError ())
- pushMetrics :: (HasUnleash r, MonadReader r m, MonadIO m) => m (Either ClientError ())
- isEnabled :: (HasUnleash r, MonadReader r m, MonadIO m) => Text -> Context -> m Bool
- tryIsEnabled :: (HasUnleash r, MonadReader r m, MonadIO m) => Text -> Context -> m Bool
- getVariant :: (HasUnleash r, MonadReader r m, MonadIO m) => Text -> Context -> m VariantResponse
- tryGetVariant :: (HasUnleash r, MonadReader r m, MonadIO m) => Text -> Context -> m VariantResponse
- data Context = Context {}
- emptyContext :: Context
- data VariantResponse = VariantResponse {}
Documentation
:: MonadIO m | |
=> Text | Application name. |
-> Text | Instance identifier. |
-> BaseUrl | Unleash server base URL. |
-> Maybe Text | API key for authorization. |
-> m UnleashConfig | Configuration instance. |
Smart constructor for Unleash client configuration. Initializes the mutable variables properly.
data UnleashConfig Source #
Unleash client configuration. Use the smart constructor or make sure the mutable metrics variables are not empty.
UnleashConfig | |
|
class HasUnleash r where Source #
Reader monad convenience class. Use this to get an Unleash configuration from inside of an application configuration (for example).
getUnleashConfig :: r -> UnleashConfig Source #
registerClient :: (HasUnleash r, MonadReader r m, MonadIO m) => m (Either ClientError ()) Source #
Register client for the Unleash server. Call this on application startup before calling the state poller and metrics pusher functions.
pollToggles :: (HasUnleash r, MonadReader r m, MonadIO m) => m (Either ClientError ()) Source #
Fetch the most recent feature toggle set from the Unleash server. Meant to be run every statePollIntervalInSeconds. Non-blocking.
pushMetrics :: (HasUnleash r, MonadReader r m, MonadIO m) => m (Either ClientError ()) Source #
Push metrics to the Unleash server. Meant to be run every metricsPushIntervalInSeconds. Blocks if the mutable metrics variables are empty.
:: (HasUnleash r, MonadReader r m, MonadIO m) | |
=> Text | Feature toggle name. |
-> Context | Client context. |
-> m Bool | Whether or not the feature toggle is enabled. |
Check if a feature is enabled or not. Blocks until first feature toggle set is received. Blocks if the mutable metrics variables are empty.
:: (HasUnleash r, MonadReader r m, MonadIO m) | |
=> Text | Feature toggle name. |
-> Context | Client context. |
-> m Bool | Whether or not the feature toggle is enabled. |
Check if a feature is enabled or not. Returns false for all toggles until first toggle set is received. Blocks if the mutable metrics variables are empty.
:: (HasUnleash r, MonadReader r m, MonadIO m) | |
=> Text | Feature toggle name. |
-> Context | Client context. |
-> m VariantResponse | Variant. |
Get a variant. Blocks until first feature toggle set is received.
:: (HasUnleash r, MonadReader r m, MonadIO m) | |
=> Text | Feature toggle name. |
-> Context | Client context. |
-> m VariantResponse | Variant. |
Get a variant. Returns an empty variant until first toggle set is received.
Client context.
Context | |
|
Instances
emptyContext :: Context Source #
An initial client context.
data VariantResponse Source #
Variant response.