Extensions on
V2TIMManager
Methods
addFriendListener(listener:)
public func addFriendListener(listener: V2TIMFriendshipListener)
1.1 Add the relationship chain listener
removeFriendListener(listener:)
public func removeFriendListener(listener: V2TIMFriendshipListener)
1.2 Remove the relationship chain listener
getFriendList(succ:fail:)
public func getFriendList(succ: @escaping V2TIMFriendInfoListSucc, fail: @escaping V2TIMFail)
2.1 Get the friend list
getFriendsInfo(userIDList:succ:fail:)
public func getFriendsInfo(userIDList: Array<String>, succ: @escaping V2TIMFriendInfoResultListSucc, fail: @escaping V2TIMFail)
2.2 Get the profiles of specified friends
-
You are advised to obtain a maximum of 100 user IDs at a time. A larger number may cause the request to be rejected by the backend due to an excessively large data packet. The maximum size of a data packet supported by the backend is 1 MB.
Parameters
Name | Type | Description |
---|---|---|
userIDList | Array<String> |
List of friends' userIDs |
setFriendInfo(info:succ:fail:)
public func setFriendInfo(info: V2TIMFriendInfo, succ: V2TIMSucc?, fail: V2TIMFail?)
2.3 Set the profile of a specified friend
searchFriends(searchParam:succ:fail:)
public func searchFriends(searchParam: V2TIMFriendSearchParam, succ: @escaping V2TIMFriendInfoResultListSucc, fail: @escaping V2TIMFail)
2.4 Search for friends (supported only in Chat Premium 5.4.666 and later versions)
addFriend(application:succ:fail:)
public func addFriend(application: V2TIMFriendAddApplication, succ: V2TIMFriendOperationResultSucc?, fail: V2TIMFail?)
2.5 Add a friend
deleteFromFriendList(userIDList:deleteType:succ:fail:)
public func deleteFromFriendList(userIDList: Array<String>, deleteType: V2TIMFriendType, succ: V2TIMFriendOperationResultListSucc?, fail: V2TIMFail?)
2.6 Delete friends
-
You are advised to delete a maximum of 100 user IDs at a time. A larger number may cause the request to be rejected by the backend due to an excessively large data packet. The maximum size of a data packet supported by the backend is 1 MB.
-
@ref V2TIMFriendInfo.V2TIM_FRIEND_TYPE_SINGLE: one-way friend
-
@ref V2TIMFriendInfo.V2TIM_FRIEND_TYPE_BOTH: two-way friend
Parameters
Name | Type | Description |
---|---|---|
userIDList | Array<String> |
List of the friend userIDs to be deleted |
deleteType | V2TIMFriendType |
Deletion type |
checkFriend(userIDList:checkType:succ:fail:)
public func checkFriend(userIDList: Array<String>, checkType: V2TIMFriendType, succ: @escaping V2TIMFriendCheckResultListSucc, fail: @escaping V2TIMFail)
2.7 Check your relationships with specified users
-
If V2TIM_FRIEND_TYPE_SINGLE is passed in for checkType, the possible results are V2TIM_FRIEND_RELATION_TYPE_NONE and V2TIM_FRIEND_RELATION_TYPE_IN_MY_FRIEND_LIST.
-
If V2TIM_FRIEND_TYPE_BOTH is passed in for checkType, the possible results are V2TIM_FRIEND_RELATION_TYPE_NONE, V2TIM_FRIEND_RELATION_TYPE_IN_MY_FRIEND_LIST, V2TIM_FRIEND_RELATION_TYPE_IN_OTHER_FRIEND_LIST, and V2TIM_FRIEND_RELATION_TYPE_BOTH_WAY. V2TIM_FRIEND_RELATION_TYPE_IN_OTHER_FRIEND_LIST、V2TIM_FRIEND_RELATION_TYPE_BOTH_WAY 四种情况
Parameters
Name | Type | Description |
---|---|---|
userIDList | Array<String> |
List of the userIDs to be checked |
checkType | V2TIMFriendType |
Check type (one-way or two-way friend check) |
succ | @escaping V2TIMFriendCheckResultListSucc |
Callback on success |
fail | @escaping V2TIMFail |
Callback on fail |
getFriendApplicationList(succ:fail:)
public func getFriendApplicationList(succ: @escaping V2TIMFriendApplicationResultSucc, fail: @escaping V2TIMFail)
3.1 Get the friend request list
acceptFriendApplication(application:acceptType:succ:fail:)
public func acceptFriendApplication(application: V2TIMFriendApplication, acceptType: V2TIMFriendAcceptType, succ: V2TIMFriendOperationResultSucc?, fail: V2TIMFail?)
3.2 Accept friend requests
-
@ref V2TIMFriendApplication.V2TIM_FRIEND_ACCEPT_AGREE: agree to add as a one-way friend
-
@ref V2TIMFriendApplication.V2TIM_FRIEND_ACCEPT_AGREE_AND_ADD: agree to add as a two-way friend
Parameters
Name | Type | Description |
---|---|---|
application | V2TIMFriendApplication |
Friend request information, which will be returned when calling getFriendApplicationList is successful |
acceptType | V2TIMFriendAcceptType |
Build one-way or two-way friend relationships |
acceptFriendApplication(application:acceptType:remark:succ:fail:)
public func acceptFriendApplication(application: V2TIMFriendApplication, acceptType: V2TIMFriendAcceptType, remark: String, succ: V2TIMFriendOperationResultSucc?, fail: V2TIMFail?)
3.3 Accept friend requests and set a remark
-
@ref V2TIMFriendApplication.V2TIM_FRIEND_ACCEPT_AGREE: agree to add as a one-way friend
-
@ref V2TIMFriendApplication.V2TIM_FRIEND_ACCEPT_AGREE_AND_ADD: agree to add as a two-way friend
Parameters
Name | Type | Description |
---|---|---|
application | V2TIMFriendApplication |
Friend request information, which will be returned when calling getFriendApplicationList is successful |
acceptType | V2TIMFriendAcceptType |
Build one-way or two-way friend relationships |
remark | String |
Friend remark,maximum 96 bytes |
refuseFriendApplication(application:succ:fail:)
public func refuseFriendApplication(application: V2TIMFriendApplication, succ: V2TIMFriendOperationResultSucc?, fail: V2TIMFail?)
3.4 Reject friend requests
Parameters
Name | Type | Description |
---|---|---|
application | V2TIMFriendApplication |
Friend request information, which will be returned when calling @ref getFriendApplicationList is successful |
deleteFriendApplication(application:succ:fail:)
public func deleteFriendApplication(application: V2TIMFriendApplication, succ: V2TIMSucc?, fail: V2TIMFail?)
3.5 Delete friend requests
Parameters
Name | Type | Description |
---|---|---|
application | V2TIMFriendApplication |
Friend request information, which will be returned when calling @ref getFriendApplicationList is successful |
setFriendApplicationRead(succ:fail:)
public func setFriendApplicationRead(succ: V2TIMSucc?, fail: V2TIMFail?)
3.6 Set a friend request as read
addToBlackList(userIDList:succ:fail:)
public func addToBlackList(userIDList: Array<String>, succ: V2TIMFriendOperationResultListSucc?, fail: V2TIMFail?)
4.1 Add users to the blocklist
deleteFromBlackList(userIDList:succ:fail:)
public func deleteFromBlackList(userIDList: Array<String>, succ: V2TIMFriendOperationResultListSucc?, fail: V2TIMFail?)
4.2 Delete users from the blocklist
getBlackList(succ:fail:)
public func getBlackList(succ: @escaping V2TIMFriendInfoListSucc, fail: @escaping V2TIMFail)
4.3 Get the blocklist
createFriendGroup(groupName:userIDList:succ:fail:)
public func createFriendGroup(groupName: String, userIDList: Array<String>?, succ: V2TIMFriendOperationResultListSucc?, fail: V2TIMFail?)
5.1 Create a friend group
Parameters
Name | Type | Description |
---|---|---|
groupName | String |
Friend group name |
userIDList | Array<String>? |
List of the friend userIDs to be added to the friend group |
getFriendGroupList(groupNameList:succ:fail:)
public func getFriendGroupList(groupNameList: Array<String>?, succ: @escaping V2TIMFriendGroupListSucc, fail: @escaping V2TIMFail)
5.2 Get friend group information
Parameters
Name | Type | Description |
---|---|---|
groupNameList | Array<String>? |
List of the names of the friend groups whose information is to be obtained. If nil is passed in, the information of all friend groups is obtained. |
deleteFriendGroup(groupNameList:succ:fail:)
public func deleteFriendGroup(groupNameList: Array<String>, succ: V2TIMSucc?, fail: V2TIMFail?)
5.3 Delete friend groups
renameFriendGroup(oldName:newName:succ:fail:)
public func renameFriendGroup(oldName: String, newName: String, succ: V2TIMSucc?, fail: V2TIMFail?)
5.4 Modify the name of a friend group
addFriendsToFriendGroup(groupName:userIDList:succ:fail:)
public func addFriendsToFriendGroup(groupName: String, userIDList: Array<String>, succ: V2TIMFriendOperationResultListSucc?, fail: V2TIMFail?)
5.5 Add friends to a friend group
deleteFriendsFromFriendGroup(groupName:userIDList:succ:fail:)
public func deleteFriendsFromFriendGroup(groupName: String, userIDList: Array<String>, succ: V2TIMFriendOperationResultListSucc?, fail: V2TIMFail?)
5.6 Delete friends from a friend group
subscribeOfficialAccount(officialAccountID:succ:fail:)
public func subscribeOfficialAccount(officialAccountID: String, succ: V2TIMSucc?, fail: V2TIMFail?)
6.1 Subscribe to an official account.(supported only in 7.6 and later versions)
unsubscribeOfficialAccount(officialAccountID:succ:fail:)
public func unsubscribeOfficialAccount(officialAccountID: String, succ: V2TIMSucc?, fail: V2TIMFail?)
6.2 Unsubscribe from an official account..(supported only in 7.6 and later versions)
getOfficialAccountsInfo(officialAccountIDList:succ:fail:)
public func getOfficialAccountsInfo(officialAccountIDList: Array<String>, succ: V2TIMOfficialAccountInfoResultListSucc?, fail: V2TIMFail?)
6.3 Get a list of official accounts.(supported only in 7.6 and later versions)
followUser(userIDList:succ:fail:)
public func followUser(userIDList: Array<String>, succ: V2TIMFollowOperationResultListSucc?, fail: V2TIMFail?)
7.1 Follow users (supported only in Chat Premium 7.8 and later versions)
unfollowUser(userIDList:succ:fail:)
public func unfollowUser(userIDList: Array<String>, succ: V2TIMFollowOperationResultListSucc?, fail: V2TIMFail?)
7.2 Unfollow users (supported only in Chat Premium 7.8 and later versions)
getMyFollowingList(nextCursor:succ:fail:)
public func getMyFollowingList(nextCursor: String?, succ: V2TIMUserInfoResultSucc?, fail: V2TIMFail?)
7.3 Get a list of the users I follow (supported only in Chat Premium 7.8 and later versions)
Parameters
Name | Type | Description |
---|---|---|
nextCursor | String? |
Pulling-by-page flag. It can be set to nil or @"" when the information is pulled for the first time. If the API is called successfully and nextCursor returned by the callback is not @"", the results are paginated. The value of this field should be passed in for the next pulling until nextCursor becomes @"". |
getMyFollowersList(nextCursor:succ:fail:)
public func getMyFollowersList(nextCursor: String?, succ: V2TIMUserInfoResultSucc?, fail: V2TIMFail?)
7.4 Get a list of my followers (supported only in Chat Premium 7.8 and later versions)
Parameters
Name | Type | Description |
---|---|---|
nextCursor | String? |
Pulling-by-page flag. It can be set to nil or @"" when the information is pulled for the first time. If the API is called successfully and nextCursor returned by the callback is not @"", the results are paginated. The value of this field should be passed in for the next pulling until nextCursor becomes @"". |
getMutualFollowersList(nextCursor:succ:fail:)
public func getMutualFollowersList(nextCursor: String?, succ: V2TIMUserInfoResultSucc?, fail: V2TIMFail?)
7.5 Get a list of my mutual followers (supported only in Chat Premium 7.8 and later versions)
Parameters
Name | Type | Description |
---|---|---|
nextCursor | String? |
Pulling-by-page flag. It can be set to nil or @"" when the information is pulled for the first time. If the API is called successfully and nextCursor returned by the callback is not @"", the results are paginated. The value of this field should be passed in for the next pulling until nextCursor becomes @"". |
getUserFollowInfo(userIDList:succ:fail:)
public func getUserFollowInfo(userIDList: Array<String>, succ: V2TIMFollowInfoResultListSucc?, fail: V2TIMFail?)
7.6 Get the follow info of specified users (supported only in Chat Premium 7.8 and later versions)
checkFollowType(userIDList:succ:fail:)
public func checkFollowType(userIDList: Array<String>, succ: V2TIMFollowTypeCheckResultListSucc?, fail: V2TIMFail?)
7.7 Check follow type of specified users (supported only in Chat Premium 7.8 and later versions)