feat: chat stickers

This commit is contained in:
gosangam
2026-08-30 02:19:31 +05:30
parent 8c7afe596d
commit 2597c6f2ec
9 changed files with 332 additions and 18 deletions
+26 -1
View File
@@ -171,7 +171,8 @@ export type AttachmentKind =
| "file"
| "link"
| "entity"
| "quote";
| "quote"
| "sticker";
/** One emoji on a message, grouped across everyone who chose it. */
export type Reaction = {
@@ -181,6 +182,15 @@ export type Reaction = {
mine: boolean;
};
/** A piece of reward artwork the caller may send. */
export type Sticker = {
key: string;
name: string;
image_url: string;
/** Came from a chat rather than from sādhana. */
saved: boolean;
};
/** One person's reaction, for the "who reacted" list. */
export type ReactionDetail = {
user: ChatPeer;
@@ -303,6 +313,8 @@ export const chat = {
quote?: QuotePayload;
/** Share a post as a card. Only the reference — the BFF resolves it. */
entity?: { type: "post"; id: string };
/** Send reward artwork. Ownership is checked server-side. */
stickerKey?: string;
},
) =>
call<ChatMessage>(`/chat/conversations/${conversationId}/messages`, {
@@ -316,6 +328,7 @@ export const chat = {
attachments: opts?.attachments ?? [],
quote: opts?.quote ?? null,
entity: opts?.entity ?? null,
sticker_key: opts?.stickerKey ?? null,
}),
}),
@@ -441,6 +454,18 @@ export const chat = {
method: "POST",
}),
/** Everything the caller can send: earned through sādhana, or saved from
* a chat. */
stickers: () => call<Sticker[]>("/chat/stickers"),
/** Keep a sticker someone sent. Keyed to the message it arrived on, which
* is what proves it was actually sent to you. */
saveSticker: (conversationId: string, messageId: string, key: string) =>
call<void>(
`/chat/conversations/${conversationId}/messages/${messageId}/sticker`,
{ method: "POST", body: JSON.stringify({ key }) },
),
/** Who reacted, and with what. Only fetched when the list is opened —
* the thread renders from the grouped counts on each message. */
reactionDetails: (conversationId: string, messageId: string) =>