UNPKG

@river-build/react-sdk

Version:
209 lines 8.12 kB
import { Channel } from '@river-build/sdk'; import { type ActionConfig } from './internals/useAction'; /** * Hook to send a message to a stream. Can be used to send a message to a channel or a dm/group dm. * @param streamId - The id of the stream to send the message to. * @param config - Configuration options for the action. * @returns The sendMessage action and the status of the action. */ export declare const useSendMessage: (streamId: string, config?: ActionConfig<Channel['sendMessage']>) => { data: { eventId: string; } | undefined; error: Error | undefined; isPending: boolean; isSuccess: boolean; isError: boolean; /** Sends a message to the stream. * @param message - The message to send. * @param options - Additional options for the message. * @returns The event id of the message. */ sendMessage: (message: string, options?: { threadId?: string | undefined; replyId?: string | undefined; mentions?: { userId: string; displayName: string; mentionBehavior: { value: {}; case: "atChannel"; } | { value: { roleId: number; }; case: "atRole"; } | { case: undefined; value?: undefined; }; }[] | undefined; attachments?: { content: { value: { title: string; info?: { url: string; mimetype: string; size?: number | undefined; width?: number | undefined; height?: number | undefined; } | undefined; thumbnail?: { url: string; mimetype: string; size?: number | undefined; width?: number | undefined; height?: number | undefined; } | undefined; }; case: "image"; } | { value: { info?: { mimetype: string; sizeBytes: bigint; widthPixels: number; heightPixels: number; filename: string; } | undefined; content: Uint8Array; }; case: "embeddedMedia"; } | { value: { info?: { mimetype: string; sizeBytes: bigint; widthPixels: number; heightPixels: number; filename: string; } | undefined; streamId: string; thumbnail?: { info?: { mimetype: string; sizeBytes: bigint; widthPixels: number; heightPixels: number; filename: string; } | undefined; content: Uint8Array; } | undefined; encryption: { value: { iv: Uint8Array; secretKey: Uint8Array; }; case: "aesgcm"; } | { case: undefined; value?: undefined; }; }; case: "chunkedMedia"; } | { value: { url: string; post?: { threadId?: string | undefined; threadPreview?: string | undefined; replyId?: string | undefined; replyPreview?: string | undefined; content: { value: { body: string; mentions: { userId: string; displayName: string; mentionBehavior: { value: {}; case: "atChannel"; } | { value: { roleId: number; }; case: "atRole"; } | { case: undefined; value?: undefined; }; }[]; attachments: any[]; }; case: "text"; } | { value: { title: string; info?: { url: string; mimetype: string; size?: number | undefined; width?: number | undefined; height?: number | undefined; } | undefined; thumbnail?: { url: string; mimetype: string; size?: number | undefined; width?: number | undefined; height?: number | undefined; } | undefined; }; case: "image"; } | { value: { typeUrl: string; value?: Uint8Array | undefined; }; case: "gm"; } | { case: undefined; value?: undefined; }; } | undefined; info?: { userId: string; createdAtEpochMs: bigint; spaceId: string; channelId: string; messageId: string; replyId?: string | undefined; } | undefined; staticInfo?: { userName?: string | undefined; displayName?: string | undefined; channelName?: string | undefined; spaceName?: string | undefined; ensName?: string | undefined; } | undefined; }; case: "embeddedMessage"; } | { value: { url: string; description: string; title: string; image?: { height: number; width: number; url: string; } | undefined; }; case: "unfurledUrl"; } | { value: { address: string; chainId: string; }; case: "ticker"; } | { case: undefined; value?: undefined; }; }[] | undefined; } | undefined) => Promise<{ eventId: string; }>; }; //# sourceMappingURL=useSendMessage.d.ts.map