FriendshipGetPendencyList

功能介绍

获取好友申请未决

好友添加请求未决信息是指好友添加请求未处理的操作。例如,开发者添加对方为好友,对方还没有处理;或者有人添加开发者为好友,开发者还没有处理,称之为好友添加请求未决信息

参数详解

重载1

参数名称 参数类型 是否必填 描述
json_get_pendency_list_param FriendshipGetPendencyListParam 好友申请未决参数
callback ValueCallback< PendencyPage > 异步回调 返回值的json_param的格式为json

重载2

参数名称 参数类型 是否必填 描述
json_get_pendency_list_param FriendshipGetPendencyListParam 好友申请未决参数
callback ValueCallback< string > 异步回调 返回值的json_param的格式为string

返回模板

TIMResult

调用成功后回调函数参数:
code:int
desc:string
json_param:
'{
    "pendency_page_current_seq" : 2,
    "pendency_page_pendency_info_array" : [
        {
          "friend_add_pendency_info_add_source" : "AddSource_Type_Windows",
          "friend_add_pendency_info_add_time" : 1563026447,
          "friend_add_pendency_info_add_wording" : "I am Iron Man",
          "friend_add_pendency_info_idenitifer" : "user4",
          "friend_add_pendency_info_nick_name" : "change my nick name",
          "friend_add_pendency_info_type" : 1
        }
    ],
    "pendency_page_start_time" : 0,
    "pendency_page_unread_num" : 0
  }'// Json Key请参考[PendencyPage]
user_data:string

返回值详解

名称 数值类型 描述
TIMResult TIMResult 调用接口的返回值
code int 值为ERR_SUCC表示成功,其他值表示失败。详情请参考 错误码
desc string 错误描述字符串
json_param string Json字符串,不同的接口,Json字符串不一样 Json Key请参考PendencyPage
user_data string ImSDK负责透传的用户自定义数据,未做任何处理

代码示例

using UnityEngine;
using UnityEngine.UI;
using com.tencent.im.unity.demo.types;
using com.tencent.imsdk.unity;
using com.tencent.imsdk.unity.types;
using com.tencent.imsdk.unity.enums;
using System;
using com.tencent.im.unity.demo.utils;
using EasyUI.Toast;
using System.Collections;
using System.Collections.Generic;
public class FriendshipGetPendencyList : MonoBehaviour
{
  public Text Header;
  public Dropdown SelectedFriendPendencyType;
  public Text LastSeq;
  public Text Result;
  public Button Submit;
  public Button Copy;
  string[] Labels = new string[] { "SelectFriendPendencyTypeLabel" };
  void Start()
  {
    foreach (string label in Labels)
    {
      GameObject.Find(label).GetComponent<Text>().text = Utils.t(label);
    }
    Header = GameObject.Find("HeaderText").GetComponent<Text>();
    SelectedFriendPendencyType = GameObject.Find("Dropdown").GetComponent<Dropdown>();
    foreach (string name in Enum.GetNames(typeof(TIMFriendPendencyType)))
    {
      Dropdown.OptionData option = new Dropdown.OptionData();
      option.text = name;
      SelectedFriendPendencyType.options.Add(option);
    }
    LastSeq = GameObject.Find("LastSeq").GetComponent<Text>();
    LastSeq.text = "0";
    Result = GameObject.Find("ResultText").GetComponent<Text>();
    Submit = GameObject.Find("Submit").GetComponent<Button>();
    Copy = GameObject.Find("Copy").GetComponent<Button>();
    Copy.GetComponentInChildren<Text>().text = Utils.t("Copy");
    Submit.onClick.AddListener(FriendshipGetPendencyListSDK);
    Copy.onClick.AddListener(CopyText);
    if (CurrentSceneInfo.info != null)
    {
      Header.text = Utils.IsCn() ? CurrentSceneInfo.info.apiText + " " + CurrentSceneInfo.info.apiName : CurrentSceneInfo.info.apiName;
      Submit.GetComponentInChildren<Text>().text = CurrentSceneInfo.info.apiName;
    }
  }

  void FriendshipGetPendencyListSDK()
  {
    FriendshipGetPendencyListParam param = new FriendshipGetPendencyListParam
    {
      friendship_get_pendency_list_param_type = (TIMFriendPendencyType)SelectedFriendPendencyType.value,
      friendship_get_pendency_list_param_start_seq = Convert.ToUInt64(LastSeq.text),
      friendship_get_pendency_list_param_limited_size = 20
    };
    TIMResult res = TencentIMSDK.FriendshipGetPendencyList(param, Utils.addAsyncStringDataToScreen(GetResult));
    Result.text = Utils.SynchronizeResult(res);
  }

  void GetResult(params object[] parameters)
  {
    Result.text += (string)parameters[0];
    string text = (string)parameters[1];
    var res = Utils.FromJson<PendencyPage>(text);
    LastSeq.text = res.pendency_page_current_seq.ToString();
  }

  void CopyText()
  {
    Utils.Copy(Result.text);
  }
  void OnApplicationQuit()
  {
    TencentIMSDK.Uninit();
  }
}

results matching ""

    No results matching ""