Skip to main content
Version: 5.11.6

GetFriendList

public BackendReturnObject GetFriendList();
public BackendReturnObject GetFriendList(int limit);
public BackendReturnObject GetFriendList(int limit, int offset);

Parameters

ValueTypeDescriptiondefault
limitint(Optional) Number of friends lists to call100
offsetint(Optional) Starting point of friends lists to call0

Description

Looks up friends lists.

You can only make the maximum number of friends set in BACKND Console > Social Management > Settings. The default for the maximum number of friends is 0, which can be used after being set in the console.

Example

Synchronous

// Look up the entire friends list
Backend.Friend.GetFriendList();
// Look up the entire friends list using 'limit' and 'offset'
Backend.Friend.GetFriendList(5); // Look up five friends(1-5)
Backend.Friend.GetFriendList(5,5); // Look up the next five friends after the first five(6-10)

Asynchronous

Backend.Friend.GetFriendList((callback) => 
{
// Post-process
});
Backend.Friend.GetFriendList(5, (callback) =>
{
// Look up five friends(1-5)
// Post-process
});
Backend.Friend.GetFriendList(5, 5, (callback) =>
{
// Look up the next five friends after the first five(6-10)
// Post-process
});

SendQueue

SendQueue.Enqueue(Backend.Friend.GetFriendList, (callback) => 
{
// Post-process
});
SendQueue.Enqueue(Backend.Friend.GetFriendList, 5, (callback) =>
{
// Look up five friends(1-5)
// Post-process
});
SendQueue.Enqueue(Backend.Friend.GetFriendList, 5, 5, (callback) =>
{
// Look up the next five friends after the first five(6-10)
// Post-process
});

Return cases

Success cases

When the lookup is successful
statusCode : 200

returnValue : refer to GetReturnValuetoJSON

When friends do not exist
statusCode : 200

returnValue : {"rows":[]}

GetReturnValuetoJSON

{ 
rows:
[
// When the user does not have a nickname
{
"inDate": // Game user's inDate
{ "S" : "2018-12-27T04:49:00.493Z"},
"createdAt": // Time you became friends with the user
{ "S" : "2018-12-27T04:49:58.140Z"}
"lastLogin": // Last access date
{"S":"2021-07-23T09:13:14.186Z"}
},
// When the user has a nickname
{
"nickname": // Game user's nickname
{ "S" : "customid2"},
"inDate": // Game user's inDate
{ "S" : "2018-12-18T01:58:18.722Z"},
"createdAt": // Time you became friends with the user
{ "S" : "2018-12-27T04:50:03.955Z"}
"lastLogin": // Last access date
{"S":"2021-07-23T09:13:14.186Z"}
},
{
nickname: [Object],
inDate: [Object]
}
]
}

Sample code

public class FriendItem
{
public string nickname;
public string inDate;
public string lastLogin;
public string createdAt;
public override string ToString()
{
return $"nickname : {nickname}\ninDate : {inDate}\nlastLogin : {lastLogin}\ncreatedAt : {createdAt}\n";
}
};
public void GetFriendListTest()
{
var bro = Backend.Friend.GetFriendList();

if(!bro.IsSuccess())
return;

LitJson.JsonData json = bro.FlattenRows();
List<FriendItem> freindList = new List<FriendItem>();

for(int i = 0; i < json.Count; i++)
{
FriendItem friendItem = new FriendItem();

if(json[i].ContainsKey("nickname"))
{
friendItem.nickname = json[i]["nickname"].ToString();
}
friendItem.inDate = json[i]["inDate"].ToString();
friendItem.lastLogin = json[i]["lastLogin"].ToString();
friendItem.createdAt = json[i]["createdAt"].ToString();

freindList.Add(friendItem);
Debug.Log(friendItem.ToString());
}
}