Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface UserInterface

Hierarchy

  • UserInterface

Implemented by

Index

Methods

  • addToBlacklist(options: { account: string; done?: any }): void
  • 加入黑名单。调用后,初始化同步阶段收到 onblacklist 回调,多端同步阶段收到 onsyncmarkinblacklist 回调

    示例场景

    Parameters

    • options: { account: string; done?: any }
      • account: string
      • done?:function
        • done(err: null | NIMCommonError | Error | NIMStrAnyObj, data: { account: string; isAdd: boolean; record: { account: string; updateTime: number } }): void
        • Parameters

          • err: null | NIMCommonError | Error | NIMStrAnyObj
          • data: { account: string; isAdd: boolean; record: { account: string; updateTime: number } }
            • account: string

              被操作者账号 ID

            • isAdd: boolean

              是否加入名单(黑名单或者静音列表)

              true 代表某人被加入名单,false 代表某人被移出名单

            • record: { account: string; updateTime: number }

              该操作记录的详情

              • account: string

                被操作者账号 ID

              • updateTime: number

                更新时间戳

          Returns void

    Returns void

  • addToMutelist(options: { account: string; done?: any }): void
  • 加入静音列表。调用后,初始化同步阶段收到 onmutelist 回调,多端同步阶段收到 onsyncmarkinmutelist 回调

    • 通过设置静音列表来控制单聊免打扰
    • 被静音用户发送的消息,不会通过推送通知给用户
    • 用户 UI 层,可以通过静音列表来决定是否渲染会话的未读数

    示例场景

    Parameters

    • options: { account: string; done?: any }
      • account: string
      • done?:function
        • done(err: null | NIMCommonError | Error | NIMStrAnyObj, data: { account: string; isAdd: boolean; record: { account: string; updateTime: number } }): void
        • Parameters

          • err: null | NIMCommonError | Error | NIMStrAnyObj
          • data: { account: string; isAdd: boolean; record: { account: string; updateTime: number } }
            • account: string

              被操作者账号 ID

            • isAdd: boolean

              是否加入名单(黑名单或者静音列表)

              true 代表某人被加入名单,false 代表某人被移出名单

            • record: { account: string; updateTime: number }

              该操作记录的详情

              • account: string

                被操作者账号 ID

              • updateTime: number

                更新时间戳

          Returns void

    Returns void

  • getRelations(options: { done?: any }): void
  • 获取黑名单和静音列表。如果开发者在初始化SDK的时候设置了syncRelations为false, 那么就收不到onblacklist和onmutelist回调, 可以调用此接口来获取黑名单和静音列表。

    Parameters

    • options: { done?: any }
      • done?:function
        • done(err: null | NIMCommonError | Error | NIMStrAnyObj, data: { blacklist: { account: string; createTime: number; isBlack?: boolean; isMuted?: boolean; updateTime: number }[]; mutelist: { account: string; createTime: number; isBlack?: boolean; isMuted?: boolean; updateTime: number }[] }): void
        • Parameters

          • err: null | NIMCommonError | Error | NIMStrAnyObj
          • data: { blacklist: { account: string; createTime: number; isBlack?: boolean; isMuted?: boolean; updateTime: number }[]; mutelist: { account: string; createTime: number; isBlack?: boolean; isMuted?: boolean; updateTime: number }[] }
            • blacklist: { account: string; createTime: number; isBlack?: boolean; isMuted?: boolean; updateTime: number }[]
              • account: IM account
              • isMuted: 是否被静音
              • isBlack: 是否被拉入黑名单
            • mutelist: { account: string; createTime: number; isBlack?: boolean; isMuted?: boolean; updateTime: number }[]
              • account: IM account
              • isMuted: 是否被静音
              • isBlack: 是否被拉入黑名单

          Returns void

    Returns void

  • getUser(options: { account: string; sync?: boolean; done?: any }): void
  • getUsers(options: { accounts: string[]; sync?: boolean; done?: any }): void
  • 获取一批用户的名片, 每次最多 150 个.

    Parameters

    • options: { accounts: string[]; sync?: boolean; done?: any }

    Returns void

  • getUsersFromDB(options: { accountIds?: string[]; done?: any }): void
  • isUserInBlackList(options: { account: string; done?: any }): void
  • 查看某人是否在当前用户在黑名单里

    注:该接口需要数据库支持,若没有开启本地数据库能力,done 回调里只会返回 false

    Parameters

    Returns void

  • removeFromBlacklist(options: { account: string; done?: any }): void
  • 移出黑名单。调用后,初始化同步阶段收到 onblacklist 回调,多端同步阶段收到 onsyncmarkinblacklist 回调

    示例场景

    Parameters

    • options: { account: string; done?: any }
      • account: string
      • done?:function
        • done(err: null | NIMCommonError | Error | NIMStrAnyObj, data: { account: string; isAdd: boolean; record: { account: string; updateTime: number } }): void
        • Parameters

          • err: null | NIMCommonError | Error | NIMStrAnyObj
          • data: { account: string; isAdd: boolean; record: { account: string; updateTime: number } }
            • account: string

              被操作者账号 ID

            • isAdd: boolean

              是否加入名单(黑名单或者静音列表)

              true 代表某人被加入名单,false 代表某人被移出名单

            • record: { account: string; updateTime: number }

              该操作记录的详情

              • account: string

                被操作者账号 ID

              • updateTime: number

                更新时间戳

          Returns void

    Returns void

  • removeFromMutelist(options: { account: string; done?: any }): void
  • 移出静音列表。调用后,初始化同步阶段收到 onmutelist 回调,多端同步阶段收到 onsyncmarkinmutelist 回调

    设置静音列表有两个作用:

    1. 开发者根据用户是否在静音列表,决定是否显示未读数等提示UI
    2. 静音列表中用户发送消息,不会触发推送服务

    示例场景

    Parameters

    • options: { account: string; done?: any }
      • account: string
      • done?:function
        • done(err: null | NIMCommonError | Error | NIMStrAnyObj, data: { account: string; isAdd: boolean; record: { account: string; updateTime: number } }): void
        • Parameters

          • err: null | NIMCommonError | Error | NIMStrAnyObj
          • data: { account: string; isAdd: boolean; record: { account: string; updateTime: number } }
            • account: string

              被操作者账号 ID

            • isAdd: boolean

              是否加入名单(黑名单或者静音列表)

              true 代表某人被加入名单,false 代表某人被移出名单

            • record: { account: string; updateTime: number }

              该操作记录的详情

              • account: string

                被操作者账号 ID

              • updateTime: number

                更新时间戳

          Returns void

    Returns void

  • updateMyInfo(options: { antiSpamBusinessId?: string; avatar?: string; birth?: string; custom?: string; email?: string; gender?: "unknown" | "male" | "female"; nick?: string; sign?: string; tel?: string; done?: any }): void
  • 更新我的名片。调用后,初始化同步阶段收到 onmyinfo 回调,多端同步阶段收到 onupdatemyinfo 回调

    示例场景

    Parameters

    • options: { antiSpamBusinessId?: string; avatar?: string; birth?: string; custom?: string; email?: string; gender?: "unknown" | "male" | "female"; nick?: string; sign?: string; tel?: string; done?: any }
      • Optional antiSpamBusinessId?: string

        用户配置的对某些资料内容另外的反垃圾的业务 ID

      • Optional avatar?: string

        头像

      • Optional birth?: string

        出生日期

      • Optional custom?: string

        扩展字段

      • Optional email?: string

        邮箱

      • Optional gender?: "unknown" | "male" | "female"

        性别

      • Optional nick?: string

        昵称

      • Optional sign?: string

        签名

      • Optional tel?: string

        电话

      • done?:function

    Returns void