Gift CollectionsUSER-ONLY
User Walkthrough 38 of 50
Users can organize received gifts into collections.
Creating and Listing Collections
createGiftCollection creates a collection.
const gifts = [{ type: "chat" as const, chatId, id: giftId }];
const collection = await client.createGiftCollection("me", "Favorites", gifts);
getGiftCollections lists the account’s collections.
const collections = await client.getGiftCollections("me");
Managing a Collection
Rename a collection with setGiftCollectionName.
await client.setGiftCollectionName("me", collection.id, "Best Gifts");
addGiftsToCollection and removeGiftsFromCollection manage its contents.
await client.addGiftsToCollection("me", collection.id, gifts);
await client.removeGiftsFromCollection("me", collection.id, gifts);
Reorder gifts inside one collection with reorderGiftsInCollection.
await client.reorderGiftsInCollection("me", collection.id, gifts);
To reorder the collections themselves, call reorderGiftCollections.
await client.reorderGiftCollections("me", collections.map(({ id }) => id));
deleteGiftCollection deletes a collection.
await client.deleteGiftCollection("me", collection.id);