Favorites API (Draft WIP) - lolmaxz/vrc-ts GitHub Wiki

Favorites API Documentation

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.


Index

  1. listFavorites - Retrieve a list of your favorites.
  2. addFavorite - Add a new item to your favorites.
  3. showFavorite - Get information about a specific favorite.
  4. removeFavorite - Remove an item from your favorites.
  5. listFavoriteGroups - List your favorite groups.
  6. showFavoriteGroup - Get information about a specific favorite group.
  7. updateFavoriteGroup - Update a favorite group's information.
  8. clearFavoriteGroup - Clear all items from a favorite group.
  9. getFavoriteLimits - Get limits for the number of favorites you can have.

Endpoints

1. listFavorites

Retrieve a list of your favorites.

Purpose

Retrieve a list of your favorite items, such as friends, avatars, or worlds. You can filter the list by type, tag, and control pagination.

Method Signature

listFavorites(options: {
  type?: 'friend' | 'avatar' | 'world';
  n?: number;
  offset?: number;
  tag?: string;
}): Promise<Favorite[]>

Parameters

  • options (object):

    • type (string, optional):
      Filter favorites by type. Options: 'friend', 'avatar', 'world'.

    • n (number, optional):
      Number of favorites to retrieve (1-100). Default is 10.

    • offset (number, optional):
      Offset from the first favorite. Must be 0 or greater.

    • tag (string, optional):
      Filter favorites by tag.

Returns

  • Promise<Favorite[]>: A promise that resolves to an array of favorite objects.

Example Usage

// Example: List all favorite avatars
const favoriteAvatars = await vrchatApi.favoritesApi.listFavorites({
  type: 'avatar',
  n: 20,
});
console.log(favoriteAvatars);

2. addFavorite

Add a new item to your favorites.

Purpose

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.

Method Signature

addFavorite(options: {
  type: 'friend' | 'avatar' | 'world';
  favoriteId: string;
  tags: string[];
}): Promise<Favorite>

Parameters

  • 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_...)
    • 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'

Returns

  • Promise<Favorite>: A promise that resolves to the added favorite object.

Example Usage

// 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);

3. showFavorite

Get information about a specific favorite.

Purpose

Retrieve detailed information about a specific favorite item by its favorite ID.

Method Signature

showFavorite(options: {
  favoriteId: string;
}): Promise<Favorite>

Parameters

  • 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.

Returns

  • Promise<Favorite>: A promise that resolves to the favorite object.

Example Usage

// Example: Get information about a specific favorite
const favoriteInfo = await vrchatApi.favoritesApi.showFavorite({
  favoriteId: 'fav_abcdef12-3456-7890-abcd-ef1234567890',
});
console.log(favoriteInfo);

4. removeFavorite

Remove an item from your favorites.

Purpose

Remove an item from your favorites list using its favorite ID.

Method Signature

removeFavorite(options: {
  favoriteId: string;
}): Promise<RequestSuccess>

Parameters

  • options (object):

    • favoriteId (string, required):
      The ID of the favorite to remove.

Returns

  • Promise<RequestSuccess>: A promise that resolves to a success object indicating the operation was successful.

Example Usage

// Example: Remove a favorite item
const response = await vrchatApi.favoritesApi.removeFavorite({
  favoriteId: 'fav_abcdef12-3456-7890-abcd-ef1234567890',
});
console.log(response); // { success: true }

5. listFavoriteGroups

List your favorite groups.

Purpose

Retrieve a list of your favorite groups, such as friend groups, avatar groups, and world groups.

Method Signature

listFavoriteGroups(options: {
  ownerId: string;
  n?: number;
  offset?: number;
}): Promise<FavoriteGroup[]>

Parameters

  • 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 is 10.

    • offset (number, optional):
      Offset from the first favorite group. Must be 0 or greater.

Returns

  • Promise<FavoriteGroup[]>: A promise that resolves to an array of favorite group objects.

Example Usage

// Example: List your favorite groups
const favoriteGroups = await vrchatApi.favoritesApi.listFavoriteGroups({
  ownerId: 'usr_yourUserIdHere',
});
console.log(favoriteGroups);

6. showFavoriteGroup

Get information about a specific favorite group.

Purpose

Retrieve detailed information about a specific favorite group by its type and name.

Method Signature

showFavoriteGroup(options: {
  favoriteGroupType: 'friend' | 'avatar' | 'world';
  favoriteGroupName: string;
  userId: string;
}): Promise<FavoriteGroup>

Parameters

  • 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.

Returns

  • Promise<FavoriteGroup>: A promise that resolves to the favorite group object.

Example Usage

// 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);

7. updateFavoriteGroup

Update a favorite group's information.

Purpose

Update properties of a favorite group, such as its display name, visibility, and tags.

Method Signature

updateFavoriteGroup(options: {
  favoriteGroupType: 'friend' | 'avatar' | 'world';
  favoriteGroupName: string;
  userId: string;
  displayName?: string;
  visibility?: 'private' | 'public';
  tags?: string[];
}): Promise<FavoriteGroup>

Parameters

  • options (object):

    • favoriteGroupType, favoriteGroupName, userId (required):
      Same as in showFavoriteGroup.

    • 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.

Returns

  • Promise<FavoriteGroup>: A promise that resolves to the updated favorite group object.

Example Usage

// 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);

8. clearFavoriteGroup

Clear all items from a favorite group.

Purpose

Remove all items from a specific favorite group.

Method Signature

clearFavoriteGroup(options: {
  favoriteGroupType: 'friend' | 'avatar' | 'world';
  favoriteGroupName: string;
  userId: string;
}): Promise<RequestSuccess>

Parameters

  • options (object):

    • Same as in showFavoriteGroup

Returns

  • Promise<RequestSuccess>: A promise that resolves to a success object indicating the operation was successful.

Example Usage

// 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 }

9. getFavoriteLimits

Get limits for the number of favorites you can have.

Purpose

Retrieve information about the maximum number of favorites and favorite groups you can have.

Method Signature

getFavoriteLimits(): Promise<FavoriteLimits>

Parameters

  • No parameters

Returns

  • 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 Usage

// 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 }
}
*/

Additional Types and Enums

FavoriteType Enum

enum FavoriteType {
  Friend = 'friend',
  Avatar = 'avatar',
  World = 'world',
}

Favorite Object Structure

type Favorite = {
  id?: string; // Favorite ID (fav_...)
  type: 'friend' | 'avatar' | 'world';
  favoriteId?: string; // ID of the item (usr_, avtr_, or wrld_)
  tags: string[];
};

FavoriteGroup Object Structure

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
};

Additional Notes

  • 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 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 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).

Short Summary

Endpoints:

  1. listFavorites: Retrieve a list of your favorites.
  2. addFavorite: Add a new item to your favorites.
  3. showFavorite: Get information about a specific favorite.
  4. removeFavorite: Remove an item from your favorites.
  5. listFavoriteGroups: List your favorite groups.
  6. showFavoriteGroup: Get information about a specific favorite group.
  7. updateFavoriteGroup: Update a favorite group's information.
  8. clearFavoriteGroup: Clear all items from a favorite group.
  9. getFavoriteLimits: Get limits for the number of favorites you can have.

⚠️ **GitHub.com Fallback** ⚠️