Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • MessageExtendInterface

Implemented by

Index

Methods

  • addCollect(options: { custom?: string; data: string; type: number; uniqueId?: string; done?: any }): void
  • Add collection, and the content of the collections determined according to the business scenario. Collections are only visible to the current user.

    Parameters

    • options: { custom?: string; data: string; type: number; uniqueId?: string; done?: any }
      • Optional custom?: string

        the bookmark extension field that can contain 1024 characters

      • data: string

        The specific data of the bookmark, the maximum number of characters is 20480

      • type: number

        Type, you can customize the mapping relationship, must be an integer

      • Optional uniqueId?: string

        Unique ID.

        Note: When the uniqueId is passed,the server checks whether there is a collection record before for uniqueId. If it does not exist, a new collection will be added, and if it exists, the collection will be updated.

      • done?:function

    Returns void

  • addMsgPin(options: { msg: NIMMsgPinInfo; pinCustom?: string; done?: any }): void
  • addQuickComment(options: { apnsText?: string; body: number; custom?: string; msg: NIMMessage; needBadge?: boolean; needPush?: boolean; pushPayload?: NIMStrAnyObj; pushTitle?: string; done?: any }): void
  • Add a quick comment

    • Comments have only a few fields, can be deleted, and are not counted as unread
    • The clients of the sender and the commenter will trigger the NIMGetInstanceOptions.onQuickComment callback.

    Parameters

    • options: { apnsText?: string; body: number; custom?: string; msg: NIMMessage; needBadge?: boolean; needPush?: boolean; pushPayload?: NIMStrAnyObj; pushTitle?: string; done?: any }
      • Optional apnsText?: string

        Custom text for push notifications

      • body: number

        Comment

        Note: Enter an integer, you can create custom mapping rules. For example, 1 for the like emoj, 2 for the clapping emoj.

      • Optional custom?: string

        Extension

      • msg: NIMMessage

        Message to be replied

      • Optional needBadge?: boolean

        Whether message count is required (badge at the app corner). The default value is false.

      • Optional needPush?: boolean

        whether a push notification is required. The default value is false..

      • Optional pushPayload?: NIMStrAnyObj

        Custom property of a push notification in JSON.

      • Optional pushTitle?: string

        Title for a push notification

      • done?:function
        • done(err: null | NIMCommonError | Error | NIMStrAnyObj, data: { comment: { body: number; custom?: string; from: string; time: number }; msg: { from: string; idServer: string; scene: "p2p" | "team" | "superTeam"; time: number; to: string } }): void
        • Parameters

          • err: null | NIMCommonError | Error | NIMStrAnyObj
          • data: { comment: { body: number; custom?: string; from: string; time: number }; msg: { from: string; idServer: string; scene: "p2p" | "team" | "superTeam"; time: number; to: string } }
            • comment: { body: number; custom?: string; from: string; time: number }

              Comment

              • body: number

                Quick comment

              • Optional custom?: string

                Extension

              • from: string

                ID of the account making the comment.

              • time: number

                time when the comment is posted.

            • msg: { from: string; idServer: string; scene: "p2p" | "team" | "superTeam"; time: number; to: string }

              Messaging scenario:

              • p2p: Private chat
              • team: group chat
              • superteam: supergroup chat
              • from: string

                account of a sender

              • idServer: string

                The ID used by the server to distinguish messages, used to get message history and keywords for searching message history.

                Note: This field may not be available. For example, the message is filtered by anti-spam.

              • scene: "p2p" | "team" | "superTeam"

                Messaging scenario:

                • p2p: Private chat
                • team: group chat
                • superteam: supergroup chat
              • time: number

                Timestamp

              • to: string

                ID of a recipient, account ID or group ID

          Returns void

    Returns void

  • deleteCollects(options: { collectList: NIMCollect[]; done?: any }): void
  • Delete multiple collections at a time.

    Parameters

    Returns void

  • deleteQuickComment(options: { apnsText?: string; body: number; custom?: string; msg: NIMMessage; needBadge?: boolean; needPush?: boolean; pushPayload?: NIMStrAnyObj; pushTitle?: string; done?: any }): void
  • Delete a quick comment

    Parameters

    • options: { apnsText?: string; body: number; custom?: string; msg: NIMMessage; needBadge?: boolean; needPush?: boolean; pushPayload?: NIMStrAnyObj; pushTitle?: string; done?: any }
      • Optional apnsText?: string

        Custom text for push notifications

      • body: number

        Comment

        Note: Enter an integer, you can create custom mapping rules. For example, 1 for the like emoj, 2 for the clapping emoj.

      • Optional custom?: string

        Extension

      • msg: NIMMessage

        Message to be replied

      • Optional needBadge?: boolean

        Whether message count is required (badge at the app corner). The default value is false.

      • Optional needPush?: boolean

        whether a push notification is required. The default value is false..

      • Optional pushPayload?: NIMStrAnyObj

        Custom property of a push notification in JSON.

      • Optional pushTitle?: string

        Title for a push notification

      • done?:function
        • done(err: null | NIMCommonError | Error | NIMStrAnyObj, data: { comment: { body: number; custom?: string; from: string; time: number }; msg: { from: string; idServer: string; scene: "p2p" | "team" | "superTeam"; time: number; to: string } }): void
        • Parameters

          • err: null | NIMCommonError | Error | NIMStrAnyObj
          • data: { comment: { body: number; custom?: string; from: string; time: number }; msg: { from: string; idServer: string; scene: "p2p" | "team" | "superTeam"; time: number; to: string } }
            • comment: { body: number; custom?: string; from: string; time: number }

              Comment

              • body: number

                Quick comment

              • Optional custom?: string

                Extension

              • from: string

                ID of the account making the comment.

              • time: number

                time when the comment is posted.

            • msg: { from: string; idServer: string; scene: "p2p" | "team" | "superTeam"; time: number; to: string }

              Message, extract several fields in the NIMMessage structure, and idServer must exist.

              • from: string

                account of a sender

              • idServer: string

                The ID used by the server to distinguish messages, used to get message history and keywords for searching message history.

                Note: This field may not be available. For example, the message is filtered by anti-spam.

              • scene: "p2p" | "team" | "superTeam"

                Messaging scenario:

                • p2p: Private chat
                • team: group chat
                • superteam: supergroup chat
              • time: number

                Timestamp

              • to: string

                ID of a recipient, account ID or group ID

          Returns void

    Returns void

  • getCollects(options: { beginTime?: number; endTime?: number; lastId?: string; limit?: number; reverse?: boolean; type?: number; done?: any }): void
  • Query collections

    Parameters

    • options: { beginTime?: number; endTime?: number; lastId?: string; limit?: number; reverse?: boolean; type?: number; done?: any }
      • Optional beginTime?: number

        Timestamp of start time in milliseconds, default value: 0

      • Optional endTime?: number

        Timestamp of the end time in milliseconds. the default value is the current server time

      • Optional lastId?: string

        The ID of the last collection in the last query

        Note: It is recommended to fill out from the second page, so that the server can distinguish two records with the same timestamp.

      • Optional limit?: number

        The upper limit of messages per query. 100 messages by default

      • Optional reverse?: boolean

        Sorting order. The default value is false

        • If true, query collections in ascending order by timestamp, and limit number of records from beginTime to endTime
        • If true, from the second page, set beginTime as the time of the last collection in the last query
        • If false, query collections in descending order by timestamp, and limit number records from endTime to beginTime
        • If false, the second page starts, set endTime as the time of the last collection in the last query
      • Optional type?: number

        Type, you can customize the mapping relationship, must be an integer. All types of messages are queried by default.

      • done?:function

    Returns void

  • getMsgPins(options: { id: string; done?: any }): void
  • Get all PIN messages by conversation ID

    Parameters

    • options: { id: string; done?: any }

    Returns void

  • getMsgsByIdServer(options: { reqMsgs: { from: string; idServer: string; scene: "p2p" | "team" | "superTeam"; time: number; to: string }[] }): void
  • Query message history by message ID and other information, exclusive to thread chat

    Parameters

    • options: { reqMsgs: { from: string; idServer: string; scene: "p2p" | "team" | "superTeam"; time: number; to: string }[] }
      • reqMsgs: { from: string; idServer: string; scene: "p2p" | "team" | "superTeam"; time: number; to: string }[]

        Query messages by idServer. for messages in a thread The maximum length of the parameter array is 100.

    Returns void

  • getQuickComments(options: { msgs: NIMMessage[]; done?: any }): void
  • Get multiple quick comments at a time.

    Parameters

    • options: { msgs: NIMMessage[]; done?: any }
      • msgs: NIMMessage[]

        Message to be replied

      • done?:function
        • done(err: null | NIMCommonError | Error | NIMStrAnyObj, data: { commentTimetag: number; comments: { body: number; custom?: string; from: string; time: number }[]; idClient: string; idServer: string }): void
        • Parameters

          • err: null | NIMCommonError | Error | NIMStrAnyObj
          • data: { commentTimetag: number; comments: { body: number; custom?: string; from: string; time: number }[]; idClient: string; idServer: string }
            • commentTimetag: number

              The recent update time of a quick comment.

            • comments: { body: number; custom?: string; from: string; time: number }[]

              Comment

              • body: Quick comment content
              • custom: Extension content
              • from: Account ID posting the comment
              • time: Time when the comment was sent
            • idClient: string

              idClient of a message commented

            • idServer: string

              idServer of a message commented

          Returns void

    Returns void

  • getThreadMsgs(options: { beginTime?: number; endTime?: number; lastMsgId?: string; limit?: number; reverse?: boolean; scene: "p2p" | "team" | "superTeam"; threadMsgFromAccount: string; threadMsgIdServer: string; threadMsgTime: number; threadMsgToAccount: string; done?: any }): void
  • Get the list of messages in a thread.

    Parameters

    • options: { beginTime?: number; endTime?: number; lastMsgId?: string; limit?: number; reverse?: boolean; scene: "p2p" | "team" | "superTeam"; threadMsgFromAccount: string; threadMsgIdServer: string; threadMsgTime: number; threadMsgToAccount: string; done?: any }
      • Optional beginTime?: number

        Start time in milliseconds. the default value: 0

      • Optional endTime?: number

        Timestamp of the end time in milliseconds, the default value is the current time of the server

      • Optional lastMsgId?: string

        The idServer of the last message in the last query. No value for the first query.

      • Optional limit?: number

        The upper limit of messages per query. 100 messages by default

      • Optional reverse?: boolean

        The default false means to search for message history forward from endTime, and true means to search for message history backward from beginTime

      • scene: "p2p" | "team" | "superTeam"

        Scenario

      • threadMsgFromAccount: string

        Sender account of a message in the thread

      • threadMsgIdServer: string

        ServerID of the root message in a thread.

      • threadMsgTime: number

        Time of the root message in a thread

      • threadMsgToAccount: string

        Recipient of a thread message

      • done?:function

    Returns void

  • updateCollect(options: { collect: NIMCollect; done?: any }): void
  • Update collections, only custom fields can be updated.

    Parameters

    Returns void

  • updateMsgPin(options: { msg: NIMMsgPinInfo; pinCustom?: string; done?: any }): void