Friends API (Draft WIP) - lolmaxz/vrc-ts GitHub Wiki
The Friends API allows you to manage friend relationships within VRChat. This includes listing your friends, sending friend requests, deleting friend requests, checking friend statuses, and unfriending users.
-
listFriends
- List information about your friends. -
sendFriendRequest
- Send a friend request to a user. -
deleteFriendRequest
- Cancel an outgoing friend request. -
checkFriendStatus
- Check the friend status with a user. -
unfriend
- Remove a user from your friends list.
List information about your friends.
Retrieve a list of your friends, with options to control pagination and filter by online/offline status.
listFriends(options: {
n?: number;
offset?: number;
offline?: boolean;
}): Promise<LimitedUserFriend[]>
-
options
(object):-
n
(number, optional):
The number of friends to retrieve. Must be between1
and100
. Default is60
. -
offset
(number, optional):
The number of records to offset from the start. Must be0
or greater. -
offline
(boolean, optional):
Iftrue
, returns only offline friends. Iffalse
, returns only online and active friends. Default isfalse
.
-
-
Promise<LimitedUserFriend[]>
: A promise that resolves to an array of limited user friend objects.
// Example: List online friends
const onlineFriends = await vrchatApi.friendsApi.listFriends({
n: 50,
offline: false,
});
console.log(onlineFriends);
// Example: List offline friends
const offlineFriends = await vrchatApi.friendsApi.listFriends({
n: 50,
offline: true,
});
console.log(offlineFriends);
Send a friend request to a user.
Send a friend request to another user by their user ID.
sendFriendRequest(options: {
userId: string;
}): Promise<Notification>
-
options
(object):-
userId
(string, required):
The user ID of the user to whom you want to send a friend request.
-
-
Promise<Notification>
: A promise that resolves to a notification object representing the sent friend request.
// Example: Send a friend request to a user
const friendRequestNotification = await vrchatApi.friendsApi.sendFriendRequest({
userId: 'usr_abcdef12-3456-7890-abcd-ef1234567890',
});
console.log(friendRequestNotification);
Cancel an outgoing friend request.
Delete an outgoing pending friend request to another user. To delete an incoming friend request, use the deleteNotification
endpoint instead.
deleteFriendRequest(options: {
userId: string;
}): Promise<RequestSuccess>
-
options
(object):-
userId
(string, required):
The user ID of the user whose pending friend request you want to cancel.
-
-
Promise<RequestSuccess>
: A promise that resolves to an object indicating the operation was successful.
// Example: Cancel an outgoing friend request
const response = await vrchatApi.friendsApi.deleteFriendRequest({
userId: 'usr_abcdef12-3456-7890-abcd-ef1234567890',
});
console.log(response); // { success: true }
Check the friend status with a user.
Retrieve the friendship status with a given user, including whether you are friends, have an outgoing friend request, or have an incoming friend request.
checkFriendStatus(options: {
userId: string;
}): Promise<FriendStatus>
-
options
(object):-
userId
(string, required):
The user ID of the user whose friend status you want to check.
-
-
Promise<FriendStatus>
: A promise that resolves to an object containing the friend status.type FriendStatus = { incomingRequest: boolean; isFriend: boolean; outgoingRequest: boolean; };
// Example: Check friend status with a user
const friendStatus = await vrchatApi.friendsApi.checkFriendStatus({
userId: 'usr_abcdef12-3456-7890-abcd-ef1234567890',
});
console.log(friendStatus);
/*
{
incomingRequest: false,
isFriend: true,
outgoingRequest: false,
}
*/
Remove a user from your friends list.
Unfriend a user by their user ID, removing them from your friends list.
unfriend(options: {
userId: string;
}): Promise<RequestSuccess>
-
options
(object):-
userId
(string, required):
The user ID of the user you want to unfriend.
-
-
Promise<RequestSuccess>
: A promise that resolves to an object indicating the operation was successful.
// Example: Unfriend a user
const response = await vrchatApi.friendsApi.unfriend({
userId: 'usr_abcdef12-3456-7890-abcd-ef1234567890',
});
console.log(response); // { success: true }
type FriendStatus = {
incomingRequest: boolean;
isFriend: boolean;
outgoingRequest: boolean;
};
type RequestSuccess = {
success: boolean;
};
-
listFriends
- List information about your friends. -
sendFriendRequest
- Send a friend request to a user. -
deleteFriendRequest
- Cancel an outgoing friend request. -
checkFriendStatus
- Check the friend status with a user. -
unfriend
- Remove a user from your friends list.