tencent cloud

Feedback

Last updated: 2024-02-06 18:08:55

    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
    });
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support