The contact manager class, which manages chat contacts such as adding, retrieving, modifying, and deleting contacts.

Hierarchy

  • BaseManager
    • ChatContactManager

Constructors

Properties

_eventEmitter?: NativeEventEmitter
TAG: string = 'ChatContactManager'

Methods

  • Accepts a friend invitation。

    Parameters

    • userId: string

      The user who sends the friend invitation.

    Returns Promise<void>

    A description of the exception. See ChatError.

  • Adds a new contact.

    Parameters

    • userId: string

      The user ID of the contact to add.

    • reason: string = ''

      The reason for adding the contact. This parameter is optional and can be null or "".

    Returns Promise<void>

    A description of the exception. See ChatError.

  • Adds a contact listener.

    Parameters

    Returns void

  • Adds a contact to the block list.

    You can send messages to the users on the block list, but cannot receive messages from them.

    Parameters

    • userId: string

      The user ID of the contact to be added to the block list.

    Returns Promise<void>

    A description of the exception. See ChatError.

  • Declines a friend invitation.

    Parameters

    • userId: string

      The user who sends the friend invitation.

    Returns Promise<void>

    A description of the exception. See ChatError.

  • Deletes a contact and all the related conversations.

    Parameters

    • userId: string

      The user ID of the contact to delete.

    • keepConversation: boolean = false

      Whether to retain conversations of the contact to delete.

      • true: Yes.
      • (Default) false: No.

    Returns Promise<void>

    A description of the exception. See ChatError.

  • Gets all contacts from the server.

    Returns Promise<ChatContact[]>

    The list of contacts.

    A description of the exception. See ChatError.

  • Gets the contacts from the server.

    Parameters

    • params: {
          cursor?: string;
          pageSize?: number;
      }
      • Optionalcursor?: string
      • OptionalpageSize?: number

    Returns Promise<ChatCursorResult<ChatContact>>

    The list of contacts.

    params -

    • cursor: The cursor of the page to get. The first page is an empty string.
    • pageSize: The number of contacts to get. The default value is 20. [1-50]

    A description of the exception. See ChatError.

  • Gets all contacts from the local database.

    Returns Promise<ChatContact[]>

    The list of contacts.

    A description of the exception. See ChatError.

  • Gets the contact list from the local database.

    Returns Promise<string[]>

    The contact list.

    A description of the exception. See ChatError.

  • Gets the contact list from the server.

    Returns Promise<string[]>

    The list of contacts.

    A description of the exception. See ChatError.

  • Gets the block list from the local database.

    Returns Promise<string[]>

    The block list obtained from the local database.

    A description of the exception. See ChatError.

  • Gets the block list from the server.

    Returns Promise<string[]>

    The block list obtained from the server.

    A description of the exception. See ChatError.

  • Gets the contact by user ID from local database.

    Parameters

    • userId: string

      The user ID of the contact to get.

    Returns Promise<undefined | ChatContact>

    The contact.

    A description of the exception. See ChatError.

  • Gets the unique IDs of the current user on the other devices. The ID is in the format of {user_ID} + "/" + {resource_ID}.

    Returns Promise<string[]>

    The list of unique IDs of users on the other devices if the method succeeds.

    A description of the exception. See ChatError.

  • Removes all contact listeners.

    Returns void

  • Removes the contact listener.

    Parameters

    Returns void

  • Removes the contact from the block list.

    Parameters

    • userId: string

      The user ID of the contact to be removed from the block list.

    Returns Promise<void>

    A description of the exception. See ChatError.

  • Set the contact's remark.

    Parameters

    Returns Promise<void>

    A description of the exception. See ChatError.

  • Parameters

    • event: NativeEventEmitter

    Returns void

  • Type Parameters

    • T

    Parameters

    • method: string
    • Optionalargs: {}

      Returns Promise<T>

    • Parameters

      • result: any

      Returns void

    • Parameters

      Returns void

    • Parameters

      Returns void