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

Public API Interface for User construction. More...

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

Go to the source code of this file.

Functions

struct LDUserLDUserNew (const char *const key)
 Allocate a new empty user Object. More...
 
void LDUserFree (struct LDUser *const user)
 Destroy an existing user object. More...
 
void LDUserSetAnonymous (struct LDUser *const user, const LDBoolean anon)
 Mark the user as anonymous. More...
 
LDBoolean LDUserSetIP (struct LDUser *const user, const char *const ip)
 Set the user's IP. More...
 
LDBoolean LDUserSetFirstName (struct LDUser *const user, const char *const firstName)
 Set the user's first name. More...
 
LDBoolean LDUserSetLastName (struct LDUser *const user, const char *const lastName)
 Set the user's last name. More...
 
LDBoolean LDUserSetEmail (struct LDUser *const user, const char *const email)
 Set the user's email. More...
 
LDBoolean LDUserSetName (struct LDUser *const user, const char *const name)
 Set the user's name. More...
 
LDBoolean LDUserSetAvatar (struct LDUser *const user, const char *const avatar)
 Set the user's avatar. More...
 
LDBoolean LDUserSetCountry (struct LDUser *const user, const char *const country)
 Set the user's country. More...
 
LDBoolean LDUserSetSecondary (struct LDUser *const user, const char *const secondary)
 Set the user's secondary key. More...
 
void LDUserSetCustom (struct LDUser *const user, struct LDJSON *const custom)
 Set the user's custom JSON. More...
 
LDBoolean LDUserAddPrivateAttribute (struct LDUser *const user, const char *const attribute)
 Mark an attribute as private. More...
 
void LDUserSetPrivateAttributes (struct LDUser *const user, struct LDJSON *const privateAttributes)
 Mark a set of attributes as private. More...
 
void LDUserSetCustomAttributesJSON (struct LDUser *const user, struct LDJSON *const custom)
 Set the user's custom field. More...
 

Detailed Description

Public API Interface for User construction.

Function Documentation

◆ LDUserAddPrivateAttribute()

LDBoolean LDUserAddPrivateAttribute ( struct LDUser *const  user,
const char *const  attribute 
)

Mark an attribute as private.

Parameters
[in]userThe user to mutate. May not be NULL.
[in]attributeAttribute to mark as private. May not be NULL.
Returns
True on success, False on failure.

◆ LDUserFree()

void LDUserFree ( struct LDUser *const  user)

Destroy an existing user object.

Parameters
[in]userThe user free. May be NULL.
Returns
Void.

◆ LDUserNew()

struct LDUser* LDUserNew ( const char *const  key)

Allocate a new empty user Object.

Parameters
[in]keyA string that identifies the user. For c-server-sdk this value may not be NULL. For c-client-sdk if a NULL key is provided the SDK will use a persistent platform identifier. If a identifier cannot be determined a non persistent fallback will be generated.
Returns
NULL on failure.

◆ LDUserSetAnonymous()

void LDUserSetAnonymous ( struct LDUser *const  user,
const LDBoolean  anon 
)

Mark the user as anonymous.

Parameters
[in]userThe user to mutate. May not be NULL.
[in]anonIf the user should be anonymous or not.
Returns
Void.

◆ LDUserSetAvatar()

LDBoolean LDUserSetAvatar ( struct LDUser *const  user,
const char *const  avatar 
)

Set the user's avatar.

Parameters
[in]userThe user to mutate. May not be NULL.
[in]avatarThe user's avatar. May be NULL.
Returns
True on success, False on failure.

◆ LDUserSetCountry()

LDBoolean LDUserSetCountry ( struct LDUser *const  user,
const char *const  country 
)

Set the user's country.

Parameters
[in]userThe user to mutate. May not be NULL.
[in]countryThe user's country. May be NULL.
Returns
True on success, False on failure.

◆ LDUserSetCustom()

void LDUserSetCustom ( struct LDUser *const  user,
struct LDJSON *const  custom 
)

Set the user's custom JSON.

Parameters
[in]userThe user to mutate. May not be NULL.
[in]customCustom JSON for the user. May be NULL.
Returns
Void.

◆ LDUserSetCustomAttributesJSON()

void LDUserSetCustomAttributesJSON ( struct LDUser *const  user,
struct LDJSON *const  custom 
)

Set the user's custom field.

Deprecated:
This is deprecated in favor of LDUserSetCustom.

◆ LDUserSetEmail()

LDBoolean LDUserSetEmail ( struct LDUser *const  user,
const char *const  email 
)

Set the user's email.

Parameters
[in]userThe user to mutate. May not be NULL.
[in]emailThe user's email. May be NULL.
Returns
True on success, False on failure.

◆ LDUserSetFirstName()

LDBoolean LDUserSetFirstName ( struct LDUser *const  user,
const char *const  firstName 
)

Set the user's first name.

Parameters
[in]userThe user to mutate. May not be NULL.
[in]firstNameThe user's first name. May be NULL.
Returns
True on success, False on failure.

◆ LDUserSetIP()

LDBoolean LDUserSetIP ( struct LDUser *const  user,
const char *const  ip 
)

Set the user's IP.

Parameters
[in]userThe user to mutate. May not be NULL.
[in]ipThe user's IP. May be NULL.
Returns
True on success, False on failure.

◆ LDUserSetLastName()

LDBoolean LDUserSetLastName ( struct LDUser *const  user,
const char *const  lastName 
)

Set the user's last name.

Parameters
[in]userThe user to mutate. May not be NULL.
[in]lastNameThe user's last name. May be NULL.
Returns
True on success, False on failure.

◆ LDUserSetName()

LDBoolean LDUserSetName ( struct LDUser *const  user,
const char *const  name 
)

Set the user's name.

Parameters
[in]userThe user to mutate. May not be NULL.
[in]nameThe user's name. May be NULL.
Returns
True on success, False on failure.

◆ LDUserSetPrivateAttributes()

void LDUserSetPrivateAttributes ( struct LDUser *const  user,
struct LDJSON *const  privateAttributes 
)

Mark a set of attributes as private.

Parameters
[in]userThe user to mutate. May not be NULL.
[in]attributeThe set of attributes to mark as private. Must be an array of strings. May not be NULL.
Returns
Void.

◆ LDUserSetSecondary()

LDBoolean LDUserSetSecondary ( struct LDUser *const  user,
const char *const  secondary 
)

Set the user's secondary key.

Parameters
[in]userThe user to mutate. May not be NULL.
[in]secondaryThe user's secondary key. May be NULL.
Returns
True on success, False on failure.