getUsersInfo
Introduction
Get the info or profile of users.
Specified the self User to load the data of self.
This method supports batch requests, but have better no more than 100, to avoid the rejection of the IM server, as the request package exceed 1M.
Also you can query the users, regardless if friends, with this method.
What should I do if the user profile obtained is not the latest?
There are two types of user profile updates in the enhanced SDK:
Friend's profile: When the profile of a friend is updated, the backend will send a system notification to the SDK, so the profile will be updated in real time.
Non-friend user's profile: When the profile of a non-friend user is updated, the backend cannot send a system notification to the SDK; therefore, the profile cannot be updated in real time. To avoid sending a network request to the backend every time the user profile is obtained, the SDK adds the caching logic and allows a user to pull the profile from the backend every ten minutes.
Parameter details
Parameter name | Parameter type | Required | Platform | Description |
---|---|---|---|---|
userIDList | List< String > | yes | All | The list of users to query. |
Returned template
V2TimValueCallback<List<V2TimUserFullInfo>>
{
code : int
desc : String
data : List<V2TimUserFullInfo>//The list of results.
}
Return value details
name | type | description |
---|---|---|
code | int | Request result: Error codes. 0 means success. |
desc | String | The description of the error. It will be empty if success. |
data | List< V2TimUserFullInfo > | The list of results. |
Code example
V2TimValueCallback<List<V2TimUserFullInfo>> getUsersInfoRes =
await TencentImSDKPlugin.v2TIMManager.getUsersInfo(userIDList: []);
if (getUsersInfoRes.code == 0) {
getUsersInfoRes.data?.forEach((element) {
element.allowType;
element.birthday;
element.customInfo;
element.faceUrl;
element.gender;
element.level;
element.nickName;
element.role;
element.selfSignature;
element.userID;
});
}