Repository: pedroslopez/whatsapp-web.js
File: index.d.ts (TypeScript)

Code before:
        getWWebVersion(): Promise<string>

        /** Sets up events and requirements, kicks off authentication request */
        initialize(): Promise<void>

        /** Check if a given ID is registered in whatsapp */
        isRegisteredUser(contactId: string): Promise<boolean>

        /** Get the registered WhatsApp ID for a number. Returns null if the number is not registered on WhatsApp. */
        getNumberId(number: string): Promise<ContactId | null>

        /**
         * Mutes this chat forever, unless a date is specified
         * @param chatId ID of the chat that will be muted
         * @param unmuteDate Date when the chat will be unmuted, leave as is to mute forever
         */
        muteChat(chatId: string, unmuteDate?: Date): Promise<void>

        /**
         * Request authentication via pairing code instead of QR code
         * @param phoneNumber - Phone number in international, symbol-free format (e.g. 12025550108 for US, 551155501234 for Brazil)
         * @param showNotification - Show notification to pair on phone number
         * @param intervalMs - The interval in milliseconds on how frequent to generate pairing code (WhatsApp default to 3 minutes)
         * @returns {Promise<string>} - Returns a pairing code in format "ABCDEFGH"
         */
        requestPairingCode(phoneNumber: string, showNotification = true, intervalMs = 180000): Promise<string>

        /** Force reset of connection state for the client */
        resetState(): Promise<void>

        /** Send a message to a specific chatId */
        sendMessage(chatId: string, content: MessageContent, options?: MessageSendOptions): Promise<Message>
        
        /** Searches for messages */
        searchMessages(query: string, options?: { chatId?: string, page?: number, limit?: number }): Promise<Message[]>

        /** Marks the client as online */
        sendPresenceAvailable(): Promise<void>

        /** Marks the client as offline */
        sendPresenceUnavailable(): Promise<void>

        /** Mark as seen for the Chat */
        sendSeen(chatId: string): Promise<boolean>

        /** Mark the Chat as unread */
        markChatUnread(chatId: string): Promise<void>

        /** 
         * Sets the current user's status message
         * @param status New status message

Review comment (bug):
`requestPairingCode` method shoud be correcly declared.
Because abstract functions cannot have function default parameters.

✅ Correct way:
`requestPairingCode(phoneNumber: string, showNotification: boolean, intervalMs: number): Promise<string>`

❌ Incorrect way:
`requestPairingCode(phoneNumber: string, showNotification = true, intervalMs = 180000): Promise<string>`

Code after:
        getPinnedMessages(chatId: string): Promise<[Message]|[]>

        /** Get all current contact instances */
        getContacts(): Promise<Contact[]>
        
        /** Get the country code of a WhatsApp ID. (154185968@c.us) => (1) */
        getCountryCode(number: string): Promise<string>

        /** Get the formatted number of a WhatsApp ID. (12345678901@c.us) => (+1 (234) 5678-901) */
        getFormattedNumber(number: string): Promise<string>

        /** Get all current Labels  */
        getLabels(): Promise<Label[]>
        
        /** Get all current Broadcasts  */
        getBroadcasts(): Promise<Broadcast[]>
        
        /** Change labels in chats  */
        addOrRemoveLabels(labelIds: Array<number|string>, chatIds: Array<string>): Promise<void>

        /** Get Label instance by ID */
        getLabelById(labelId: string): Promise<Label>

        /** Get all Labels assigned to a Chat */
        getChatLabels(chatId: string): Promise<Label[]>

        /** Get all Chats for a specific Label */
        getChatsByLabelId(labelId: string): Promise<Chat[]>

        /** Returns the contact ID's profile picture URL, if privacy settings allow it */
        getProfilePicUrl(contactId: string): Promise<string>

        /** Gets the Contact's common groups with you. Returns empty array if you don't have any common group. */
        getCommonGroups(contactId: string): Promise<ChatId[]>

        /** Gets the current connection state for the client */
        getState(): Promise<WAState>

        /** Returns the version of WhatsApp Web currently being run */
        getWWebVersion(): Promise<string>

        /** Sets up events and requirements, kicks off authentication request */
        initialize(): Promise<void>

        /** Check if a given ID is registered in whatsapp */
        isRegisteredUser(contactId: string): Promise<boolean>

        /** Get the registered WhatsApp ID for a number. Returns null if the number is not registered on WhatsApp. */
        getNumberId(number: string): Promise<ContactId | null>

        /**