GetSocialUser Class Reference

Inherits from NSObject
Declared in GetSocialUser.h

Properties and Methods

Update Properties

+ setPublicPropertyValue:forKey:success:failure:

Set the public property with specified key and value for the authenticated user. If you pass empty string as value, it will remove the property. Nil values are not allowed.

+ (void)setPublicPropertyValue:(NSString *)propertyValue forKey:(NSString *)propertyKey success:(GetSocialSuccessCallback)success failure:(GetSocialFailureCallback)failure

Parameters

propertyValue

The property value (Maximum length 1024 characters).

propertyKey

The property key (Maximum length 64 characters).

success

Success block.

failure

Failure block.

Declared In

GetSocialUser.h

+ setPrivatePropertyValue:forKey:success:failure:

Set the private property with specified key and value for the authenticated user. If you pass empty string as value, it will remove the property. Nil values are not allowed.

+ (void)setPrivatePropertyValue:(NSString *)propertyValue forKey:(NSString *)propertyKey success:(GetSocialSuccessCallback)success failure:(GetSocialFailureCallback)failure

Parameters

propertyValue

The property value (Maximum length 1024 characters).

propertyKey

The property key (Maximum length 64 characters).

success

Success block.

failure

Failure block.

Declared In

GetSocialUser.h

+ removePublicPropertyForKey:success:failure:

Remove one of the public properties of the authenticated user.

+ (void)removePublicPropertyForKey:(NSString *)propertyKey success:(GetSocialSuccessCallback)success failure:(GetSocialFailureCallback)failure

Parameters

propertyKey

The property key (Maximum length 64 characters).

success

Success block.

failure

Failure block.

Declared In

GetSocialUser.h

+ removePrivatePropertyForKey:success:failure:

Remove one of the private properties of the authenticated user.

+ (void)removePrivatePropertyForKey:(NSString *)propertyKey success:(GetSocialSuccessCallback)success failure:(GetSocialFailureCallback)failure

Parameters

propertyKey

The property key (Maximum length 64 characters).

success

Success block.

failure

Failure block.

Declared In

GetSocialUser.h

+ hasPublicPropertyForKey:

Checks if public property exists for the specified key.

+ (BOOL)hasPublicPropertyForKey:(NSString *)propertyKey

Parameters

propertyKey

Property Key.

Return Value

YES if exists, NO if not.

Declared In

GetSocialUser.h

+ hasPrivatePropertyForKey:

Checks if private property exists for the specified key.

+ (BOOL)hasPrivatePropertyForKey:(NSString *)propertyKey

Parameters

propertyKey

Property Key.

Return Value

YES if exists, NO if not.

Declared In

GetSocialUser.h

+ publicPropertyValueForKey:

Returns public property for a key.

+ (nullable NSString *)publicPropertyValueForKey:(NSString *)propertyKey

Parameters

propertyKey

The property key (Maximum length 64 characters).

Return Value

The property value or nil if not set or sdk not initialised. If this returns null you must check if the sdk is initialised to validate the result.

Declared In

GetSocialUser.h

+ privatePropertyValueForKey:

Returns private property for a key.

+ (nullable NSString *)privatePropertyValueForKey:(NSString *)propertyKey

Parameters

propertyKey

The property key (Maximum length 64 characters).

Return Value

The property value or nil if not set or sdk not initialised. If this returns null you must check if the sdk is initialised to validate the result.

Declared In

GetSocialUser.h

+ allPublicProperties

Get all public properties of current user. The dictionary is a copy of origin user properties. To update properties use setPublicPropertyValue:forKey:success:failure: and removePublicPropertyForKey:success:failure:.

+ (NSDictionary *)allPublicProperties

Return Value

NSDictionary contains all public properties.

Discussion

Get all public properties of current user. The dictionary is a copy of origin user properties. To update properties use setPublicPropertyValue:forKey:success:failure: and removePublicPropertyForKey:success:failure:.

Declared In

GetSocialUser.h

+ allPrivateProperties

Get all private properties of current user. The dictionary is a copy of origin user properties. To update properties use setPrivatePropertyValue:forKey:success:failure: and removePrivatePropertyForKey:success:failure:.

+ (NSDictionary *)allPrivateProperties

Return Value

NSDictionary contains all private properties.

Discussion

Get all private properties of current user. The dictionary is a copy of origin user properties. To update properties use setPrivatePropertyValue:forKey:success:failure: and removePrivatePropertyForKey:success:failure:.

Declared In

GetSocialUser.h

Update Change Handlers

+ setOnUserChangedHandler:

Set block to be called when user has been changed. The action is executed on the main thread, so be careful with operations, that you put inside block. Handler will be called when: - SDK initialization is finished; - switchUserWithProviderId: method was called and user was successfully changed.

+ (BOOL)setOnUserChangedHandler:(GetSocialUserChangedHandler)handler

Parameters

handler

Block to be called if user has been changed

Return Value

YES if the operation was successful, otherwise NO.

Declared In

GetSocialUser.h

+ removeOnUserChangedHandler

Remove current handler.

+ (BOOL)removeOnUserChangedHandler

Return Value

YES if the operation was successful, otherwise NO.

Declared In

GetSocialUser.h

Update Details

+ updateDetails:success:failure:

Update user details.

+ (void)updateDetails:(GetSocialUserUpdate *)updateDetails success:(GetSocialSuccessCallback)success failure:(GetSocialFailureCallback)failure

Parameters

updateDetails

New user update

success

Block called if user is updated.

failure

Block called if operation fails.

Declared In

GetSocialUser.h

+ setDisplayName:success:failure:

Update user display name.

+ (void)setDisplayName:(NSString *)newDisplayName success:(GetSocialSuccessCallback)success failure:(GetSocialFailureCallback)failure

Parameters

newDisplayName

Display name to set

success

Block called if display name was updated

failure

Block called if operation fails.

Declared In

GetSocialUser.h

+ displayName

Returns the display name of current user.

+ (nullable NSString *)displayName

Return Value

Display Name of current user.

Declared In

GetSocialUser.h

+ setAvatarUrl:success:failure:

Update user avatar URL.

+ (void)setAvatarUrl:(NSString *)newAvatarUrl success:(GetSocialSuccessCallback)success failure:(GetSocialFailureCallback)failure

Parameters

newAvatarUrl

Avatar URL to set

success

Block called if avatar URL was updated

failure

Block called if operation fails.

Declared In

GetSocialUser.h

+ setAvatar:success:failure:

Update user avatar image.

+ (void)setAvatar:(UIImage *)newAvatarImage success:(GetSocialSuccessCallback)success failure:(GetSocialFailureCallback)failure

Parameters

newAvatarImage

Avatar image to set

success

Block called if avatar image was updated

failure

Block called if operation fails.

Declared In

GetSocialUser.h

+ avatarUrl

Returns the avatar URL of current user.

+ (nullable NSString *)avatarUrl

Return Value

Avatar URL of current user.

Declared In

GetSocialUser.h

+ userId

Returns the id of current user.

+ (GetSocialId)userId

Return Value

Id of current user.

Declared In

GetSocialUser.h

Identities

+ isAnonymous

Indicates if the user has at least one auth identity available.

+ (BOOL)isAnonymous

Return Value

YES, if user is anonymous or framework is not initalized, NO, if user has at least one auth identities added.

Declared In

GetSocialUser.h

+ addAuthIdentity:success:conflict:failure:

Adds AuthIdentity for the specified provider.

+ (void)addAuthIdentity:(GetSocialAuthIdentity *)identity success:(GetSocialSuccessCallback)success conflict:(GetSocialAddIdentityConflictCallback)conflict failure:(GetSocialFailureCallback)failure

Parameters

identity

Identity to be added.

success

Block called if identity is added.

conflict

Block called if identity cannot be added due to a conflict with other user.

failure

Block called if operation fails.

Declared In

GetSocialUser.h

+ removeAuthIdentityWithProviderId:success:failure:

Removes auth identity from current user for the specific provider.

+ (void)removeAuthIdentityWithProviderId:(NSString *)providerId success:(GetSocialSuccessCallback)success failure:(GetSocialFailureCallback)failure

Parameters

providerId

The provider connected to an auth identity on the current user to remove.

success

Block called if identity is removed.

failure

Block called if operation fails.

Discussion

Valid providerIds are “facebook”,“googleplus”,“googleplay” and custom providers.

Declared In

GetSocialUser.h

+ switchUserToIdentity:success:failure:

Switches the current user with the PublicUser corresponding to the details provided.

+ (void)switchUserToIdentity:(GetSocialAuthIdentity *)identity success:(GetSocialSuccessCallback)success failure:(GetSocialFailureCallback)failure

Parameters

identity

Identity that current user should be switched to.

success

Block called if user is switched.

failure

Block called if operation fails.

Declared In

GetSocialUser.h

+ authIdentities

Returns all identities added to the user. The key is the provider Id and the value is the userId used internally by that provider for this user. You can add or remove identities using addAuthIdentity:success:conflict:failure: and removeAuthIdentityWithProviderId:success:conflict:failure:. The key(providerId) is the one you’ve passed as a first parameter to [GetSocialAuthIdentity customIdentityForProvider:userId:accessToken:] or “facebook” constant if you’ve created Facebook identity with [GetSocialAuthIdentity facebookIdentityWithAccessToken:].

The value(userId) is the second parameter in [GetSocialAuthIdentity customIdentityForProvider:userId:accessToken] or automatically obtained by GetSocial if you’ve used Facebook identity.

Read more about identities in the documentation: https://docs.getsocial.im/guides/user-management/ios/managing-user-identities/

+ (NSDictionary<NSString*,NSString*> *)authIdentities

Return Value

All auth identities added to the user.

Declared In

GetSocialUser.h

+ resetWithSuccess:failure:

Reset current user and create new anonymous one.

+ (void)resetWithSuccess:(GetSocialSuccessCallback)success failure:(GetSocialFailureCallback)failure

Parameters

success

called if successfully reset.

failure

called if failed to reset.

Declared In

GetSocialUser.h

Friends

+ addFriend:success:failure:

Add a friend for current user, if operation succeed - they both became friends. If you’re trying to add a user, that already is your friend, success callback will be called, but user will be added to your friends list only once and your friends count won’t be increased.

+ (void)addFriend:(GetSocialId)userId success:(GetSocialIntegerCallback)success failure:(GetSocialFailureCallback)failure

Parameters

userId

Unique user identifier you want to become friend with.

success

Block called if friend was added successfully.

failure

Block called if operation fails.

Declared In

GetSocialUser.h

+ addFriendsWithIds:forProvider:success:failure:

Add a list of users to the list of current user friends. This method can be used to import external social graph data to GetSocial.Add a list friends for current user.

+ (void)addFriendsWithIds:(NSArray<NSString*> *)providerUserIds forProvider:(NSString *)providerId success:(GetSocialIntegerCallback)success failure:(GetSocialFailureCallback)failure

Parameters

providerUserIds

A list of user ids on the selected identity provider that need to be added to the current user’s friends list.

providerId

A auth identity provider id for which user ids will be provided. Can be “facebook”, or any custom value.

success

Block called if friend was added successfully.

failure

Block called if operation fails.

Declared In

GetSocialUser.h

+ removeFriend:success:failure:

Remove a user from friends list. If you’re trying to remove a user, that is not your friend, success callback will be called, and your friends count won’t be decreased.

+ (void)removeFriend:(GetSocialId)userId success:(GetSocialIntegerCallback)success failure:(GetSocialFailureCallback)failure

Parameters

userId

Unique user identifier you don’t want to be friends anymore.

success

Block called if friend was removed successfully.

failure

Block called if operation fails.

Declared In

GetSocialUser.h

+ removeFriendsWithIds:forProvider:success:failure:

Remove a list of users to the list from current user friends.

+ (void)removeFriendsWithIds:(NSArray<NSString*> *)providerUserIds forProvider:(NSString *)providerId success:(GetSocialIntegerCallback)success failure:(GetSocialFailureCallback)failure

Parameters

providerUserIds

A list of user ids on the selected identity provider that need to be added to the current user’s friends list.

providerId

A auth identity provider id for which user ids will be provided. Can be “facebook”, or any custom value.

success

Block called if friend was added successfully.

failure

Block called if operation fails.

Declared In

GetSocialUser.h

+ setFriendsWithIds:success:failure:

Sets the users friends. Existing friends will be removed.

+ (void)setFriendsWithIds:(NSArray<NSString*> *)userIds success:(GetSocialSuccessCallback)success failure:(GetSocialFailureCallback)failure

Parameters

userIds

List of unique user identifiers.

success

Block called if friend was added successfully.

failure

Block called if operation fails.

Declared In

GetSocialUser.h

+ setFriendsWithIds:forProvider:success:failure:

Sets the users friends. Existing friends will be removed.

+ (void)setFriendsWithIds:(NSArray<NSString*> *)providerUserIds forProvider:(NSString *)providerId success:(GetSocialSuccessCallback)success failure:(GetSocialFailureCallback)failure

Parameters

providerUserIds

A list of user ids on the selected identity provider that will be set as the current user’s friends list.

providerId

A auth identity provider id for which user ids will be provided. Can be “facebook”, or any custom value.

success

Block called if friend was added successfully.

failure

Block called if operation fails.

Discussion

Sets the users friends. Existing friends will be removed.

Declared In

GetSocialUser.h

+ isFriend:success:failure:

Check if user is your friend.

+ (void)isFriend:(GetSocialId)userId success:(GetSocialResultCallback)success failure:(GetSocialFailureCallback)failure

Parameters

userId

Unique user identifier.

success

Block called with result if user is your friend or not.

failure

Block called if operation fails.

Declared In

GetSocialUser.h

+ friendsCountWithSuccess:failure:

Remove a user from friends list.

+ (void)friendsCountWithSuccess:(GetSocialIntegerCallback)success failure:(GetSocialFailureCallback)failure

Parameters

success

Block called with count of friends.

failure

Block called if operation fails.

Declared In

GetSocialUser.h

+ friendsWithOffset:limit:success:failure:

Get a list of friends for current user.

+ (void)friendsWithOffset:(int)offset limit:(int)limit success:(GetSocialUsersResultCallback)success failure:(GetSocialFailureCallback)failure

Parameters

offset

Limit of users.

limit

Offset position.

success

Block called with list of users that are friends of current user.

failure

Block called if operation fails.

Declared In

GetSocialUser.h

+ suggestedFriendsWithOffset:limit:success:failure:

Get a list of suggested friends for current user. Read more in documentation.

+ (void)suggestedFriendsWithOffset:(int)offset limit:(int)limit success:(GetSocialSuggestedFriendsResultCallback)success failure:(GetSocialFailureCallback)failure

Parameters

offset

Limit of users.

limit

Offset position.

success

Block called with list of users that are suggested friends for current user.

failure

Block called if operation fails.

Declared In

GetSocialUser.h

+ friendsReferencesWithSuccess:failure:

Get a list of friends references for current user. GetSocialUserReference is lightweight version of GetSocialPublicUser class.

+ (void)friendsReferencesWithSuccess:(GetSocialUserReferencesResultCallback)success failure:(GetSocialFailureCallback)failure

Parameters

success

Block called with list of users that are friends for current user.

failure

Block called if operation fails.

Declared In

GetSocialUser.h

Notifications

+ notificationsWithQuery:success:failure:

Get the list of notifications for current user.

+ (void)notificationsWithQuery:(GetSocialNotificationsQuery *)query success:(GetSocialNotificationsResultCallback)success failure:(GetSocialFailureCallback)failure

Parameters

query

Notifications query.

success

Block called with list of notifications for current user.

failure

Block called if operation fails.

Discussion

Get the list of notifications for current user.

Declared In

GetSocialUser.h

+ notificationsCountWithQuery:success:failure:

Get a number of notifications for current user.

+ (void)notificationsCountWithQuery:(GetSocialNotificationsCountQuery *)query success:(GetSocialIntegerCallback)success failure:(GetSocialFailureCallback)failure

Parameters

query

Notifications count query.

success

Block called with number of notifications for current user.

failure

Block called if operation fails.

Discussion

Get a number of notifications for current user.

Declared In

GetSocialUser.h

+ setNotificationsRead:read:success:failure:

Set notifications read or unread. (Deprecated: Use setNotificationsStatus instead.)

+ (void)setNotificationsRead:(NSArray<GetSocialId> *)notificationsIds read:(BOOL)isRead success:(GetSocialSuccessCallback)success failure:(GetSocialFailureCallback)failure

Parameters

notificationsIds

List of notifications IDs to change the read status.

isRead

Read or unread.

success

Block called if operation succeeded.

failure

Block called if operation fails.

Discussion

Set notifications read or unread.

Declared In

GetSocialUser.h

+ setNotificationsStatus:status:success:failure:

Set notifications status.

+ (void)setNotificationsStatus:(NSArray<GetSocialId> *)notificationsIds status:(GetSocialNotificationStatus)status success:(GetSocialSuccessCallback)success failure:(GetSocialFailureCallback)failure

Parameters

notificationsIds

List of notifications IDs to change the read status.

status

New status.

success

Block called if operation succeeded.

failure

Block called if operation fails.

Discussion

Set notifications status.

Declared In

GetSocialUser.h

+ setPushNotificationsEnabled:success:failure:

If set to NO - current user won’t receive GetSocial notifications anymore, until called with YES.

+ (void)setPushNotificationsEnabled:(BOOL)isEnabled success:(GetSocialSuccessCallback)success failure:(GetSocialFailureCallback)failure

Parameters

isEnabled

Should enable or disable PNs.

success

Block called if operation succeeded.

failure

Block called if operation fails.

Discussion

If set to NO - current user won’t receive GetSocial notifications anymore, until called with YES.

Declared In

GetSocialUser.h

+ isPushNotificationsEnabledWithSuccess:failure:

Check if PNs are enabled for current user.

+ (void)isPushNotificationsEnabledWithSuccess:(GetSocialResultCallback)success failure:(GetSocialFailureCallback)failure

Parameters

success

Called with YES if is enabled, with NO otherwise.

failure

Block called if operation fails.

Discussion

Check if PNs are enabled for current user.

Declared In

GetSocialUser.h

+ sendNotification:withContent:success:failure:

Send notification to any GetSocial user.

+ (void)sendNotification:(NSArray<GetSocialId> *)userIds withContent:(GetSocialNotificationContent *)content success:(GetSocialSendNotificationCallback)success failure:(GetSocialFailureCallback)failure

Parameters

userIds

List of users to send Push Notification.

content

Push Notification content to send.

success

Called with numbers of successfully delivered Push Notifications.

failure

Called if operation fails.

Discussion

Send notification to any GetSocial user.

Declared In

GetSocialUser.h