UNPKG

@xmtp/content-type-reaction

Version:

An XMTP content type to support reactions to messages

44 lines (41 loc) 1.4 kB
import { ContentTypeId, ContentCodec, EncodedContent } from '@xmtp/content-type-primitives'; declare const ContentTypeReaction: ContentTypeId; type Reaction = { /** * The message ID for the message that is being reacted to */ reference: string; /** * The inbox ID of the user who sent the message that is being reacted to * * This only applies to group messages */ referenceInboxId?: string; /** * The action of the reaction */ action: "added" | "removed"; /** * The content of the reaction */ content: string; /** * The schema of the content to provide guidance on how to display it */ schema: "unicode" | "shortcode" | "custom"; }; type LegacyReactionParameters = Pick<Reaction, "action" | "reference" | "schema"> & { encoding: "UTF-8"; }; declare class ReactionCodec implements ContentCodec<Reaction, LegacyReactionParameters | Record<string, never>> { get contentType(): ContentTypeId; encode(reaction: Reaction): { type: ContentTypeId; parameters: {}; content: Uint8Array<ArrayBufferLike>; }; decode(encodedContent: EncodedContent<LegacyReactionParameters>): Reaction; fallback(content: Reaction): string | undefined; shouldPush(): boolean; } export { ContentTypeReaction, type LegacyReactionParameters, type Reaction, ReactionCodec };