please select
  • UIKit
  • SDK
  • Server APIs
Chat/
SDK/
Unity(Game Solution)/
User/
SDK
  • Run Demo
  • SDK Integration
  • Initialization
  • Login and Logout
  • Message
    • Message Overview
    • Sending Message
    • Receiving Message
    • Historical Message
    • Forwarding Message
    • Modifying Message
    • Deleting Message
    • Clearing Messages
    • Recalling Message
    • Online Message
    • Read Receipt
    • Querying Message
    • Group @ Message
    • Targeted Group Message
    • Notification Muting
    • Message Extension
  • Conversation
    • Conversation Overview
    • Conversation List
    • Getting Conversation
    • Conversation Unread Count
    • Pinning Conversation to the Top
    • Deleting Conversation
    • Conversation Draft
    • Conversation Mark
    • Conversation Group
  • Group
    • Group Overview
    • Group Management
    • Group Profile
    • Group Member Management
    • Group Member Profile
    • Custom Group Attribute
    • Group Counter
  • User
    • User Profile
    • User Status
    • Friend Management
    • Friend List
    • Blocklist
  • Changelog
  • Guideline for Beginners
  • Console Guide
    • Creating and Upgrading an Application
    • Basic Configuration
    • Feature Configuration
    • Account Management
    • Group Management
    • Webhook Configuration
  • Product Introduction
    • Message Management
      • One-to-One Message
      • Message Storage
      • Offline Push
      • Group Message
      • Message Formats
    • Account System
      • Login Authentication
      • Online Status Management
    • Group Related
      • Group System
      • Group Management
    • User Profile and Relationship Chain
      • Profile Management
      • Relationship Chain Management
  • Purchase Guide
    • Billing Overview
    • Pricing
  • Error Codes

Friend List

Feature Description

To group friends into categories such as "Classmates at university" and "Coworkers", call the following APIs.

Friend List

Creating a friend list

Call the FriendshipCreateFriendGroup API ([Details](https://comm.qq.com/im/doc/unity/en/ api/FriendshipApi/FriendshipCreateFriendGroup.html)) to create a friend list.
Sample code:
// Create a friend list and add a friend to the list
FriendGroupInfo param = new FriendGroupInfo
{
friendship_create_friend_group_param_name_array = new List<string>
{
"group_name"
},
friendship_create_friend_group_param_identifier_array = new List<string>
{
"user_id"
}
};
TIMResult res = TencentIMSDK.FriendshipCreateFriendGroup(param, (int code, string desc, List<FriendResult> result, string user_data)=>{
// Process the async logic
});

Deleting a friend list

Call the FriendshipDeleteFriendGroup API (Details) to delete a friend list.
Sample code:
// Delete a friend list
List<string> param = new List<string>
{
"user_id"
};
TIMResult res = TencentIMSDK.FriendshipDeleteFriendGroup(param, (int code, string desc, string user_data)=>{
// Process the async logic
});

Renaming a friend list

Call the FriendshipModifyFriendGroup API (Details) to rename a friend list.
Sample code:
// Rename a friend list
FriendshipModifyFriendGroupParam param = new FriendshipModifyFriendGroupParam
{
friendship_modify_friend_group_param_name = "old_group_name",
friendship_modify_friend_group_param_new_name = "new_group_name"
};
TIMResult res = TencentIMSDK.FriendshipModifyFriendGroup(param, (int code, string desc, List<FriendResult> result, string user_data)=>{
// Process the async logic
});

Getting a friend list

Call the FriendshipGetFriendGroupList API (Details) to get a friend list.
Sample code:
// Get the information of a friend list by list name
List<string> param = new List<string>
{
"user_id"
};
TIMResult res = TencentIMSDK.FriendshipGetFriendGroupList(param, (int code, string desc, List<FriendGroupInfo> info_list, string user_data)=>{
// Process the async logic
});

Adding a friend to a list

Call the FriendshipModifyFriendGroup API (Details) to add a friend to a list.
Sample code:
// Add a friend to a friend list
FriendshipModifyFriendGroupParam param = new FriendshipModifyFriendGroupParam
{
friendship_modify_friend_group_param_name = "group_name",
friendship_modify_friend_group_param_add_identifier_array = new List<string>
{
"user_id"
}
};
TIMResult res = TencentIMSDK.FriendshipModifyFriendGroup(param, (int code, string desc, List<FriendResult> result, string user_data)=>{
// Process the async logic
});

Removing a friend from a list

Call FriendshipModifyFriendGroup (Details) to remove a friend from a list.
Sample code:
// Remove a friend from a list
FriendshipModifyFriendGroupParam param = new FriendshipModifyFriendGroupParam
{
friendship_modify_friend_group_param_name = "group_name",
friendship_modify_friend_group_param_delete_identifier_array = new List<string>
{
"user_id"
}
};
TIMResult res = TencentIMSDK.FriendshipModifyFriendGroup(param, (int code, string desc, List<FriendResult> result, string user_data)=>{
// Process the async logic
});