Friendship

Manage friends

Ncloud Chat provides functions of inviting and managing friends to facilitate social networking among users. Through this system, you can perform various friend management tasks such as inviting, accepting, refusing, and deleting friends. The following describes the main details of friend management features and how to use each function.

Friend list

You can view the list of your friends and, by extension, filter and view friends in a specific status. The list is managed through paging options so that you can manage many users effectively.

Hashtable filter = new Hashtable
{
    { "status", "accepted" },
};
Hashtable sort = new Hashtable
{
    { "created_at", -1 },
};
Hashtable option = new Hashtable
{
    { "offset", 0 },
    { "per_page", 10 },
};
var friends = await nc.getFriendships(filter, sort, option);
  • Filter: filters based on the status of the friend you want to view (e.g., "accepted").

  • Sort: sets the criteria to sort the results. Here, sorting in descending order is used based on the creation time.

  • Option: sets the scope of data you want to view. offset specifies the location where the data starts, and per_page specifies the number of messages to be returned per page.

Invite

Invites a certain friend as a friend. The user who is invited can accept or decline this request.

var response = await nc.requestFriend(friendId);
  • friendId: identifier of the user you want to invite.

Accept

Accepts the friend invitation you received. Through this, two users have a mutual friendship.

var response = await nc.acceptFriend(friendId);
  • friendId: user identifier of the friend invitation you want to accept.

Reject

Rejects the friend invitation you received. When you reject the request, you can't have the other person as a friend.

var response = await nc.rejectFriend(friendId);
  • friendId: user identifier of the friend invitation you want to reject.

Delete

Deletes a certain user from the friend list. This task might be performed regardless of friend status or invitation status.

var response = await nc.removeFriend(friendId);
  • friendId: user identifier of the friend you want to delete.

The friend management features promote interaction among users, and has an important role in enhancing networking. Through this function, you can easily expand and manage your social network.

Last updated