UNPKG

nativescript-matrix-sdk

Version:

Native Matrix SDK integration for NativeScript

188 lines (162 loc) 3 kB
/** * Status of a message transaction */ export enum MessageTransactionStatus { COMPOSING = 'composing', QUEUED = 'queued', SENDING = 'sending', SENT = 'sent', DELIVERED = 'delivered', FAILED = 'failed', READ = 'read', DELETED = 'deleted' } /** * Enhanced file content with media info */ export interface IFileContent { filePath: string; mimeType: string; fileName?: string; fileSize?: number; thumbnailPath?: string; duration?: number; width?: number; height?: number; thumbnail?: { url: string; width?: number; height?: number; }; } /** * Error details for a failed transaction */ export interface ITransactionError { message: string; code?: string; } /** * A pending message transaction */ export interface IPendingTransaction { /** * Local transaction ID (client-generated) */ localId: string; /** * ID of the chat/room */ chatId: string; /** * Current status of the transaction */ status: MessageTransactionStatus; /** * Message content */ content: string; /** * Content type of the message */ contentType: string; /** * File content for media messages */ fileContent?: IFileContent; /** * Matrix event ID once sent */ eventId?: string; /** * Number of retry attempts made */ retryCount: number; /** * Maximum number of retry attempts */ maxRetries: number; /** * Base delay between retries (ms) */ retryDelay: number; /** * Time when the next retry should be attempted */ nextRetryAt?: Date; /** * Error details if the transaction failed */ error?: ITransactionError; /** * Time when the transaction was created */ createdAt: Date; /** * Time when the transaction was last updated */ updatedAt: Date; } /** * Options for retry behavior */ export interface IRetryOptions { /** * Maximum number of retry attempts */ maxRetries: number; /** * Base delay between retries (ms) */ baseDelay: number; /** * Whether to use exponential backoff for retries */ useExponentialBackoff: boolean; /** * Maximum delay between retries (ms) */ maxDelay: number; } /** * Options for sending a message */ export interface ISendMessageOptions { /** * Custom retry options for this message */ retryOptions?: IRetryOptions; /** * Whether to retry immediately if the message fails */ retryImmediately?: boolean; /** * Custom local ID for the message */ localId?: string; } /** * Message formatting options */ export interface IMessageFormatting { format?: string; formattedBody?: string; } /** * Message reaction data */ export interface IMessageReaction { emoji: string; key: string; count: number; users: string[]; timeline: string[]; } /** * Message thread information */ export interface IMessageThread { rootId: string; parentId?: string; count: number; }