uid | title |
---|---|
Guides.QuickReference.Http.Friend |
好友相关接口 |
预声明变量
readonly KookSocketClient _socketClient = null;
readonly KookRestClient _restClient = null;
IUser user = null;
GET /api/v3/friend
// API 请求,获取好友列表
IReadOnlyCollection<RestUser> friends = await _restClient.GetFriendsAsync();
// API 请求,获取好友请求列表
IReadOnlyCollection<RestFriendRequest> friendRequests = await _restClient.GetFriendRequestsAsync();
// API 请求,获取屏蔽用户列表
IReadOnlyCollection<RestUser> blockedUsers = await _restClient.GetBlockedUsersAsync();
POST /api/v3/friend/request
// API 请求
await user.RequestFriendAsync();
POST /api/v3/friend/handle-request
// 好友申请
RestFriendRequest friendRequest = null;
// API 请求,接受好友申请
await friendRequest.AcceptAsync();
// API 请求,拒绝好友申请
await friendRequest.DeclineAsync();
POST /api/v3/friend/delete
// API 请求
await user.RemoveFriendAsync();
POST /api/v3/friend/block
// API 请求
await user.BlockAsync();
POST /api/v3/friend/unblock
// API 请求
await user.UnblockAsync();