public class User
extends java.lang.Object
Constructor and Description |
---|
User() |
Modifier and Type | Method and Description |
---|---|
void |
addMetadata(java.util.Map<java.lang.String,java.lang.Object> metadata)
Adds custom metadata to the user.
|
static User |
getCurrentUser()
Returns the object representing the current user.
|
java.lang.String |
getEmail()
String representing the user's email
|
java.lang.String |
getExternalId()
String representing the user's externalId.
|
java.lang.String |
getFirstName()
String representing the user's first name
|
java.lang.String |
getLastName()
String representing the user's last name
|
java.util.Map<java.lang.String,java.lang.Object> |
getMetadata()
Map representing the user's custom metadata
|
java.util.Date |
getSignedUpAt()
Date representing the date the user signed up
|
java.lang.String |
getUserId()
The assigned userId for this user.
|
boolean |
hasPaymentInfo()
Boolean describing whether or not the user has payment information stored
|
void |
setEmail(java.lang.String email)
The user's email, to be used to display a gravatar.
|
void |
setFirstName(java.lang.String firstName)
The user's first name, to be used as part of the display name when sending messages.
|
void |
setLastName(java.lang.String lastName)
The user's last name, to be used as part of the display name when sending messages.
|
void |
setSignedUpAt(java.util.Date signedUpAt)
The date the user started using your service
|
public static User getCurrentUser()
public void setEmail(java.lang.String email)
email
- The emailpublic void setFirstName(java.lang.String firstName)
firstName
- The first namepublic void setLastName(java.lang.String lastName)
lastName
- The last namepublic void setSignedUpAt(java.util.Date signedUpAt)
signedUpAt
- The sign up datepublic void addMetadata(java.util.Map<java.lang.String,java.lang.Object> metadata)
Values must be of type String, Integer, Long, Float, Double, or Date; any other type will be converted to String using the toString() method.
Changes to user metadata are uploaded in batches at regular intervals, when the app is sent to the background, or when a message is sent. This API is additive, and subsequent calls will override values for the provided keys.
metadata
- Map of metadatapublic java.lang.String getEmail()
public java.lang.String getFirstName()
public java.lang.String getLastName()
public java.util.Date getSignedUpAt()
public java.util.Map<java.lang.String,java.lang.Object> getMetadata()
public java.lang.String getExternalId()
BrandMessenger.login(String, String, BrandMessengerCallback)
.
Unlike userId
, this value is assigned and managed by the developer, and is
used to identify a user across devices and app installations.
public java.lang.String getUserId()
Unlike getExternalId()
, this property is set automatically by BrandMessenger, and is not configurable.
This is analogous to appUser._id
in the REST API response. A user is assigned an
userId
once they start a conversation or when an existing user is logged in
by calling BrandMessenger.login(String, String, BrandMessengerCallback)
.
public boolean hasPaymentInfo()