import { IDirectMessage } from '../../types/data/DirectMessage'; import { IMessage as IRawMessage } from '../../types/raw/base/Message'; import { IConversationTimelineResponse } from '../../types/raw/dm/Conversation'; import { IInboxInitialResponse } from '../../types/raw/dm/InboxInitial'; import { IInboxTimelineResponse } from '../../types/raw/dm/InboxTimeline'; /** * The details of a single direct message. * * @public */ export declare class DirectMessage implements IDirectMessage { /** The raw message details. */ private readonly _raw; conversationId: string; createdAt: string; editCount?: number; id: string; mediaUrls?: string[]; read?: boolean; recipientId?: string; senderId: string; text: string; /** * @param message - The raw message details from the API response. */ constructor(message: unknown); /** The raw message details. */ get raw(): IRawMessage; /** * Extract messages from conversation timeline response */ private static _extractFromConversationTimeline; /** * Extract messages from inbox initial response */ private static _extractFromInboxInitial; /** * Extract messages from inbox timeline response */ private static _extractFromInboxTimeline; /** * Extract media URLs from message attachment data with proper type safety. */ private _extractMediaUrls; /** * Safely extract number value */ private _extractNumberValue; /** * Safely extract string value with fallback */ private _extractStringValue; /** * Parse message data with proper type safety */ private _parseMessageData; /** * Parse timestamp with proper validation */ private _parseTimestamp; /** * Filter messages by conversation ID */ static filterByConversation(messages: DirectMessage[], conversationId: string): DirectMessage[]; /** * Filter messages by sender ID */ static filterBySender(messages: DirectMessage[], senderId: string): DirectMessage[]; /** * Extracts and deserializes the list of direct messages from the given raw response data. * * @param response - The raw response data. * * @returns The deserialized list of direct messages. */ static list(response: IInboxInitialResponse | IConversationTimelineResponse | IInboxTimelineResponse): DirectMessage[]; /** * Generic method to extract messages from any supported response type */ static listFromResponse(response: IInboxInitialResponse | IConversationTimelineResponse | IInboxTimelineResponse): DirectMessage[]; /** * Sort messages by creation time (oldest to newest) */ static sortByTime(messages: DirectMessage[], ascending?: boolean): DirectMessage[]; /** * Get the age of this message in milliseconds */ getAgeInMs(): number; /** * Check if this message has media attachments */ hasMedia(): boolean; /** * Check if this message is from a specific sender */ isFromSender(senderId: string): boolean; /** * @returns A serializable JSON representation of `this` object. */ toJSON(): IDirectMessage; /** * Check if this message was edited */ wasEdited(): boolean; }