Module ldclient_user

User data type.

Description

User data type

Data Types

attribute()

attribute() = binary() | atom()

custom_attributes()

custom_attributes() = #{binary() := any()}

key()

key() = binary() | null

private_attribute_names()

private_attribute_names() = [binary()]

user()

user() = #{key := key(), secondary => binary(), ip => binary(), country => binary(), email => binary(), first_name => binary(), last_name => binary(), avatar => binary(), name => binary(), anonymous => boolean(), custom => custom_attributes(), private_attribute_names => private_attribute_names()}

Function Index

event_format/1Formats a user for use in an event.
get/2Get an attribute value of a user.
new/1
new_from_map/1
scrub/2Scrub private attributes from user.
set/3Set an attribute value for a user.
set_private_attribute_names/2Sets a list of private attribute names for a user.

Function Details

event_format/1

event_format(User::user()) -> user()

Formats a user for use in an event.

Returns the user with first_name and last_name attributes changed to firstName and lastName so that LaunchDarkly can properly record user data.

get/2

get(Attribute::attribute(), User::user()) -> term()

Get an attribute value of a user

Lookup includes custom attributes. Returns null if attribute doesn't exist.

new/1

new(Key::key()) -> user()

new_from_map/1

new_from_map(Map::map()) -> user()

scrub/2

scrub(User::user(), GlobalPrivateAttributes::ldclient_config:private_attributes()) -> {user(), private_attribute_names()}

Scrub private attributes from user

Returns the scrubbed user and the list of attributes that were actually scrubbed.

set/3

set(Attribute::attribute(), Value::any(), User::user()) -> user()

Set an attribute value for a user

Sets given attribute to given value and returns the new user. This function can handle both built-in and custom user attributes.

set_private_attribute_names/2

set_private_attribute_names(AttributeNames::[attribute()], User::user()) -> user()

Sets a list of private attribute names for a user

Any attributes that are on this list will not be sent to and indexed by LaunchDarkly. However, they are still available for flag evaluations performed by the SDK locally. This handles both built-in and custom attributes. The built-in key attribute cannot be made private - it will always be sent.


Generated by EDoc