UNPKG

imessage-ts

Version:

TypeScript library for interacting with iMessage on macOS - send messages, monitor chats, and automate responses

70 lines 2.47 kB
import { EventEmitter } from 'events'; import { DatabaseOptions, ConversationEntity, MessageEntity, MessageAttachment, MessageEvent, MessageReadEvent, ConversationQueryOptions, MessageQueryOptions, AttachmentQueryOptions, SendMessageOptions, AttachmentType, MessageType, MessageStatus, MessageService } from './types'; export { DatabaseOptions, ConversationEntity, MessageEntity, MessageAttachment, MessageEvent, MessageReadEvent, ConversationQueryOptions, MessageQueryOptions, AttachmentQueryOptions, SendMessageOptions, AttachmentType, MessageType, MessageStatus, MessageService, }; export { IMessageServer, IMessageServerConfig } from './server'; /** * Main client for interacting with iMessage * * Combines all components and provides a simple API for users */ export declare class IMessageClient extends EventEmitter { private database; private conversationRepository; private messageRepository; private messageSender; private messageWatcher; constructor(options?: DatabaseOptions); /** * Initialize the client */ initialize(): Promise<void>; /** * Start watching for new messages */ startWatching(): void; /** * Stop watching for new messages */ stopWatching(): void; /** * Close the client and database connections */ close(): void; /** * Get conversations */ getConversations(options?: ConversationQueryOptions): Promise<ConversationEntity[]>; /** * Get a conversation by ID */ getConversationById(id: string): Promise<ConversationEntity | null>; /** * Get a conversation by chat identifier (phone number, email, etc.) */ getConversationByChatIdentifier(chatIdentifier: string): Promise<ConversationEntity | null>; /** * Get messages from a conversation */ getMessages(options: MessageQueryOptions): Promise<MessageEntity[]>; /** * Get a message by ID */ getMessageById(id: string): Promise<MessageEntity | null>; /** * Get attachments */ getAttachments(options: AttachmentQueryOptions): Promise<MessageAttachment[]>; /** * Send a message */ sendMessage(options: SendMessageOptions): Promise<void>; /** * Check if iMessage is available */ isAvailable(): Promise<boolean>; /** * Set up event forwarding from the message watcher */ private setupEventForwarding; } //# sourceMappingURL=index.d.ts.map