Favorites API (Draft WIP) - lolmaxz/vrc-ts GitHub Wiki
The Favorites API allows you to manage your favorite items in VRChat—such as friends, avatars, and worlds. You can list favorites, add new favorites, remove favorites, manage favorite groups, and retrieve favorite limits.
-
listFavorites
- Retrieve a list of your favorites. -
addFavorite
- Add a new item to your favorites. -
showFavorite
- Get information about a specific favorite. -
removeFavorite
- Remove an item from your favorites. -
listFavoriteGroups
- List your favorite groups. -
showFavoriteGroup
- Get information about a specific favorite group. -
updateFavoriteGroup
- Update a favorite group's information. -
clearFavoriteGroup
- Clear all items from a favorite group. -
getFavoriteLimits
- Get limits for the number of favorites you can have.
Retrieve a list of your favorites.
Retrieve a list of your favorite items, such as friends, avatars, or worlds. You can filter the list by type, tag, and control pagination.
listFavorites(options: {
type?: 'friend' | 'avatar' | 'world';
n?: number;
offset?: number;
tag?: string;
}): Promise<Favorite[]>
-
options
(object):-
type
(string, optional):
Filter favorites by type. Options:'friend'
,'avatar'
,'world'
. -
n
(number, optional):
Number of favorites to retrieve (1-100). Default is10
. -
offset
(number, optional):
Offset from the first favorite. Must be 0 or greater. -
tag
(string, optional):
Filter favorites by tag.
-
-
Promise<Favorite[]>
: A promise that resolves to an array of favorite objects.
// Example: List all favorite avatars
const favoriteAvatars = await vrchatApi.favoritesApi.listFavorites({
type: 'avatar',
n: 20,
});
console.log(favoriteAvatars);
Add a new item to your favorites.
Add a new item (friend, avatar, or world) to your favorites. Note that you cannot add users who are not your friends to your favorite friends list.
addFavorite(options: {
type: 'friend' | 'avatar' | 'world';
favoriteId: string;
tags: string[];
}): Promise<Favorite>
-
options
(object):-
type
(string, required):
Type of favorite to add. Options:'friend'
,'avatar'
,'world'
. -
favoriteId
(string, required):
The ID of the item to add to favorites.- For friends: User ID (
usr_...
) - For avatars: Avatar ID (
avtr_...
) - For worlds: World ID (
wrld_...
)
- For friends: User ID (
-
tags
(string array, required):
Tags associated with the favorite. Tags correspond to favorite groups.- For friends:
'group_0'
,'group_1'
,'group_2'
,'group_3'
- For avatars:
'avatars1'
,'avatars2'
,'avatars3'
,'avatars4'
- For worlds:
'worlds1'
,'worlds2'
,'worlds3'
,'worlds4'
- For friends:
-
-
Promise<Favorite>
: A promise that resolves to the added favorite object.
// Example: Add a friend to favorites
const newFavoriteFriend = await vrchatApi.favoritesApi.addFavorite({
type: 'friend',
favoriteId: 'usr_abcdef12-3456-7890-abcd-ef1234567890', // Friend's user ID
tags: ['group_0'],
});
console.log(newFavoriteFriend);
// Example: Add an avatar to favorites
const newFavoriteAvatar = await vrchatApi.favoritesApi.addFavorite({
type: 'avatar',
favoriteId: 'avtr_12345678-1234-1234-1234-1234567890ab', // Avatar ID
tags: ['avatars1'],
});
console.log(newFavoriteAvatar);
// Example: Add a world to favorites
const newFavoriteWorld = await vrchatApi.favoritesApi.addFavorite({
type: 'world',
favoriteId: 'wrld_12345678-1234-1234-1234-1234567890ab', // World ID
tags: ['worlds1'],
});
console.log(newFavoriteWorld);
Get information about a specific favorite.
Retrieve detailed information about a specific favorite item by its favorite ID.
showFavorite(options: {
favoriteId: string;
}): Promise<Favorite>
-
options
(object):-
favoriteId
(string, required):
The ID of the favorite. This is not the same as the item ID; it is the unique identifier for the favorite entry.
-
-
Promise<Favorite>
: A promise that resolves to the favorite object.
// Example: Get information about a specific favorite
const favoriteInfo = await vrchatApi.favoritesApi.showFavorite({
favoriteId: 'fav_abcdef12-3456-7890-abcd-ef1234567890',
});
console.log(favoriteInfo);
Remove an item from your favorites.
Remove an item from your favorites list using its favorite ID.
removeFavorite(options: {
favoriteId: string;
}): Promise<RequestSuccess>
-
options
(object):-
favoriteId
(string, required):
The ID of the favorite to remove.
-
-
Promise<RequestSuccess>
: A promise that resolves to a success object indicating the operation was successful.
// Example: Remove a favorite item
const response = await vrchatApi.favoritesApi.removeFavorite({
favoriteId: 'fav_abcdef12-3456-7890-abcd-ef1234567890',
});
console.log(response); // { success: true }
List your favorite groups.
Retrieve a list of your favorite groups, such as friend groups, avatar groups, and world groups.
listFavoriteGroups(options: {
ownerId: string;
n?: number;
offset?: number;
}): Promise<FavoriteGroup[]>
-
options
(object):-
ownerId
(string, required):
The user ID of the owner of the favorite groups. Typically, this will be your own user ID. -
n
(number, optional):
Number of favorite groups to retrieve (1-100). Default is10
. -
offset
(number, optional):
Offset from the first favorite group. Must be 0 or greater.
-
-
Promise<FavoriteGroup[]>
: A promise that resolves to an array of favorite group objects.
// Example: List your favorite groups
const favoriteGroups = await vrchatApi.favoritesApi.listFavoriteGroups({
ownerId: 'usr_yourUserIdHere',
});
console.log(favoriteGroups);
Get information about a specific favorite group.
Retrieve detailed information about a specific favorite group by its type and name.
showFavoriteGroup(options: {
favoriteGroupType: 'friend' | 'avatar' | 'world';
favoriteGroupName: string;
userId: string;
}): Promise<FavoriteGroup>
-
options
(object):-
favoriteGroupType
(string, required):
Type of the favorite group. Options:'friend'
,'avatar'
,'world'
. -
favoriteGroupName
(string, required):
Name of the favorite group. For friends:'group_0'
,'group_1'
, etc. For avatars and worlds: group names like'avatars1'
,'worlds1'
, etc. -
userId
(string, required):
The user ID of the owner of the favorite group.
-
-
Promise<FavoriteGroup>
: A promise that resolves to the favorite group object.
// Example: Get information about a specific favorite group
const favoriteGroup = await vrchatApi.favoritesApi.showFavoriteGroup({
favoriteGroupType: 'friend',
favoriteGroupName: 'group_0',
userId: 'usr_yourUserIdHere',
});
console.log(favoriteGroup);
Update a favorite group's information.
Update properties of a favorite group, such as its display name, visibility, and tags.
updateFavoriteGroup(options: {
favoriteGroupType: 'friend' | 'avatar' | 'world';
favoriteGroupName: string;
userId: string;
displayName?: string;
visibility?: 'private' | 'public';
tags?: string[];
}): Promise<FavoriteGroup>
-
options
(object):-
favoriteGroupType
,favoriteGroupName
,userId
(required):
Same as inshowFavoriteGroup
. -
displayName
(string, optional):
New display name for the favorite group. -
visibility
(string, optional):
Visibility of the favorite group. Options:'private'
,'public'
. -
tags
(string array, optional):
Tags associated with the favorite group.
-
-
Promise<FavoriteGroup>
: A promise that resolves to the updated favorite group object.
// Example: Update a favorite group's display name
const updatedFavoriteGroup = await vrchatApi.favoritesApi.updateFavoriteGroup({
favoriteGroupType: 'avatar',
favoriteGroupName: 'avatars1',
userId: 'usr_yourUserIdHere',
displayName: 'My Favorite Avatars',
});
console.log(updatedFavoriteGroup);
Clear all items from a favorite group.
Remove all items from a specific favorite group.
clearFavoriteGroup(options: {
favoriteGroupType: 'friend' | 'avatar' | 'world';
favoriteGroupName: string;
userId: string;
}): Promise<RequestSuccess>
-
options
(object):- Same as in
showFavoriteGroup
- Same as in
-
Promise<RequestSuccess>
: A promise that resolves to a success object indicating the operation was successful.
// Example: Clear all items from a favorite group
const response = await vrchatApi.favoritesApi.clearFavoriteGroup({
favoriteGroupType: 'world',
favoriteGroupName: 'worlds1',
userId: 'usr_yourUserIdHere',
});
console.log(response); // { success: true }
Get limits for the number of favorites you can have.
Retrieve information about the maximum number of favorites and favorite groups you can have.
getFavoriteLimits(): Promise<FavoriteLimits>
- No parameters
-
Promise<FavoriteLimits>
: A promise that resolves to an object containing favorite limits.type FavoriteLimits = { defaultMaxFavoriteGroups: number; defaultMaxFavoritesPerGroup: number; maxFavoriteGroups: { avatar: number; friend: number; world: number; }; maxFavoritesPerGroup: { avatar: number; friend: number; world: number; }; };
// Example: Get favorite limits
const favoriteLimits = await vrchatApi.favoritesApi.getFavoriteLimits();
console.log(favoriteLimits);
/*
{
defaultMaxFavoriteGroups: 4,
defaultMaxFavoritesPerGroup: 32,
maxFavoriteGroups: { avatar: 4, friend: 4, world: 4 },
maxFavoritesPerGroup: { avatar: 32, friend: 32, world: 32 }
}
*/
enum FavoriteType {
Friend = 'friend',
Avatar = 'avatar',
World = 'world',
}
type Favorite = {
id?: string; // Favorite ID (fav_...)
type: 'friend' | 'avatar' | 'world';
favoriteId?: string; // ID of the item (usr_, avtr_, or wrld_)
tags: string[];
};
type FavoriteGroup = {
displayName: string;
visibility: 'private' | 'public';
tags: string[];
ownerId: string; // User ID of the owner
ownerDisplayName?: string;
name?: string; // Internal name of the favorite group
};
-
Tags and Favorite Groups:
-
Friend Groups:
'group_0'
,'group_1'
,'group_2'
,'group_3'
-
Avatar Groups:
'avatars1'
,'avatars2'
,'avatars3'
,'avatars4'
-
World Groups:
'worlds1'
,'worlds2'
,'worlds3'
,'worlds4'
-
Friend Groups:
-
Friend Favorites:
- You can only add users who are already your friends to your favorite friends list.
- Removing a friend from favorites does not unfriend them, but unfriending someone removes them from your favorites.
-
Favorite Limits:
- The number of favorites and favorite groups you can have is limited.
- Use
getFavoriteLimits
to retrieve your current limits.
-
Visibility:
- Favorite groups can have a visibility of
'private'
or'public'
. - This controls whether others can see your favorite groups.
- Favorite groups can have a visibility of
-
Favorite IDs vs. Item IDs:
-
Favorite ID (
fav_...
): Unique identifier for the favorite entry. - Item ID: The ID of the item being favorited (e.g., user ID, avatar ID, world ID).
-
Favorite ID (
-
listFavorites
: Retrieve a list of your favorites. -
addFavorite
: Add a new item to your favorites. -
showFavorite
: Get information about a specific favorite. -
removeFavorite
: Remove an item from your favorites. -
listFavoriteGroups
: List your favorite groups. -
showFavoriteGroup
: Get information about a specific favorite group. -
updateFavoriteGroup
: Update a favorite group's information. -
clearFavoriteGroup
: Clear all items from a favorite group. -
getFavoriteLimits
: Get limits for the number of favorites you can have.