包含与好友管理相关的 API 请求。
- Source:
Methods
(inner) deleteFriend(friendId) → {Promise.<object>}
删除好友。
Parameters:
Name | Type | Description |
---|---|---|
friendId |
string | 要删除的好友的用户ID。 |
- Source:
Returns:
包含删除操作结果的 Promise 对象。
- Type
- Promise.<object>
(inner) getBlackList() → {Promise.<object>}
获取黑名单列表。
- Source:
Returns:
包含黑名单用户列表的 Promise 对象。
- Type
- Promise.<object>
(inner) getFriendList() → {Promise.<object>}
获取好友列表。
- Source:
Returns:
包含用户好友列表的 Promise 对象。
- Type
- Promise.<object>
(inner) getFriendRequestList() → {Promise.<object>}
获取收到的好友请求列表。
- Source:
Returns:
包含收到的好友请求列表的 Promise 对象。
- Type
- Promise.<object>
(inner) handleFriendRequest(actionInfo) → {Promise.<object>}
回应好友请求(接受或拒绝)。
Parameters:
Name | Type | Description |
---|---|---|
actionInfo |
HandleFriendRequestPayload | 包含请求ID和操作动作。 |
- Source:
Returns:
包含处理结果的 Promise 对象。
- Type
- Promise.<object>
(inner) searchFriend(username) → {Promise.<object>}
搜索好友。
Parameters:
Name | Type | Description |
---|---|---|
username |
string | 要搜索的用户名。 |
- Source:
Returns:
包含搜索结果(用户列表)的 Promise 对象。
- Type
- Promise.<object>
(inner) sendFriendRequest(receiverId) → {Promise.<object>}
发送好友请求。
Parameters:
Name | Type | Description |
---|---|---|
receiverId |
string | 目标用户的ID。 |
- Source:
Returns:
包含发送好友请求结果的 Promise 对象。
- Type
- Promise.<object>
(inner) updateFriendStatus(updateInfo) → {Promise.<object>}
更新好友状态(拉黑或取消拉黑)。
Parameters:
Name | Type | Description |
---|---|---|
updateInfo |
UpdateFriendStatusPayload | 包含好友ID和要更新的状态。 |
- Source:
Returns:
包含更新结果的 Promise 对象。
- Type
- Promise.<object>
Type Definitions
FriendInfo
Type:
- object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
_id |
string | 好友的用户ID。 | |
username |
string | 好友的用户名。 | |
avatar |
string |
<optional> |
好友的头像URL(可选)。 |
- Source:
FriendRequestInfo
Type:
- object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
_id |
string | 好友请求ID。 | |
requester |
string | 请求者ID。 | |
recipient |
string | 接收者ID。 | |
status |
string | 请求状态(例如:"pending")。 | |
requesterInfo |
FriendInfo |
<optional> |
请求者的详细信息(可能在某些返回中包含)。 |
requestedAt |
string |
<optional> |
请求时间(ISO 8601格式字符串)。 |
- Source:
HandleFriendRequestPayload
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
requestId |
string | 好友请求ID。 |
action |
'accept' | 'decline' | 处理动作,"accept"表示接受,"decline"表示拒绝。 |
- Source:
SearchFriendQueryParams
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
q |
string | 要搜索的用户名关键词,支持全词匹配(不区分大小写)。 |
- Source:
SendFriendRequestPayload
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
receiverId |
string | 目标用户的ID。 |
- Source:
UpdateFriendStatusPayload
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
friendId |
string | 目标好友的用户ID。 |
status |
'friends' | 'blocked' | 好友状态,"blocked"表示拉黑,"friends"表示恢复好友状态。 |
- Source: