Combu  3.2.2
Unity API Documentation
Managing Contacts

In this section you will learn how to retrieve the contacts lists of the local user and how to add/remove users to the friends/ignore lists.

Loading Contacts

To retrieve the list of contacts from the local user you need to call the LoadFriends method on CombuManager.localUser and then access to the results list accordingly to the eContactType value passed to the function (CombuManager.localUser.friends for eContactType.Friend, CombuManager.localUser.requests for eContactType.Request, CombuManager.localUser.ignored for eContactType.Ignore, CombuManager.localUser.pendingRequests for eContactType.PendingRequest):

CombuManager.localUser.LoadFriends( eContactType.Friend, (bool success) => {
if (success)
Debug.Log("Success: " + CombuManager.localUser.friends.Length);
else
Debug.Log("Failed");
});
eContactType
Contact type.
Definition: CombuEnums.cs:14

Adding Contacts

To add another user to a contact list of the local user you need to call AddContact and pass either a User/Profile object or a username and eContactType.Friend as contact type:

// Add by User/Profile object
CombuManager.localUser.AddContact(otherUser, eContactType.Friend, (bool success, string error) => {
if (success)
Debug.Log("Success");
else
Debug.Log("Failed: " + error);
});
// Add by username
CombuManager.localUser.AddContact("username", eContactType.Friend, (bool success, string error) => {
if (success)
Debug.Log("Success");
else
Debug.Log("Failed: " + error);
});

Removing Contacts

To remove a user from the contact lists of the local user you need to call RemoveContact:

// Remove by User/Profile object
CombuManager.localUser.RemoveContact(otherUser, (bool success, string error) => {
if (success)
Debug.Log("Success");
else
Debug.Log("Failed: " + error);
});
// Remove by username
CombuManager.localUser.RemoveContact("username", (bool success, string error) => {
if (success)
Debug.Log("Success");
else
Debug.Log("Failed: " + error);
});