Package io.outbound.sdk
Class User
- java.lang.Object
-
- io.outbound.sdk.User
-
public class User extends java.lang.Object
Model of an Outbound user.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static class
User.Builder
Constructs new Outbound Users.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.util.Map<java.lang.String,java.lang.Object>
getAttributes()
Get the user's attributes.java.lang.String
getEmail()
Get the user's email address if set.java.lang.String
getFcmToken()
Get the user's FCM token if set.java.lang.String
getFirstName()
Get the user's first name if set.java.util.Map<java.lang.String,java.lang.Object>
getGroupAttributes()
Get any group attributes associated with the user if any are set.java.lang.String
getGroupId()
Get the user's group number if they belong to a group.java.lang.String
getLastName()
Get the user's last name if set.java.lang.String
getPhoneNumber()
Get the user's phone number if set.java.lang.String
getPreviousId()
Get the user's previous id if they were aliased.java.lang.String
getUserId()
Get the user's ID.boolean
hasFcmToken()
Check if the user has a FCM token set.boolean
isAnonymous()
Determine if the user is anonymous or explicitly identified.static User
newAnonymousUser()
void
setFcmToken(java.lang.String fcm)
Set the user's FCM token.void
setPrevioudId(java.lang.String prevId)
When identifying a user, if an anonymous user was previously created, we need to alias those 2 users.
-
-
-
Method Detail
-
isAnonymous
public boolean isAnonymous()
Determine if the user is anonymous or explicitly identified.- Returns:
- true if the user is anonymous, false otherwise
-
getUserId
public java.lang.String getUserId()
Get the user's ID.- Returns:
- the user ID
-
getFirstName
public java.lang.String getFirstName()
Get the user's first name if set. Could return null.- Returns:
- the user's first name
-
getLastName
public java.lang.String getLastName()
Get the user's last name if set. Could return null.- Returns:
- the user's last name
-
getEmail
public java.lang.String getEmail()
Get the user's email address if set. Could return null.- Returns:
- the user's email
-
getFcmToken
public java.lang.String getFcmToken()
Get the user's FCM token if set. Could return null.FCM token is only added to the user after they have been identified. This is not a shortcut for retrieving the token from FCM.
- Returns:
- the user's FCM token if set, null otherwise
-
setFcmToken
public void setFcmToken(java.lang.String fcm)
Set the user's FCM token.- Parameters:
fcm
- the new FCM token
-
hasFcmToken
public boolean hasFcmToken()
Check if the user has a FCM token set.- Returns:
- true if token is set, false otherwise
-
getPhoneNumber
public java.lang.String getPhoneNumber()
Get the user's phone number if set. Could return null.This method does NOT get the device's phone number. A phone number must be set when creating a user.
- Returns:
- the user's phone number
-
getAttributes
public java.util.Map<java.lang.String,java.lang.Object> getAttributes()
Get the user's attributes. Could possibly return null or an empty Map.Attributes do not include any top level attributes such as email, phone number, first and last name or FCM token.
- Returns:
- the user attributes
-
getGroupId
public java.lang.String getGroupId()
Get the user's group number if they belong to a group. Could return null.- Returns:
- the user's group ID
-
getGroupAttributes
public java.util.Map<java.lang.String,java.lang.Object> getGroupAttributes()
Get any group attributes associated with the user if any are set. Could return null or an empty Map.- Returns:
- the users's group attributes
-
setPrevioudId
public void setPrevioudId(java.lang.String prevId)
When identifying a user, if an anonymous user was previously created, we need to alias those 2 users. by setting the previous id of a user to that of the anonymous user the 2 users become the same user.- Parameters:
prevId
- the user's previous ID
-
getPreviousId
public java.lang.String getPreviousId()
Get the user's previous id if they were aliased. Could return null.- Returns:
- the user's previous ID
-
newAnonymousUser
public static User newAnonymousUser()
-
-