public static class GetSocial.User
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
addAuthIdentity(AuthIdentity authIdentity,
AddAuthIdentityCallback callback)
Adds AuthIdentity for the specified provider.
|
static void |
addFriend(java.lang.String userId,
Callback<java.lang.Integer> callback)
Add a friend for current user, if operation succeed - they both became friends.
|
static void |
addFriendsByAuthIdentities(java.lang.String providerId,
java.util.List<java.lang.String> providerUserIds,
Callback<java.lang.Integer> callback)
Add a list of users to the list of current user friends.
|
static java.util.Map<java.lang.String,java.lang.String> |
getAllPrivateProperties()
Get all private properties of current user.
|
static java.util.Map<java.lang.String,java.lang.String> |
getAllPublicProperties()
Get all public properties of current user.
|
static java.util.Map<java.lang.String,java.lang.String> |
getAuthIdentities()
Returns all auth identities added to the user.
|
static java.lang.String |
getAvatarUrl()
Avatar URL.
|
static java.lang.String |
getDisplayName()
User display name.
|
static void |
getFriends(int offset,
int limit,
Callback<java.util.List<PublicUser>> callback)
Get a list of friends for current user.
|
static void |
getFriendsCount(Callback<java.lang.Integer> callback)
Get count of friends.
|
static void |
getFriendsReferences(Callback<java.util.List<UserReference>> callback)
Get a list of friends references for current user.
|
static java.lang.String |
getId()
Returns id of the user.
|
static void |
getNotifications(NotificationsQuery query,
Callback<java.util.List<Notification>> callback)
Get the list of notifications for current user.
|
static void |
getNotificationsCount(NotificationsCountQuery query,
Callback<java.lang.Integer> callback)
Get a number of notifications for current user.
|
static java.lang.String |
getPrivateProperty(java.lang.String key)
Returns the value of a private property on the current user with the specified key.
|
static java.lang.String |
getPublicProperty(java.lang.String key)
Returns the value of a public property on the current user with the specified key.
|
static void |
getSuggestedFriends(int offset,
int limit,
Callback<java.util.List<SuggestedFriend>> callback)
Get a list of suggested friends for current user.
|
static boolean |
hasPrivateProperty(java.lang.String key)
Checks if private property exists for the specified key.
|
static boolean |
hasPublicProperty(java.lang.String key)
Checks if public property exists for the specified key.
|
static boolean |
isAnonymous()
Indicates if the user has at least one auth identity available.
|
static void |
isFriend(java.lang.String userId,
Callback<java.lang.Boolean> callback)
Check if user is your friend.
|
static void |
isPushNotificationsEnabled(Callback<java.lang.Boolean> callback)
Check if PNs are enabled for current user.
|
static void |
removeAuthIdentity(java.lang.String providerId,
CompletionCallback callback)
Removes AuthIdentity for the specified provider.
|
static void |
removeFriend(java.lang.String userId,
Callback<java.lang.Integer> callback)
Remove a user from friends list.
|
static void |
removeFriendsByAuthIdentities(java.lang.String providerId,
java.util.List<java.lang.String> providerUserIds,
Callback<java.lang.Integer> callback)
Remove a list of users for list of current user's friends.
|
static boolean |
removeOnUserChangedListener()
Remove current listener.
|
static void |
removePrivateProperty(java.lang.String key,
CompletionCallback callback)
Removes one of the private properties of the authenticated user.
|
static void |
removePublicProperty(java.lang.String key,
CompletionCallback callback)
Removes one of the public properties of the authenticated user.
|
static void |
reset(CompletionCallback completionCallback)
Reset current user and create new anonymous one.
|
static void |
sendNotification(java.util.List<java.lang.String> userIds,
NotificationContent notificationContent,
Callback<NotificationsSummary> callback)
Send notification to any GetSocial user.
|
static void |
setAvatar(android.graphics.Bitmap avatar,
CompletionCallback callback)
Set new avatar for the current user.
|
static void |
setAvatarUrl(java.lang.String avatarUrl,
CompletionCallback callback)
Set new avatar url for the current user.
|
static void |
setDisplayName(java.lang.String displayName,
CompletionCallback callback)
Requests setting a new display name for the current user.
|
static void |
setFriends(java.util.List<java.lang.String> userIds,
CompletionCallback callback)
Replace existing friends with the provided list of users.
|
static void |
setFriendsByAuthIdentities(java.lang.String providerId,
java.util.List<java.lang.String> providerUserIds,
CompletionCallback callback)
Replace existing friends with the provided list of users.
|
static void |
setNotificationsRead(java.util.List<java.lang.String> notificationIds,
boolean read,
CompletionCallback callback)
Deprecated.
|
static void |
setNotificationsStatus(java.util.List<java.lang.String> notificationIds,
java.lang.String status,
CompletionCallback callback)
Set notifications status to one of
NotificationStatus . |
static boolean |
setOnUserChangedListener(OnUserChangedListener listener)
Set listener to be notified when the user was changed.
|
static void |
setPrivateProperty(java.lang.String key,
java.lang.String value,
CompletionCallback callback)
Set the private property with specified key and value for the authenticated user.
|
static void |
setPublicProperty(java.lang.String key,
java.lang.String value,
CompletionCallback callback)
Set the public property with specified key and value for the authenticated user.
|
static void |
setPushNotificationsEnabled(boolean isEnabled,
CompletionCallback completionCallback)
If set to `false` - current user won't receive GetSocial notifications anymore, until called with `true`.
|
static void |
setUserDetails(UserUpdate userUpdate,
CompletionCallback callback)
Requests a bulk change of properties for the current user.
|
static void |
switchUser(AuthIdentity authIdentity,
CompletionCallback callback)
Switches the current user with the
PublicUser corresponding to the details provided. |
public static boolean setOnUserChangedListener(OnUserChangedListener listener)
OnUserChangedListener.onUserChanged()
method.
Listener will be invoked when:
- SDK initialization is finished;
- switchUser(im.getsocial.sdk.usermanagement.AuthIdentity, im.getsocial.sdk.CompletionCallback)
method was called and user was successfully changed.listener
- Listener to be notified.public static boolean removeOnUserChangedListener()
public static void setUserDetails(UserUpdate userUpdate, CompletionCallback callback)
userUpdate
- Update parameter.callback
- A callback to indicate if this operation was successful.public static void setPublicProperty(java.lang.String key, java.lang.String value, CompletionCallback callback)
key
- The property key (Maximum length 64 characters).value
- The property value (Maximum length 1024 characters).callback
- A callback to indicate if this operation was successful.public static void setPrivateProperty(java.lang.String key, java.lang.String value, CompletionCallback callback)
key
- The property key (Maximum length 64 characters).value
- The property value (Maximum length 1024 characters).callback
- A callback to indicate if this operation was successful.public static void removePublicProperty(java.lang.String key, CompletionCallback callback)
key
- The property key (Maximum length 64 characters).callback
- A callback to indicate if this operation was successful.public static void removePrivateProperty(java.lang.String key, CompletionCallback callback)
key
- The property key (Maximum length 64 characters).callback
- A callback to indicate if this operation was successful.public static java.lang.String getPublicProperty(java.lang.String key)
key
- The property key.public static java.lang.String getPrivateProperty(java.lang.String key)
key
- The property key.public static boolean hasPublicProperty(java.lang.String key)
key
- Property key.public static boolean hasPrivateProperty(java.lang.String key)
key
- Property key.public static java.util.Map<java.lang.String,java.lang.String> getAllPublicProperties()
setPublicProperty(String, String, CompletionCallback)
and removePublicProperty(String, CompletionCallback)
.public static java.util.Map<java.lang.String,java.lang.String> getAllPrivateProperties()
setPrivateProperty(String, String, CompletionCallback)
and removePrivateProperty(String, CompletionCallback)
.public static java.lang.String getId()
public static void setDisplayName(java.lang.String displayName, CompletionCallback callback)
displayName
- The proposed new displayName (Maximum length 32 characters).callback
- A callback to indicate if this operation was successful.public static java.lang.String getDisplayName()
public static void setAvatarUrl(java.lang.String avatarUrl, CompletionCallback callback)
avatarUrl
- The proposed new avatarUrl (Maximum length 2048 characters).callback
- A callback to indicate if this operation was successful.public static void setAvatar(android.graphics.Bitmap avatar, CompletionCallback callback)
avatar
- The proposed new avatar.callback
- A callback to indicate if this operation was successful.public static java.lang.String getAvatarUrl()
public static boolean isAnonymous()
public static void addAuthIdentity(AuthIdentity authIdentity, AddAuthIdentityCallback callback)
authIdentity
- AuthIdentity to be added.callback
- A callback to indicate if this operation was
successful or if there was a conflict.public static void switchUser(AuthIdentity authIdentity, CompletionCallback callback)
PublicUser
corresponding to the details provided.authIdentity
- AuthIdentity to be switched to.callback
- A callback to indicate if this operation was successful.public static void removeAuthIdentity(java.lang.String providerId, CompletionCallback callback)
providerId
- The provider connected to an auth identity on the current user to remove.
Valid providerIds are found in AuthIdentityProviderIds
in addition to custom providers.callback
- A callback to indicate if this operation was successful.public static java.util.Map<java.lang.String,java.lang.String> getAuthIdentities()
addAuthIdentity(AuthIdentity, AddAuthIdentityCallback)
and removeAuthIdentity(String, CompletionCallback)
.
The key(providerId) is the one you've passed as a first parameter to AuthIdentity.createCustomIdentity(String, String, String)
or AuthIdentityProviderIds.FACEBOOK
if you've created Facebook identity with AuthIdentity.createFacebookIdentity(String)
.
Read more about identities in the documentation.
The value(userId) is the second parameter in AuthIdentity.createCustomIdentity(String, String, String)
or automatically obtained by GetSocial if you've used Facebook identity.public static void addFriend(java.lang.String userId, Callback<java.lang.Integer> callback)
Callback.onSuccess(Object)
will be called,
but user will be added to your friends list only once and your friends count won't be increased.userId
- Unique user identifier you want to become friend with.callback
- A callback to indicate if this operation was successful.public static void addFriendsByAuthIdentities(java.lang.String providerId, java.util.List<java.lang.String> providerUserIds, Callback<java.lang.Integer> callback)
providerId
- A auth identity provider id for which user ids will be provided. Can be "facebook", or any custom value.providerUserIds
- A list of user ids on the selected identity provider that need to be added to the current user's friends list.callback
- A callback to indicate if this operation was successful. Returns the updated count of friends.public static void removeFriend(java.lang.String userId, Callback<java.lang.Integer> callback)
Callback.onSuccess(Object)
will be called,
and your friends count won't be decreased.userId
- Unique user identifier you don't want to be friends anymore.callback
- A callback to indicate if this operation was successful.public static void removeFriendsByAuthIdentities(java.lang.String providerId, java.util.List<java.lang.String> providerUserIds, Callback<java.lang.Integer> callback)
providerId
- A auth identity provider id for which user ids will be provided. Can be "facebook", or any custom value.providerUserIds
- A list of user ids on the selected identity provider that need to be removed from the current user's friends list.callback
- A callback to indicate if this operation was successful. Returns the updated count of friends.public static void setFriends(java.util.List<java.lang.String> userIds, CompletionCallback callback)
userIds
- List of GetSocial user identifiers.callback
- A callback to indicate if this operation was successful.public static void setFriendsByAuthIdentities(java.lang.String providerId, java.util.List<java.lang.String> providerUserIds, CompletionCallback callback)
providerId
- A auth identity provider id for which user ids will be provided. Can be "facebook", or any custom value.providerUserIds
- A list of user ids on the selected identity provider that will be set as the current user's friends list.callback
- A callback to indicate if this operation was successful.public static void isFriend(java.lang.String userId, Callback<java.lang.Boolean> callback)
userId
- Unique user identifier.callback
- Called with true, if user is your friend, false otherwisepublic static void getFriendsCount(Callback<java.lang.Integer> callback)
callback
- Called with count of friends.public static void getFriends(int offset, int limit, Callback<java.util.List<PublicUser>> callback)
offset
- Position from which start.limit
- Limit of users.callback
- Called with list of users that are friends of current user.public static void getSuggestedFriends(int offset, int limit, Callback<java.util.List<SuggestedFriend>> callback)
offset
- Position from which start.limit
- Limit of users.callback
- Called with list of users that are friends of current user.public static void getFriendsReferences(Callback<java.util.List<UserReference>> callback)
UserReference
is lightweight representation of
PublicUser
.callback
- Called with list of users that are friends of current user.public static void getNotifications(NotificationsQuery query, Callback<java.util.List<Notification>> callback)
query
- Notifications query.callback
- Callback to be invoked with a list of notifications.public static void getNotificationsCount(NotificationsCountQuery query, Callback<java.lang.Integer> callback)
query
- Notifications count query.callback
- Callback to be invoked with a number of notifications.@Deprecated public static void setNotificationsRead(java.util.List<java.lang.String> notificationIds, boolean read, CompletionCallback callback)
setNotificationsStatus(List, String, CompletionCallback)
.notificationIds
- List of notifications IDs to change the read status.read
- Read or unread.callback
- A callback to indicate if this operation was successful.public static void setNotificationsStatus(java.util.List<java.lang.String> notificationIds, java.lang.String status, CompletionCallback callback)
NotificationStatus
.notificationIds
- List of notifications IDs to change the read status.status
- One of NotificationStatus
.callback
- A callback to indicate if this operation was successful.public static void sendNotification(java.util.List<java.lang.String> userIds, NotificationContent notificationContent, Callback<NotificationsSummary> callback)
SendNotificationPlaceholders.Receivers
.userIds
- List of user IDs or placeholders who will receive the notification.notificationContent
- Content of push notification.callback
- Notifies if operation was successfull.public static void setPushNotificationsEnabled(boolean isEnabled, CompletionCallback completionCallback)
isEnabled
- Disabled or enable PNs.completionCallback
- A callback to indicate if this operation was successful.public static void isPushNotificationsEnabled(Callback<java.lang.Boolean> callback)
callback
- Called with `true` if is enabled, with `false` otherwise.public static void reset(CompletionCallback completionCallback)
(c) Copyright GetSocial BV, 2019. All Rights Reserved.