Skip to content

资料管理

设置资料

支持 标配资料字段自定义资料字段 的设置。

使用示例:

java
ProfileItem profileItem = ProfileItem.builder()
        .tag(TagProfile.IM_NICK)
        .value("MyNickName")
        .build();
List<ProfileItem> profiles = Collections.singletonList(profileItem);
PortraitSetRequest request = PortraitSetRequest.builder()
        .fromAccount("test1")
        .profileItemList(profiles)
        .build();

PortraitSetResult result = client.profile.portraitSet(request);

拉取资料

  • 支持拉取好友和非好友的资料字段。
  • 支持拉取 标配资料字段自定义资料字段
  • 建议每次拉取的用户数不超过 100,避免因回包数据量太大导致回包失败。
  • 请确保请求中的所有账号都已导入即时通信 IM,如果请求中含有未导入即时通信 IM 的账号,即时通信 IM 后台将会提示错误。

使用示例:

java
List<String> tagList = Collections.singletonList(TagProfile.IM_NICK);
List<String> toAccount = Collections.singletonList("test1");
PortraitGetRequest request = PortraitGetRequest.builder()
        .tagList(tagList)
        .toAccount(toAccount)
        .build();

PortraitGetResult result = client.profile.portraitGet(request);

Released under the Apache-2.0 license.