Public API for evaluation variations. More...
#include <launchdarkly/boolean.h>#include <launchdarkly/client.h>#include <launchdarkly/export.h>#include <launchdarkly/json.h>#include <launchdarkly/user.h>#include <launchdarkly/flag_state.h>

Go to the source code of this file.
Data Structures | |
| struct | LDDetailsRule |
| Indicates which rule matched a user. More... | |
| struct | LDDetailsFallthrough |
| Extra information when reason == LD_FALLTHROUGH. More... | |
| struct | LDDetails |
Enumerations | |
| enum | LDEvalReason { LD_UNKNOWN = 0, LD_ERROR, LD_OFF, LD_PREREQUISITE_FAILED, LD_TARGET_MATCH, LD_RULE_MATCH, LD_FALLTHROUGH } |
| The reason an evaluation occurred. More... | |
| enum | LDEvalErrorKind { LD_CLIENT_NOT_READY, LD_NULL_KEY, LD_STORE_ERROR, LD_FLAG_NOT_FOUND, LD_USER_NOT_SPECIFIED, LD_CLIENT_NOT_SPECIFIED, LD_MALFORMED_FLAG, LD_WRONG_TYPE, LD_OOM } |
| Details about the type of error that caused an evaluation to fail. More... | |
Functions | |
| void | LDDetailsInit (struct LDDetails *const details) |
Initialize details to a default value. | |
| void | LDDetailsClear (struct LDDetails *const details) |
Free any resources associated with details | |
| const char * | LDEvalReasonKindToString (const enum LDEvalReason kind) |
Convert an LDEvalReason enum to an equivalent string. More... | |
| const char * | LDEvalErrorKindToString (const enum LDEvalErrorKind kind) |
Converts an LDEvalErrorKind enum to an equivalent string. More... | |
| struct LDJSON * | LDReasonToJSON (const struct LDDetails *const details) |
Marshal just the evaluation reason portion of LDDetails to JSON. More... | |
| LDBoolean | LDBoolVariation (struct LDClient *const client, const struct LDUser *const user, const char *const key, const LDBoolean fallback, struct LDDetails *const details) |
| Evaluate a boolean flag. More... | |
| int | LDIntVariation (struct LDClient *const client, const struct LDUser *const user, const char *const key, const int fallback, struct LDDetails *const details) |
| Evaluate a integer flag. More... | |
| double | LDDoubleVariation (struct LDClient *const client, const struct LDUser *const user, const char *const key, const double fallback, struct LDDetails *const details) |
| Evaluate a double flag. More... | |
| char * | LDStringVariation (struct LDClient *const client, const struct LDUser *const user, const char *const key, const char *const fallback, struct LDDetails *const details) |
| Evaluate a text flag. More... | |
| struct LDJSON * | LDJSONVariation (struct LDClient *const client, const struct LDUser *const user, const char *const key, const struct LDJSON *const fallback, struct LDDetails *const details) |
| Evaluate a JSON flag. More... | |
| struct LDJSON * | LDAllFlags (struct LDClient *const client, const struct LDUser *const user) |
| Returns a map from feature flag keys to values for a given user. This does not send analytics events back to LaunchDarkly. More... | |
| struct LDAllFlagsState * | LDAllFlagsState (struct LDClient *const client, const struct LDUser *const user, unsigned int options) |
| AllFlagsState returns an object that encapsulates the state of all feature flags for a given user. The state includes flag values, and also metadata that can be used on the front end. This does not send analytics events back to LaunchDarkly. More... | |
Public API for evaluation variations.
| enum LDEvalErrorKind |
Details about the type of error that caused an evaluation to fail.
| enum LDEvalReason |
The reason an evaluation occurred.
Returns a map from feature flag keys to values for a given user. This does not send analytics events back to LaunchDarkly.
| [in] | client | The client to use. May not be NULL. |
| [in] | user | The user to evaluate flags for. Ownership is not transferred. May not be NULL. |
NULL on failure. | struct LDAllFlagsState* LDAllFlagsState | ( | struct LDClient *const | client, |
| const struct LDUser *const | user, | ||
| unsigned int | options | ||
| ) |
AllFlagsState returns an object that encapsulates the state of all feature flags for a given user. The state includes flag values, and also metadata that can be used on the front end. This does not send analytics events back to LaunchDarkly.
| [in] | client | The client to use. May not be NULL. |
| [in] | user | The user to evaluate flags for. Ownership is not transferred. May not be NULL. |
| [in] | options | Options affecting the returned flags. |
LDAllFlagsState object, or NULL on failure. User is responsible for freeing with LDAllFlagsStateFree. Validity of the returned value can be checked with LDAllFlagsStateValid. | LDBoolean LDBoolVariation | ( | struct LDClient *const | client, |
| const struct LDUser *const | user, | ||
| const char *const | key, | ||
| const LDBoolean | fallback, | ||
| struct LDDetails *const | details | ||
| ) |
Evaluate a boolean flag.
| [in] | client | The client to use. May not be NULL. |
| [in] | user | The user to evaluate the flag against. May not be NULL. |
| [in] | key | The key of the flag to evaluate. May not be NULL. |
| [in] | fallback | The value to return on error |
| [out] | details | A struct where the evaluation explanation will be put. If NULL no explanation will be generated. |
| double LDDoubleVariation | ( | struct LDClient *const | client, |
| const struct LDUser *const | user, | ||
| const char *const | key, | ||
| const double | fallback, | ||
| struct LDDetails *const | details | ||
| ) |
Evaluate a double flag.
| [in] | client | The client to use. May not be NULL. |
| [in] | user | The user to evaluate the flag against. May not be NULL. |
| [in] | key | The key of the flag to evaluate. May not be NULL. |
| [in] | fallback | The value to return on error |
| [out] | details | A struct where the evaluation explanation will be put. If NULL no explanation will be generated. |
| const char* LDEvalErrorKindToString | ( | const enum LDEvalErrorKind | kind | ) |
Converts an LDEvalErrorKind enum to an equivalent string.
| [in] | kind | The error kind to convert. |
NULL on invalid input. | const char* LDEvalReasonKindToString | ( | const enum LDEvalReason | kind | ) |
Convert an LDEvalReason enum to an equivalent string.
Converts an LDEvalReason enum to an equivalent string
| [in] | kind | The reason kind to convert. |
NULL on invalid input. | int LDIntVariation | ( | struct LDClient *const | client, |
| const struct LDUser *const | user, | ||
| const char *const | key, | ||
| const int | fallback, | ||
| struct LDDetails *const | details | ||
| ) |
Evaluate a integer flag.
| [in] | client | The client to use. May not be NULL. |
| [in] | user | The user to evaluate the flag against. May not be NULL. |
| [in] | key | The key of the flag to evaluate. May not be NULL. |
| [in] | fallback | The value to return on error |
| [out] | details | A struct where the evaluation explanation will be put. If NULL no explanation will be generated. |
| struct LDJSON* LDJSONVariation | ( | struct LDClient *const | client, |
| const struct LDUser *const | user, | ||
| const char *const | key, | ||
| const struct LDJSON *const | fallback, | ||
| struct LDDetails *const | details | ||
| ) |
Evaluate a JSON flag.
| [in] | client | The client to use. May not be NULL. |
| [in] | user | The user to evaluate the flag against. May not be NULL. |
| [in] | key | The key of the flag to evaluate. May not be NULL` |
| [in] | fallback | The fallback to return on error. Ownership is not transferred. May be NULL. |
| [out] | details | A struct where the evaluation explanation will be put. If NULL no explanation will be generated. |
NULL on allocation failure. The result must be cleaned up with LDJSONFree. | struct LDJSON* LDReasonToJSON | ( | const struct LDDetails *const | details | ) |
Marshal just the evaluation reason portion of LDDetails to JSON.
| [in] | details | The structure to marshal. Ownership is not transferred. May not be NULL (assert) |
NULL on malloc failure. | char* LDStringVariation | ( | struct LDClient *const | client, |
| const struct LDUser *const | user, | ||
| const char *const | key, | ||
| const char *const | fallback, | ||
| struct LDDetails *const | details | ||
| ) |
Evaluate a text flag.
| [in] | client | The client to use. May not be NULL. |
| [in] | user | The user to evaluate the flag against. May not be NULL. |
| [in] | key | The key of the flag to evaluate. May not be NULL. |
| [in] | fallback | The value to return on error. Ownership is not transferred. May be NULL. |
| [out] | details | A struct where the evaluation explanation will be put. If NULL no explanation will be generated. |
NULL on allocation failure. The result must be cleaned up with LDFree.