Chat SDK for Unity and Windows v1.2.0
Public Member Functions | List of all members
AgoraChat.ContactManager Class Reference
Inheritance diagram for AgoraChat.ContactManager:

Public Member Functions

void AddContact (string userId, string reason=null, CallBack callback=null)
 
void DeleteContact (string userId, bool keepConversation=false, CallBack callback=null)
 
void GetAllContactsFromServer (ValueCallBack< List< string > > callback=null)
 
List< string > GetAllContactsFromDB ()
 
void AddUserToBlockList (string userId, CallBack callback=null)
 
void RemoveUserFromBlockList (string userId, CallBack callback=null)
 
void GetBlockListFromServer (ValueCallBack< List< string > > callback=null)
 
List< string > GetBlockListFromDB ()
 
void AcceptInvitation (string userId, CallBack callback=null)
 
void DeclineInvitation (string userId, CallBack callback=null)
 
void GetSelfIdsOnOtherPlatform (ValueCallBack< List< string > > callback=null)
 
void AddContactManagerDelegate (IContactManagerDelegate contactManagerDelegate)
 
void RemoveContactManagerDelegate (IContactManagerDelegate contactManagerDelegate)
 

Detailed Description

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

Member Function Documentation

◆ AddContact()

void AgoraChat.ContactManager.AddContact ( string  userId,
string  reason = null,
CallBack  callback = null 
)

Adds a new contact.

This is an asynchronous method.

Parameters
userIdThe user ID of the contact to add.
reasonThe invitation message. This parameter is optional and can be set to null or "".
callbackThe result callback. See CallBack.

◆ DeleteContact()

void AgoraChat.ContactManager.DeleteContact ( string  userId,
bool  keepConversation = false,
CallBack  callback = null 
)

Deletes a contact and all the related conversations.

This is an asynchronous method.

Parameters
userIdThe user ID of the contact to delete.
keepConversationWhether to retain conversations of the contact to delete.
  • true: Yes.
  • (Default) false: No.
callbackThe result callback. See CallBack.

◆ GetAllContactsFromServer()

void AgoraChat.ContactManager.GetAllContactsFromServer ( ValueCallBack< List< string > >  callback = null)

Gets the contact list from the server.

This is an asynchronous method.

Parameters
callbackThe result callback. If success, the SDK returns the list of contacts; if a failure occurs, the SDK returns the error information. See ValueCallBack.

◆ GetAllContactsFromDB()

List< string > AgoraChat.ContactManager.GetAllContactsFromDB ( )

Gets the contact list from the local database.

Returns
If success, the SDK returns the list of contacts; if a failure occurs, the SDK returns an empty list.

◆ AddUserToBlockList()

void AgoraChat.ContactManager.AddUserToBlockList ( string  userId,
CallBack  callback = null 
)

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

This is an asynchronous method.

Parameters
userIdThe user ID of the contact to be added to the block list.
callbackThe result callback. See CallBack.

◆ RemoveUserFromBlockList()

void AgoraChat.ContactManager.RemoveUserFromBlockList ( string  userId,
CallBack  callback = null 
)

Removes the contact from the block list.

This is an asynchronous method.

Parameters
userIdThe user ID of the contact to be removed from the block list.
callbackThe result callback. See CallBack.

◆ GetBlockListFromServer()

void AgoraChat.ContactManager.GetBlockListFromServer ( ValueCallBack< List< string > >  callback = null)

Gets the block list from the server.

This is an asynchronous method.

Parameters
callbackThe result callback. If success, the SDK returns the block list; if a failure occurs, the SDK returns the error information. See ValueCallBack.

◆ GetBlockListFromDB()

List< string > AgoraChat.ContactManager.GetBlockListFromDB ( )

Gets the local blocklist.

Returns
The blocklist.

◆ AcceptInvitation()

void AgoraChat.ContactManager.AcceptInvitation ( string  userId,
CallBack  callback = null 
)

Accepts a friend invitation.

This an asynchronous method.

Parameters
userIdThe user who initiates the friend invitation.
callbackThe result callback. See CallBack.

◆ DeclineInvitation()

void AgoraChat.ContactManager.DeclineInvitation ( string  userId,
CallBack  callback = null 
)

Declines a friend invitation.

This an asynchronous method.

Parameters
userIdThe user who initiates the friend invitation.
callbackThe result callback. See CallBack.

◆ GetSelfIdsOnOtherPlatform()

void AgoraChat.ContactManager.GetSelfIdsOnOtherPlatform ( ValueCallBack< List< string > >  callback = null)

Gets the unique IDs of the current user on the other devices.

The ID is in the format of user ID + "/" + resource.

This is an asynchronous method.

Parameters
callbackThe result callback. If success, the SDK returns the unique IDs of the current user on the other devices; if a failure occurs, the SDK returns the error information. See ValueCallBack.

◆ AddContactManagerDelegate()

void AgoraChat.ContactManager.AddContactManagerDelegate ( IContactManagerDelegate  contactManagerDelegate)

Adds a contact listener.

Parameters
contactManagerDelegateThe contact listener to add. It is inherited from IContactManagerDelegate.

◆ RemoveContactManagerDelegate()

void AgoraChat.ContactManager.RemoveContactManagerDelegate ( IContactManagerDelegate  contactManagerDelegate)

Removes a contact listener.

Parameters
contactManagerDelegateThe contact listener to remove. It is inherited from IContactManagerDelegate.