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
  • 添加收藏,收藏内容由用户根据业务场景自行决定。收藏内容仅当前用户可见。

    Parameters

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

        收藏的扩展字段, 最大 1024 字符数

      • data: string

        收藏的具体数据内容, 最大 20480 字符数

      • type: number

        类型,开发者可自定义映射关系,只能是整数

      • Optional uniqueId?: string

        去重唯一 ID。

        注:当传入 uniqueId 时,会校验此 uniqueId 之前是否存在对应的收藏记录,若不存在则会新增收藏,已存在则会更新这个收藏。

      • 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
  • 添加快捷评论

    • 评论只有几个简单的字段,可删除,不计入未读数
    • 发送后,消息发送方和评论发送方的多端同步设备会触发 NIMGetInstanceOptions.onQuickComment 回调函数

    Parameters

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

        自定义推送文案

      • body: number

        评论的内容。

        注:输入整数,开发者需要自定义映射规则。如 1 为点赞的表情、2 对应鼓掌的表情等

      • Optional custom?: string

        扩展内容

      • msg: NIMMessage

        被回复的消息

      • Optional needBadge?: boolean

        是否需要消息计数(APP 的角标计数),默认 false

      • Optional needPush?: boolean

        是否需要推送,默认 false。

      • Optional pushPayload?: NIMStrAnyObj

        第三方自定义的推送属性,限制 json

      • Optional pushTitle?: string

        推送的标题

      • 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 }

              评论内容

              • body: number

                快捷评论内容

              • Optional custom?: string

                扩展内容

              • from: string

                该评论的发送方的 account ID

              • time: number

                评论的发送时间。

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

              消息, 摘取 NIMMessage 结构里的几个字段,且 idServer 在这里必须存在。

              • from: string

                消息发送方, 帐号

              • idServer: string

                服务器用于区分消息用的ID, 用于获取历史消息和获取包含关键词的历史消息。

                注:此字段可能没有, 比如说消息被反垃圾过滤了。

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

                消息场景:

                • p2p:单聊场景
                • team:群聊场景
                • superteam:超大群场景
              • time: number

                时间戳

              • to: string

                消息接收方, 帐号或群id

          Returns void

    Returns void

  • deleteCollects(options: { collectList: NIMCollect[]; done?: any }): void
  • 批量删除收藏

    Parameters

    Returns void

  • deleteQuickComment(options: { apnsText?: string; body: number; custom?: string; msg: NIMMessage; needBadge?: boolean; needPush?: boolean; pushPayload?: NIMStrAnyObj; pushTitle?: string; done?: any }): void
  • 删除一个快捷评论

    Parameters

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

        自定义推送文案

      • body: number

        评论的内容。

        注:输入整数,开发者需要自定义映射规则。如 1 为点赞的表情、2 对应鼓掌的表情等

      • Optional custom?: string

        扩展内容

      • msg: NIMMessage

        被回复的消息

      • Optional needBadge?: boolean

        是否需要消息计数(APP 的角标计数),默认 false

      • Optional needPush?: boolean

        是否需要推送,默认 false。

      • Optional pushPayload?: NIMStrAnyObj

        第三方自定义的推送属性,限制 json

      • Optional pushTitle?: string

        推送的标题

      • 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 }

              评论内容

              • body: number

                快捷评论内容

              • Optional custom?: string

                扩展内容

              • from: string

                该评论的发送方的 account ID

              • time: number

                评论的发送时间。

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

              消息, 摘取 NIMMessage 结构里的几个字段,且 idServer 在这里必须存在。

              • from: string

                消息发送方, 帐号

              • idServer: string

                服务器用于区分消息用的ID, 用于获取历史消息和获取包含关键词的历史消息。

                注:此字段可能没有, 比如说消息被反垃圾过滤了。

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

                消息场景:

                • p2p:单聊场景
                • team:群聊场景
                • superteam:超大群场景
              • time: number

                时间戳

              • to: string

                消息接收方, 帐号或群id

          Returns void

    Returns void

  • getCollects(options: { beginTime?: number; endTime?: number; lastId?: string; limit?: number; reverse?: boolean; type?: number; done?: any }): void
  • 查询收藏列表

    Parameters

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

        开始时间的时间戳, 精确到ms, 默认为0

      • Optional endTime?: number

        结束时间的时间戳, 精确到ms, 默认为服务器最新时间

      • Optional lastId?: string

        上次查询的最后一条收藏的id

        注:从第二页开始建议填写,便于服务器区分相同时间戳的两条记录。

      • Optional limit?: number

        本次查询的消息数量限制, 默认100条

      • Optional reverse?: boolean

        排列顺序。默认为 false

        • 为 true 则代表按时间戳升序查询,从 beginTime 开始查询到 endTime 之间的 limit 条记录
        • 为 true 则第二页开始,需要设置 beginTime 为上次查询的最后一条收藏时间
        • 为 false 则代表按时间戳降序查询,从 endTime 开始查询到 beginTime 之间的 limit 条记录
        • 为 false 则第二页开始,需要设置 endTime 为上次查询的最后一条收藏时间
      • Optional type?: number

        类型,开发者可自定义映射关系,只能是整数. 缺省表示查询所有的类型

      • done?:function

    Returns void

  • getMsgPins(options: { id: string; done?: any }): void
  • 传入会话id,获取该会话所有pin消息列表

    Parameters

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

    Returns void

  • getMsgsByIdServer(options: { reqMsgs: { from: string; idServer: string; scene: "p2p" | "team" | "superTeam"; time: number; to: string }[] }): void
  • 通过消息 id 等信息批量查询历史消息,thread 聊天专用

    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 }[]

        根据idServer查询服务器消息。主要用于Thread消息场景。参数数组长度最大为100。

    Returns void

  • getQuickComments(options: { msgs: NIMMessage[]; done?: any }): void
  • 批量查询消息的快捷评论

    Parameters

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

        被回复的消息

      • 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

              快捷评论的最近更新时间

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

              评论内容

              • body: 快捷评论内容
              • custom: 扩展内容
              • from: 该评论的发送方的 account ID
              • time: 评论的发送时间
            • idClient: string

              被评论的消息的 idClient

            • idServer: string

              被评论的消息的 idServer

          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
  • 获取 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

        时间戳, 开始时间, 精确到 ms, 默认为0

      • Optional endTime?: number

        时间戳, 结束时间, 精确到 ms, 默认为服务器的当前时间

      • Optional lastMsgId?: string

        上次查询的最后一条消息的 idServer, 第一次不填

      • Optional limit?: number

        本次查询的消息数量限制, 最多100条, 默认100条

      • Optional reverse?: boolean

        默认false表示从 endTime 开始往前查找历史消息,true 表示从 beginTime 开始往后查找历史消息

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

        场景

      • threadMsgFromAccount: string

        thread根消息的from,即发送者账号

      • threadMsgIdServer: string

        thread根消息的 idServer

      • threadMsgTime: number

        thread根消息的time

      • threadMsgToAccount: string

        thread根消息的to,即接受者账号

      • done?:function

    Returns void

  • updateCollect(options: { collect: NIMCollect; done?: any }): void
  • 更新收藏,只能更新 custom 字段

    Parameters

    Returns void

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