联系人管理类,用于添加、查询和删除联系人。

Hierarchy

  • BaseManager
    • ChatContactManager

Constructors

Properties

_contactListeners: Set<ChatContactEventListener>
_contactSubscriptions: Map<string, EmitterSubscription>
_eventEmitter?: NativeEventEmitter
TAG: string = 'ChatContactManager'

Methods

  • 接受加好友的邀请。

    Parameters

    • userId: string

      发起好友邀请的用户 ID。

    Returns Promise<void>

    Throws

    如果有方法调用的异常会在这里抛出,可以看到具体错误原因。参见 ChatError

  • 添加好友。

    Parameters

    • userId: string

      要添加为好友的用户 ID。

    • reason: string = ''

      添加为好友的原因。该参数可选,可设置为 null""

    Returns Promise<void>

    Throws

    如果有方法调用的异常会在这里抛出,可以看到具体错误原因。参见 ChatError

  • 将指定用户加入黑名单。

    你可以向黑名单中用户发消息,但是接收不到对方发送的消息。

    Parameters

    • userId: string

      要加入黑名单的用户的用户 ID。

    Returns Promise<void>

    Throws

    如果有方法调用的异常会在这里抛出,可以看到具体错误原因。参见 ChatError

  • 拒绝加好友的邀请。

    Parameters

    • userId: string

      发起好友邀请的用户 ID。

    Returns Promise<void>

    Throws

    如果有方法调用的异常会在这里抛出,可以看到具体错误原因。参见 ChatError

  • 删除联系人及其相关的会话。

    Parameters

    • userId: string

      要删除的联系人用户 ID。

    • keepConversation: boolean = false

      是否保留要删除的联系人的会话。

      • true:是;
      • (默认)false:否。

    Returns Promise<void>

    Throws

    如果有方法调用的异常会在这里抛出,可以看到具体错误原因。参见 ChatError

  • 从服务器分页获取联系人

    Parameters

    • params: {
          cursor?: string;
          pageSize?: number;
      }
      • Optional cursor?: string
      • Optional pageSize?: number

    Returns Promise<ChatCursorResult<ChatContact>>

    联系人列表。

    Params

    params -

    • cursor: 分页游标,默认为空,可以请求第一页。
    • pageSize: 每页最大数目。默认20。 [1-50]

    Throws

    如果有方法调用的异常会在这里抛出,可以看到具体错误原因。参见 ChatError

  • 从本地数据库获取所有所有联系人。

    Returns Promise<ChatContact[]>

    联系人列表。

    Throws

    如果有方法调用的异常会在这里抛出,可以看到具体错误原因。参见 ChatError

  • 从本地数据库获取联系人列表。

    Returns Promise<string[]>

    联系人列表。

    Throws

    如果有方法调用的异常会在这里抛出,可以看到具体错误原因。参见 ChatError

  • 从服务器获取联系人列表。

    Returns Promise<string[]>

    联系人列表。

    Throws

    如果有方法调用的异常会在这里抛出,可以看到具体错误原因。参见 ChatError

  • 从本地数据库获取黑名单列表。

    Returns Promise<string[]>

    黑名单列表。

    Throws

    如果有方法调用的异常会在这里抛出,可以看到具体错误原因。参见 ChatError

  • 从服务器获取黑名单列表。

    Returns Promise<string[]>

    黑名单列表。

    Throws

    如果有方法调用的异常会在这里抛出,可以看到具体错误原因。参见 ChatError

  • 从本地数据库获取指定联系人备注信息。

    Parameters

    • userId: string

      用户ID。

    Returns Promise<ChatContact>

    联系人对象。

    Throws

    如果有方法调用的异常会在这里抛出,可以看到具体错误原因。参见 ChatError

  • 获取登录用户在其他登录设备上唯一 ID,该 ID 由 user ID + "/" + resource 组成。

    Returns Promise<string[]>

    该方法调用成功会返回 ID 列表。

    Throws

    如果有方法调用的异常会在这里抛出,可以看到具体错误原因。参见 ChatError

  • 将指定用户移除黑名单。

    Parameters

    • userId: string

      要在黑名单中移除的用户 ID。

    Returns Promise<void>

    Throws

    如果有方法调用的异常会在这里抛出,可以看到具体错误原因。参见 ChatError

  • 设置联系人备注。

    Parameters

    • contact: ChatContact

      联系人对象,包括将要设置的备注。

    Returns Promise<void>

    Throws

    如果有方法调用的异常会在这里抛出,可以看到具体错误原因。参见 ChatError

  • Parameters

    • event: NativeEventEmitter

    Returns void

  • Type Parameters

    • T

    Parameters

    • method: string
    • Optional args: {}

      Returns Promise<T>

    • Parameters

      • result: any

      Returns void

    • Parameters

      Returns void

    Generated using TypeDoc