Methods
switchUserStatus(options) → {void}
User status toggle switch
Examples
// Enable user online status display
TUIUserService.switchUserStatus({ displayOnlineStatus: true });
// Disable user online status display
TUIUserService.switchUserStatus({ displayOnlineStatus: false });
Parameters:
Name | Type | Description |
---|---|---|
options |
SwitchUserStatusParams |
User status control parameters |
Returns:
- Type
- void
switchMessageReadStatus(displayMessageReadReceipt) → {void}
Message read status toggle switch
Examples
// Enable user message read status
TUIUserService.switchMessageReadStatus(true);
// Disable user message read status
TUIUserService.switchMessageReadStatus(false);
Parameters:
Name | Type | Description |
---|---|---|
displayMessageReadReceipt |
boolean |
Message read status control parameter |
Returns:
- Type
- void
getUserProfile(options) → {Promise.<any>}
Get user profile
Examples
// Query own profile
let promise = TUIUserService.getUserProfile();
promise.catch((error) => {
// Business side can catch exceptions through promise.catch for error handling
});
// Query other users' profiles
let promise = TUIUserService.getUserProfile({ userIDList: ['user1', 'user2'] });
promise.catch((error) => {
// Business side can catch exceptions through promise.catch for error handling
});
Parameters:
Name | Type | Description |
---|---|---|
options |
UserIDListParams |
[options = undefined] User ID list, if options is not provided, defaults to querying own profile |
Returns:
- Type
- Promise.<any>
updateMyProfile(options) → {Promise.<any>}
Update own profile information
Example
// Update own nickname
let promise = TUIUserService.updateMyProfile({
nick: 'newNick'
});
promise.catch((error) => {
// Business side can catch exceptions through promise.catch for error handling
});
Parameters:
Name | Type | Description |
---|---|---|
options |
UpdateMyProfileParams |
Parameter options |
Returns:
- Type
- Promise.<any>
addToBlacklist(options) → {Promise.<any>}
Add users to blacklist. After adding a user to the blacklist, all messages from them will be blocked, thus this interface can implement the "block user messages" functionality.
Example
let promise = TUIUserService.addToBlacklist({ userIDList: ['user1', 'user2'] });
promise.catch((error) => {
// Business side can catch exceptions through promise.catch for error handling
});
Parameters:
Name | Type | Description |
---|---|---|
options |
UserIDListParams |
Parameter options |
Returns:
- Type
- Promise.<any>
removeFromBlacklist(options) → {Promise.<any>}
Remove from blacklist
Example
let promise = TUIUserService.removeFromBlacklist({ userIDList: ['user1', 'user2'] });
promise.catch((error) => {
// Business side can catch exceptions through promise.catch for error handling
});
Parameters:
Name | Type | Description |
---|---|---|
options |
UserIDListParams |
Parameter options |
Returns:
- Type
- Promise.<any>