C Server-Side SDK
LaunchDarkly SDK
test_data.h
Go to the documentation of this file.
1 
5 #pragma once
6 
7 #include <stdio.h>
8 #include <stdarg.h>
9 
10 #include <launchdarkly/boolean.h>
11 #include <launchdarkly/export.h>
12 #include <launchdarkly/json.h>
14 
66 struct LDTestData;
67 
73 
88 struct LDFlagRuleBuilder;
89 
94 LD_EXPORT(struct LDTestData *)
95 LDTestDataInit(void);
96 
102 LD_EXPORT(void)
103 LDTestDataFree(struct LDTestData *testData);
104 
123 LD_EXPORT(struct LDFlagBuilder *)
124 LDTestDataFlag(struct LDTestData * testData, const char *key);
125 
143 LD_EXPORT(LDBoolean)
144 LDTestDataUpdate(struct LDTestData * testData, struct LDFlagBuilder *flagBuilder);
145 
152 LD_EXPORT(struct LDDataSource *)
154 
166 LD_EXPORT(LDBoolean)
167 LDFlagBuilderBooleanFlag(struct LDFlagBuilder *flagBuilder);
168 
181 LD_EXPORT(void)
182 LDFlagBuilderOn(struct LDFlagBuilder *flagBuilder, LDBoolean on);
183 
194 LD_EXPORT(void)
195 LDFlagBuilderFallthroughVariation(struct LDFlagBuilder *flagBuilder, int variationIndex);
196 
210 LD_EXPORT(LDBoolean)
211 LDFlagBuilderFallthroughVariationBoolean(struct LDFlagBuilder *flagBuilder, LDBoolean value);
212 
222 LD_EXPORT(void)
223 LDFlagBuilderOffVariation(struct LDFlagBuilder *flagBuilder, int variationIndex);
224 
234 LD_EXPORT(LDBoolean)
235 LDFlagBuilderOffVariationBoolean(struct LDFlagBuilder *flagBuilder, LDBoolean value);
236 
237 
249 LD_EXPORT(void)
250 LDFlagBuilderVariationForAllUsers(struct LDFlagBuilder *flagBuilder, int variationIndex);
251 
263 LD_EXPORT(LDBoolean)
264 LDFlagBuilderVariationForAllUsersBoolean(struct LDFlagBuilder *flagBuilder, LDBoolean value);
265 
278 LD_EXPORT(void)
279 LDFlagBuilderValueForAllUsers(struct LDFlagBuilder *flagBuilder, struct LDJSON *value);
280 
296 LD_EXPORT(LDBoolean)
297 LDFlagBuilderVariationForUser(struct LDFlagBuilder *flagBuilder, const char *userKey, int variationIndex);
298 
313 LD_EXPORT(LDBoolean)
314 LDFlagBuilderVariationForUserBoolean(struct LDFlagBuilder *flagBuilder, const char *userKey, LDBoolean value);
315 
327 LD_EXPORT(LDBoolean)
328 LDFlagBuilderVariations(struct LDFlagBuilder *flagBuilder, struct LDJSON *variations);
329 
356 LDFlagBuilderIfMatch(struct LDFlagBuilder *flagBuilder, const char *const attribute, struct LDJSON *values);
357 
384 LDFlagBuilderIfNotMatch(struct LDFlagBuilder *flagBuilder, const char *const attribute, struct LDJSON *values);
385 
407 LD_EXPORT(LDBoolean)
408 LDFlagRuleBuilderAndMatch(struct LDFlagRuleBuilder *ruleBuilder, const char *const attribute, struct LDJSON *values);
409 
431 LD_EXPORT(LDBoolean)
432 LDFlagRuleBuilderAndNotMatch(struct LDFlagRuleBuilder *ruleBuilder, const char *const attribute, struct LDJSON *values);
433 
442 LD_EXPORT(void)
443 LDFlagRuleBuilderThenReturn(struct LDFlagRuleBuilder *ruleBuilder, int variationIndex);
444 
452 LD_EXPORT(LDBoolean)
453 LDFlagRuleBuilderThenReturnBoolean(struct LDFlagRuleBuilder *ruleBuilder, LDBoolean value);
LDDataSource
An opaque data source object.
LDFlagBuilderIfMatch
struct LDFlagRuleBuilder * LDFlagBuilderIfMatch(struct LDFlagBuilder *flagBuilder, const char *const attribute, struct LDJSON *values)
Starts defining a flag rule, using the "is one of" operator.
boolean.h
A custom c89 boolean type.
LDFlagBuilderOffVariationBoolean
LDBoolean LDFlagBuilderOffVariationBoolean(struct LDFlagBuilder *flagBuilder, LDBoolean value)
Specifies the off variation for a boolean flag.
data_source.h
Public API for data source implementation.
LDFlagBuilderVariationForUserBoolean
LDBoolean LDFlagBuilderVariationForUserBoolean(struct LDFlagBuilder *flagBuilder, const char *userKey, LDBoolean value)
Sets the flag to return the specified boolean variation for a specific user key when targeting is on.
LDFlagBuilderValueForAllUsers
void LDFlagBuilderValueForAllUsers(struct LDFlagBuilder *flagBuilder, struct LDJSON *value)
Sets the flag to always return the specified variation value for all users.
LDFlagRuleBuilderAndMatch
LDBoolean LDFlagRuleBuilderAndMatch(struct LDFlagRuleBuilder *ruleBuilder, const char *const attribute, struct LDJSON *values)
Adds another clause, using the "is one of" operator.
LDTestDataCreateDataSource
struct LDDataSource * LDTestDataCreateDataSource(struct LDTestData *)
Create a LDDataSource instance to be used in a client config.
LDFlagBuilderFallthroughVariation
void LDFlagBuilderFallthroughVariation(struct LDFlagBuilder *flagBuilder, int variationIndex)
Specifies the index of the fallthrough variation.
LDFlagBuilderFallthroughVariationBoolean
LDBoolean LDFlagBuilderFallthroughVariationBoolean(struct LDFlagBuilder *flagBuilder, LDBoolean value)
Specifies the fallthrough variation for a boolean flag.
LDFlagBuilder
A builder for feature flag configurations to be used with LDTestData.
Definition: test_data.h:66
LD_EXPORT
#define LD_EXPORT(x)
Used to ensure only intended symbols are exported in the binaries.
Definition: export.h:10
LDFlagRuleBuilderAndNotMatch
LDBoolean LDFlagRuleBuilderAndNotMatch(struct LDFlagRuleBuilder *ruleBuilder, const char *const attribute, struct LDJSON *values)
Adds another clause, using the "is not one of" operator.
LDFlagBuilderVariationForAllUsers
void LDFlagBuilderVariationForAllUsers(struct LDFlagBuilder *flagBuilder, int variationIndex)
Sets the flag to always return the specified variation for all users.
LDFlagRuleBuilderThenReturnBoolean
LDBoolean LDFlagRuleBuilderThenReturnBoolean(struct LDFlagRuleBuilder *ruleBuilder, LDBoolean value)
Finishes defining the rule, specifying the result value as a boolean.
LDFlagRuleBuilderThenReturn
void LDFlagRuleBuilderThenReturn(struct LDFlagRuleBuilder *ruleBuilder, int variationIndex)
Finishes defining the rule, specifying the result as a variation index.
LDFlagBuilderOffVariation
void LDFlagBuilderOffVariation(struct LDFlagBuilder *flagBuilder, int variationIndex)
Specifies the index of the off variation.
LDFlagBuilderVariationForAllUsersBoolean
LDBoolean LDFlagBuilderVariationForAllUsersBoolean(struct LDFlagBuilder *flagBuilder, LDBoolean value)
Sets the flag to always return the specified boolean variation for all users.
LDTestDataFlag
struct LDFlagBuilder * LDTestDataFlag(struct LDTestData *testData, const char *key)
Creates or copies a LDFlagBuilder for building a test flag configuration.
LDFlagBuilderIfNotMatch
struct LDFlagRuleBuilder * LDFlagBuilderIfNotMatch(struct LDFlagBuilder *flagBuilder, const char *const attribute, struct LDJSON *values)
Starts defining a flag rule, using the "is not one of" operator.
LDFlagBuilderVariations
LDBoolean LDFlagBuilderVariations(struct LDFlagBuilder *flagBuilder, struct LDJSON *variations)
json.h
Public API Interface for JSON usage.
LDTestDataUpdate
LDBoolean LDTestDataUpdate(struct LDTestData *testData, struct LDFlagBuilder *flagBuilder)
Updates the test data with the specified flag configuration.
LDFlagRuleBuilder
A builder for feature flag rules to be used with LDTestData.
Definition: test_data.h:72
LDTestDataFree
void LDTestDataFree(struct LDTestData *testData)
Free all of the data associated with the test data source.
LDFlagBuilderBooleanFlag
LDBoolean LDFlagBuilderBooleanFlag(struct LDFlagBuilder *flagBuilder)
A shortcut for setting the flag to use the standard boolean configuration.
LDTestData
An opaque TestData object.
LDFlagBuilderVariationForUser
LDBoolean LDFlagBuilderVariationForUser(struct LDFlagBuilder *flagBuilder, const char *userKey, int variationIndex)
Sets the flag to return the specified variation for a specific user key when targeting is on.
LDFlagBuilderOn
void LDFlagBuilderOn(struct LDFlagBuilder *flagBuilder, LDBoolean on)
Sets targeting to be on or off for this flag.
LDTestDataInit
struct LDTestData * LDTestDataInit(void)
Creates a new instance of the LDTestData data source.
export.h
Public. Configuration of exported symbols.