ITUIFriendService

ITUIFriendService

Methods

addFriend(options) → {Promise.<any>}

Add friend

Example
let promise = TUIFriendService.addFriend({
  to: 'user1',
  source: 'AddSource_Type_Web',
  remark: 'Orange',
  groupName: 'Friends',
  wording: 'I am user0',
  type: TUIChatEngine.TYPES.SNS_ADD_TYPE_BOTH,
});
promise.catch((error) => {
 // Business side can catch exceptions through promise.catch for error handling
});
Parameters:
Name Type Description
options AddFriendParams

Parameter options

Returns:
Type
Promise.<any>

deleteFriend(options) → {Promise.<any>}

Delete friend

Example
let promise = TUIFriendService.deleteFriend({
  userIDList: ['user1','user2'],
  type: TUIChatEngine.TYPES.SNS_DELETE_TYPE_BOTH
});
promise.catch((error) => {
 // Business side can catch exceptions through promise.catch for error handling
});
Parameters:
Name Type Description
options DeleteFriendParams

Parameter options

Returns:
Type
Promise.<any>

checkFriend(options) → {Promise.<any>}

Check friend relationship

Example
let promise = TUIFriendService.checkFriend({
  userIDList: ['user1','user2'],
  type: TUIChatEngine.TYPES.SNS_CHECK_TYPE_BOTH
});
promise.catch((error) => {
 // Business side can catch exceptions through promise.catch for error handling
});
Parameters:
Name Type Description
options CheckFriendParams

Parameter options

Returns:
Type
Promise.<any>

getFriendProfile(options) → {Promise.<any>}

Get complete friend data (including standard friend fields and custom friend fields) and complete profile data (including standard profile fields and custom profile fields) for specified friends.

Example
let promise = TUIFriendService.getFriendProfile({
  userIDList: ['user1','user2']
});
promise.catch((error) => {
 // Business side can catch exceptions through promise.catch for error handling
});
Parameters:
Name Type Description
options GetFriendProfileParams

Parameter options

Returns:
Type
Promise.<any>

updateFriend(options) → {Promise.<any>}

Update friend relationship chain data, only supports updating friend remarks and relationship chain custom fields.

Examples
// Update friend remark
let promise = TUIFriendService.updateFriend({
  userID: 'user1',
  remark: 'aallen'
});
promise.catch((error) => {
 // Business side can catch exceptions through promise.catch for error handling
});
// Update friend custom fields
let promise = TUIFriendService.updateFriend({
  userID: 'user1',
  friendCustomField: [
   // Friend custom fields must be prefixed with Tag_SNS_Custom
   { key: 'Tag_SNS_Custom_test1', value: 'hello' },
   { key: 'Tag_SNS_Custom_test2', value: 'world' },
  ]
});
promise.catch((error) => {
 // Business side can catch exceptions through promise.catch for error handling
});
Parameters:
Name Type Description
options UpdateFriendParams

Parameter options

Returns:
Type
Promise.<any>

acceptFriendApplication(options) → {Promise.<any>}

Accept friend application

Example
let promise = TUIFriendService.acceptFriendApplication({
   userID: 'user1',
   remark: 'Customer Service Xiao Liang',
   type: TUIChatEngine.TYPES.SNS_APPLICATION_AGREE_AND_ADD
});
promise.catch((error) => {
 // Business side can catch exceptions through promise.catch for error handling
});
Parameters:
Name Type Description
options AcceptFriendApplicationParams

Parameter options

Returns:
Type
Promise.<any>

refuseFriendApplication(userID) → {Promise.<any>}

Reject friend application

Example
let promise = TUIFriendService.refuseFriendApplication('user1');
promise.catch((error) => {
 // Business side can catch exceptions through promise.catch for error handling
});
Parameters:
Name Type Description
userID string

User ID of the rejected user

Returns:
Type
Promise.<any>

deleteFriendApplication(options) → {Promise.<any>}

Delete friend application

Example
let promise = TUIFriendService.deleteFriendApplication({
  userID: 'user1',
  type: TUIChatEngine.TYPES.SNS_APPLICATION_SENT_TO_ME
});
promise.catch((error) => {
 // Business side can catch exceptions through promise.catch for error handling
});
Parameters:
Name Type Description
options DeleteFriendApplicationParams

Parameter options

Returns:
Type
Promise.<any>

setFriendApplicationRead() → {Promise.<any>}

Report friend application as read

Returns:
Type
Promise.<any>