Chat SDK for Unity and Windows v1.3.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 SetContactRemark (string userId, string remark, CallBack callback=null)
 
Contact FetchContactFromLocal (string userId)
 
void FetchAllContactsFromLocal (ValueCallBack< List< Contact > > callback=null)
 
void FetchAllContactsFromServer (ValueCallBack< List< Contact > > callback=null)
 
void FetchAllContactsFromServerByPage (int limit=20, string cursor=null, ValueCallBack< CursorResult< Contact > > 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.

◆ SetContactRemark()

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

Set remark for the userId.

This is an asynchronous method.

Parameters
userIdUser ID to set a remark for.
remarkRemark to be set.
callbackThe result callback. See CallBack.

◆ FetchContactFromLocal()

Contact AgoraChat.ContactManager.FetchContactFromLocal ( string  userId)

Fetch contact information from the local database. Return null if the contact information is not obtained.

This is an synchronous method.

Parameters
userIdUser ID.
callbackThe result callback. See ValueCallBack.

◆ FetchAllContactsFromLocal()

void AgoraChat.ContactManager.FetchAllContactsFromLocal ( ValueCallBack< List< Contact > >  callback = null)

Fetch all contact information from the local database.

This is an asynchronous method.

Parameters
callbackThe result callback. See ValueCallBack.

◆ FetchAllContactsFromServer()

void AgoraChat.ContactManager.FetchAllContactsFromServer ( ValueCallBack< List< Contact > >  callback = null)

Fetch all contact information from server.

This is an asynchronous method.

Parameters
callbackThe result callback. See ValueCallBack.

◆ FetchAllContactsFromServerByPage()

void AgoraChat.ContactManager.FetchAllContactsFromServerByPage ( int  limit = 20,
string  cursor = null,
ValueCallBack< CursorResult< Contact > >  callback = null 
)

Fetch all contact information from the server in page form.

This is an asynchronous method.

Parameters
limitThe number of contact that you expect to get on each page. The value range is [1,50].
cursorThe cursor position from which to start querying data.
callbackThe result callback. 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.