Public API for Client operations.
More...
Go to the source code of this file.
|
struct LDClient * | LDClientInit (struct LDConfig *const config, const unsigned int maxwaitmilli) |
| Initialize a new client, and connect to LaunchDarkly. It's important to make LDClient a singleton. The client instance maintains internal state that allows LaunchDarkly to serve feature flags without making any remote requests. Do not instantiate a new client with every request. More...
|
|
LDBoolean | LDClientClose (struct LDClient *const client) |
| Shuts down the LaunchDarkly client. This will block until all resources have been freed. It is not safe to use the client during or after this operation. It is safe to initialize another client after this operation is completed. More...
|
|
LDBoolean | LDClientIsInitialized (struct LDClient *const client) |
| Check if a client has been fully initialized. This may be useful if the initialization timeout was reached in LDClientInit . More...
|
|
LDBoolean | LDClientTrack (struct LDClient *const client, const char *const key, const struct LDUser *const user, struct LDJSON *const data) |
| Reports that a user has performed an event. Custom data can be attached to the event as JSON. More...
|
|
LDBoolean | LDClientTrackMetric (struct LDClient *const client, const char *const key, const struct LDUser *const user, struct LDJSON *const data, const double metric) |
| Reports that a user has performed an event. Custom data, and a metric can be attached to the event as JSON. More...
|
|
LDBoolean | LDClientAlias (struct LDClient *const client, const struct LDUser *const currentUser, const struct LDUser *const previousUser) |
| Record a alias event. More...
|
|
LDBoolean | LDClientIdentify (struct LDClient *const client, const struct LDUser *const user) |
| Generates an identify event for a user, if the user's key is non-empty. More...
|
|
LDBoolean | LDClientIsOffline (struct LDClient *const client) |
| Whether the LaunchDarkly client is in offline mode. More...
|
|
LDBoolean | LDClientFlush (struct LDClient *const client) |
| Immediately flushes queued events. More...
|
|
Public API for Client operations.
◆ LDClientAlias()
LDBoolean LDClientAlias |
( |
struct LDClient *const |
client, |
|
|
const struct LDUser *const |
currentUser, |
|
|
const struct LDUser *const |
previousUser |
|
) |
| |
Record a alias event.
- Parameters
-
[in] | client | The client to use. May not be NULL . |
[in] | currentUser | The new version of a user. Ownership is not transferred. May not be NULL . |
[in] | previousUser | The previous version of a user. Ownership is not transferred. May not be NULL . |
- Returns
- True if the event was queued successfully, or if analytics events are disabled. False on error.
◆ LDClientClose()
LDBoolean LDClientClose |
( |
struct LDClient *const |
client | ) |
|
Shuts down the LaunchDarkly client. This will block until all resources have been freed. It is not safe to use the client during or after this operation. It is safe to initialize another client after this operation is completed.
- Parameters
-
[in] | client | The client to use. May be NULL . |
- Returns
- True on success, False on failure.
◆ LDClientFlush()
LDBoolean LDClientFlush |
( |
struct LDClient *const |
client | ) |
|
Immediately flushes queued events.
- Parameters
-
[in] | client | The client to use. May not be NULL . |
- Returns
- True if signalled, False on error.
◆ LDClientIdentify()
LDBoolean LDClientIdentify |
( |
struct LDClient *const |
client, |
|
|
const struct LDUser *const |
user |
|
) |
| |
Generates an identify event for a user, if the user's key is non-empty.
- Parameters
-
[in] | client | The client to use. May not be NULL . |
[in] | user | The user to generate the event for. Ownership is not transferred. May not be NULL . |
- Returns
- True if the event was queued successfully, or if analytics events are disabled. False on error.
◆ LDClientInit()
struct LDClient* LDClientInit |
( |
struct LDConfig *const |
config, |
|
|
const unsigned int |
maxwaitmilli |
|
) |
| |
Initialize a new client, and connect to LaunchDarkly. It's important to make LDClient a singleton. The client instance maintains internal state that allows LaunchDarkly to serve feature flags without making any remote requests. Do not instantiate a new client with every request.
- Parameters
-
[in] | config | The client configuration. Ownership of config is transferred. |
[in] | maxwaitmilli | How long to wait for flags to download. If the timeout is reached a non fully initialized client will be returned. |
- Returns
- A fresh client.
◆ LDClientIsInitialized()
LDBoolean LDClientIsInitialized |
( |
struct LDClient *const |
client | ) |
|
Check if a client has been fully initialized. This may be useful if the initialization timeout was reached in LDClientInit
.
- Parameters
-
[in] | client | The client to use. May not be NULL . |
- Returns
- True if fully initialized, False if not or on error.
◆ LDClientIsOffline()
LDBoolean LDClientIsOffline |
( |
struct LDClient *const |
client | ) |
|
Whether the LaunchDarkly client is in offline mode.
- Parameters
-
[in] | client | The client to use. May not be NULL . |
- Returns
- True if offline, False if not or on error.
◆ LDClientTrack()
LDBoolean LDClientTrack |
( |
struct LDClient *const |
client, |
|
|
const char *const |
key, |
|
|
const struct LDUser *const |
user, |
|
|
struct LDJSON *const |
data |
|
) |
| |
Reports that a user has performed an event. Custom data can be attached to the event as JSON.
- Parameters
-
[in] | client | The client to use. May not be NULL . |
[in] | key | The name of the event. May not be NULL . |
[in] | user | The user to generate the event for. Ownership is not transferred. May not be NULL . |
[in] | data | The JSON to attach to the event. Ownership of data is transferred only if True is returned. May be NULL . |
- Returns
- True if the event was queued successfully, or if analytics events are disabled. False on error.
◆ LDClientTrackMetric()
LDBoolean LDClientTrackMetric |
( |
struct LDClient *const |
client, |
|
|
const char *const |
key, |
|
|
const struct LDUser *const |
user, |
|
|
struct LDJSON *const |
data, |
|
|
const double |
metric |
|
) |
| |
Reports that a user has performed an event. Custom data, and a metric can be attached to the event as JSON.
- Parameters
-
[in] | client | The client to use. May not be NULL . |
[in] | key | The name of the event. May not be NULL . |
[in] | user | The user to generate the event for. Ownership is not transferred. May not be NULL . |
[in] | data | The JSON to attach to the event. Ownership of data is transferred. May be NULL . |
[in] | metric | A metric to be associated with the event. |
- Returns
- True if the event was queued successfully, or if analytics events are disabled. False on error.