C Server-Side SDK
LaunchDarkly SDK
flag_state.h File Reference

Public API associated with LDAllFlagsState. More...

Include dependency graph for flag_state.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  LDAllFlagsStateOption { LD_ALLFLAGS_DEFAULT = 0, LD_INCLUDE_REASON = (1 << 0), LD_DETAILS_ONLY_FOR_TRACKED_FLAGS = (1 << 1), LD_CLIENT_SIDE_ONLY = (1 << 2) }
 Options for use in LDAllFlagsState. More...
 

Functions

LDBoolean LDAllFlagsStateValid (struct LDAllFlagsState *flags)
 Check if a call to LDAllFlagsState succeeded. More...
 
void LDAllFlagsStateFree (struct LDAllFlagsState *flags)
 Frees memory associated with LDAllFlagsState. More...
 
char * LDAllFlagsStateSerializeJSON (struct LDAllFlagsState *flags)
 Serializes flag data to JSON. More...
 
struct LDDetailsLDAllFlagsStateGetDetails (struct LDAllFlagsState *flags, const char *key)
 Returns evaluation details for an individual feature flag at the time the state was recorded. More...
 
struct LDJSON * LDAllFlagsStateGetValue (struct LDAllFlagsState *flags, const char *key)
 Returns the JSON value of an individual feature flag at the time the state was recorded. More...
 
struct LDJSON * LDAllFlagsStateToValuesMap (struct LDAllFlagsState *flags)
 Returns a JSON map of flag keys to flag values. More...
 

Detailed Description

Public API associated with LDAllFlagsState.

Enumeration Type Documentation

◆ LDAllFlagsStateOption

Options for use in LDAllFlagsState.

Enumerator
LD_ALLFLAGS_DEFAULT 

Use default behavior.

LD_INCLUDE_REASON 

Include evaluation reasons in the state object. By default, they are not.

LD_DETAILS_ONLY_FOR_TRACKED_FLAGS 

Include detailed flag metadata only for flags with event tracking or debugging turned on. This reduces the size of the JSON data if you are passing the flag state to the front end.

LD_CLIENT_SIDE_ONLY 

Include only flags marked for use with the client-side SDK. By default, all flags are included.

Function Documentation

◆ LDAllFlagsStateFree()

void LDAllFlagsStateFree ( struct LDAllFlagsState flags)

Frees memory associated with LDAllFlagsState.

Parameters
[in]flagsLDAllFlagsState handle.

◆ LDAllFlagsStateGetDetails()

struct LDDetails* LDAllFlagsStateGetDetails ( struct LDAllFlagsState flags,
const char *  key 
)

Returns evaluation details for an individual feature flag at the time the state was recorded.

Parameters
[in]flagsLDAllFlagsState handle.
[in]keyFlag key.
Returns
LDDetails structure if the flag was found, otherwise NULL. Caller must not free the returned structure directly; instead, call LDAllFlagsStateFree to free all memory associated with an LDAllFlagsState.

◆ LDAllFlagsStateGetValue()

struct LDJSON* LDAllFlagsStateGetValue ( struct LDAllFlagsState flags,
const char *  key 
)

Returns the JSON value of an individual feature flag at the time the state was recorded.

Parameters
[in]flagsLDAllFlagsState handle.
keyFlag key.
Returns
JSON value of flag, or NULL if the flag was not found. Caller must not free the returned structure directly; instead, call LDAllFlagsStateFree to free all memory associated with an LDAllFlagsState.

◆ LDAllFlagsStateSerializeJSON()

char* LDAllFlagsStateSerializeJSON ( struct LDAllFlagsState flags)

Serializes flag data to JSON.

Parameters
[in]flagsLDAllFlagsState handle.
Returns
Pointer to JSON string. Caller is responsible for freeing with LDFree.

◆ LDAllFlagsStateToValuesMap()

struct LDJSON* LDAllFlagsStateToValuesMap ( struct LDAllFlagsState flags)

Returns a JSON map of flag keys to flag values.

Do not use this method if you are passing data to the front end to "bootstrap" the JavaScript client. Instead, convert the state object to JSON using LDAllFlagsStateSerializeJSON.

Parameters
[in]flagsLDAllFlagsState handle.
Returns
JSON map of flag keys to flag values. The values are references into the LDAllFlagsState object. Caller must not free the map; instead, call LDAllFlagsStateFree.

◆ LDAllFlagsStateValid()

LDBoolean LDAllFlagsStateValid ( struct LDAllFlagsState flags)

Check if a call to LDAllFlagsState succeeded.

Parameters
[in]flagsLDAllFlagsState handle.
Returns
True if the call to LDAllFlagsState succeeded. False if there was an error (such as the data store not being available), in which case no flag data is in this object. It is safe to call LDAllFlagsStateSerializeJSON even if the state is invalid.