Skip to content

Black Friday

Annual Pro is $90 for the first year, normally $120. Or start monthly at $6 for two months, then $12.

Ends Dec 4, 11:59 PM PT.

Create an account
← Public packages

@tannerlinsley/imessage

Read, search, draft, and explicitly send iMessages on a Mac, using only built-in macOS tools.

FollowFork

Files

types.ts

83 lines · 2.0 KB · TypeScript
export type ContactAccess = {
  authorization:
    | "not-determined"
    | "restricted"
    | "denied"
    | "authorized"
    | "limited"
    | "unavailable";
  readable: boolean;
  issue: string | null;
};
export type ContactIdentity = { id: string; name: string };
export type Contact = ContactIdentity & { phoneNumbers: string[]; emailAddresses: string[] };
export type ContactPage = {
  contacts: Contact[];
  hasMore: boolean;
  ambiguous: boolean;
  contactLookup: ContactAccess;
};
export type Status = {
  contacts: ContactAccess;
  platform: "macOS";
  osVersion: string;
  databaseExists: boolean;
  readable: boolean;
  extraSoftwareRequired: false;
  issue?: string;
};
export type Conversation = {
  id: number;
  guid: string;
  identifier: string;
  name: string;
  service: string;
  participants: string[];
  participantContacts: { handle: string; contacts: ContactIdentity[] }[];
  contactName: string | null;
};
export type ConversationPage = {
  contactLookup: ContactAccess;
  conversations: Conversation[];
  hasMore: boolean;
  nextBeforeChatId: number | null;
  order: "newest-created-first";
};
export type Message = {
  id: number;
  chatId: number;
  chatGuid: string;
  chatName: string;
  service: string;
  sender: string | null;
  senderName: string | null;
  senderContacts: ContactIdentity[];
  isFromMe: boolean;
  createdAt: string | null;
  text: string;
  textTruncated: boolean;
  textSource: "plain" | "attributed" | "unavailable";
  attachmentCount: number;
  searchTextTruncated: boolean;
};
export type MessagePage = {
  contactLookup: ContactAccess;
  messages: Message[];
  scanned: number;
  unreadableTextRows: number;
  searchTruncatedRows: number;
  hasMore: boolean;
  nextBeforeMessageId: number | null;
  order: "newest-stored-first";
};
export type SendReceipt =
  | {
      status: "recorded";
      retrySafe: false;
      messageId: number;
      messageGuid: string;
      chatId: number;
      service: "iMessage" | "SMS" | "RCS";
      remoteDeliveryConfirmed: false;
    }
  | { status: "uncertain"; retrySafe: false; issue: string };