Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contains the core functionality of the SDK.
Synopsis
- data Client
- makeClient :: Config -> IO Client
- clientVersion :: Text
- boolVariation :: Client -> Text -> User -> Bool -> IO Bool
- boolVariationDetail :: Client -> Text -> User -> Bool -> IO (EvaluationDetail Bool)
- stringVariation :: Client -> Text -> User -> Text -> IO Text
- stringVariationDetail :: Client -> Text -> User -> Text -> IO (EvaluationDetail Text)
- intVariation :: Client -> Text -> User -> Int -> IO Int
- intVariationDetail :: Client -> Text -> User -> Int -> IO (EvaluationDetail Int)
- doubleVariation :: Client -> Text -> User -> Double -> IO Double
- doubleVariationDetail :: Client -> Text -> User -> Double -> IO (EvaluationDetail Double)
- jsonVariation :: Client -> Text -> User -> Value -> IO Value
- jsonVariationDetail :: Client -> Text -> User -> Value -> IO (EvaluationDetail Value)
- data EvaluationDetail value = EvaluationDetail {
- value :: !value
- variationIndex :: !(Maybe Natural)
- reason :: !EvaluationReason
- data EvaluationReason
- data EvalErrorKind
- allFlags :: Client -> User -> IO (HashMap Text Value)
- close :: Client -> IO ()
- flushEvents :: Client -> IO ()
- identify :: Client -> User -> IO ()
- track :: Client -> User -> Text -> Maybe Value -> Maybe Double -> IO ()
- data Status
- getStatus :: Client -> IO Status
Documentation
Client is the LaunchDarkly client. Client instances are thread-safe. Applications should instantiate a single instance for the lifetime of their application.
clientVersion :: Text Source #
The version string for this library.
boolVariationDetail :: Client -> Text -> User -> Bool -> IO (EvaluationDetail Bool) Source #
Evaluate a Boolean typed flag, and return an explation.
stringVariationDetail :: Client -> Text -> User -> Text -> IO (EvaluationDetail Text) Source #
Evaluate a String typed flag, and return an explanation.
intVariation :: Client -> Text -> User -> Int -> IO Int Source #
Evaluate a Number typed flag, and truncate the result.
intVariationDetail :: Client -> Text -> User -> Int -> IO (EvaluationDetail Int) Source #
Evaluate a Number typed flag, truncate the result, and return an explanation.
doubleVariation :: Client -> Text -> User -> Double -> IO Double Source #
Evaluate a Number typed flag.
doubleVariationDetail :: Client -> Text -> User -> Double -> IO (EvaluationDetail Double) Source #
Evaluate a Number typed flag, and return an explanation.
jsonVariationDetail :: Client -> Text -> User -> Value -> IO (EvaluationDetail Value) Source #
Evaluate a JSON typed flag, and return an explanation.
data EvaluationDetail value Source #
Combines the result of a flag evaluation with an explanation of how it was calculated.
EvaluationDetail | |
|
Instances
data EvaluationReason Source #
Defines the possible values of the Kind property of EvaluationReason.
EvaluationReasonOff | Indicates that the flag was off and therefore returned its configured off value. |
EvaluationReasonTargetMatch | indicates that the user key was specifically targeted for this flag. |
EvaluationReasonRuleMatch | Indicates that the user matched one of the flag's rules. |
EvaluationReasonPrerequisiteFailed | Indicates that the flag was considered off because it had at least one prerequisite flag that either was off or did not return the desired variation. |
| |
EvaluationReasonFallthrough | Indicates that the flag was on but the user did not match any targets or rules. |
EvaluationReasonError | Indicates that the flag could not be evaluated, e.g. because it does not exist or due to an unexpected error. In this case the result value will be the default value that the caller passed to the client. |
|
Instances
data EvalErrorKind Source #
Defines the possible values of the errorKind property of EvaluationReason.
EvalErrorKindMalformedFlag | Indicates that there was an internal inconsistency in the flag data, e.g. a rule specified a nonexistent variation. |
EvalErrorFlagNotFound | Indicates that the caller provided a flag key that did not match any known flag. |
EvalErrorWrongType | Indicates that the result value was not of the requested type, e.g. you called boolVariationDetail but the value was an integer. |
EvalErrorUserNotSpecified | Indicates that the caller passed a user without a key for the user parameter. |
EvalErrorClientNotReady | Indicates that the caller tried to evaluate a flag before the client had successfully initialized. |
EvalErrorExternalStore !Text | Indicates that some error was returned by the external feature store. |
Instances
allFlags :: Client -> User -> IO (HashMap Text Value) Source #
Returns a map from feature flag keys to values for a given user. If the
result of the flag's evaluation would result in the default value, Null
will be returned. This method does not send analytics events back to
LaunchDarkly.
close :: Client -> IO () Source #
Close shuts down the LaunchDarkly client. After calling this, the LaunchDarkly client should no longer be used. The method will block until all pending analytics events have been sent.
flushEvents :: Client -> IO () Source #
Flush tells the client that all pending analytics events (if any) should be delivered as soon as possible. Flushing is asynchronous, so this method will return before it is complete.
track :: Client -> User -> Text -> Maybe Value -> Maybe Double -> IO () Source #
Track reports that a user has performed an event. Custom data can be attached to the event, and / or a numeric value.
The numeric value is used by the LaunchDarkly experimentation feature in numeric custom metrics, and will also be returned as part of the custom event for Data Export.
The status of the client initialization.
Uninitialized | The client has not yet finished connecting to LaunchDarkly. |
Unauthorized | The client attempted to connect to LaunchDarkly and was denied. |
Initialized | The client has successfuly connected to LaunchDarkly. |
ShuttingDown | The client is being terminated |