Skip to main content
Version: 6.0.0

GetFriendList

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

BackndFriendRequestReturnObject

GetReturnValueByFriendRequestList

If an error occurred, null is returned.

BackndFriendRequestReturnObject bro = Backnd.Friend.GetFriendList();

foreach(BackndFriendRequestItem item in bro.GetReturnValueByFriendList()) {
Debug.Log(item.ToString());
}

BackndFriendItem

public class BackndFriendItem
{
public string nickname;
public string inDate;
public string lastLogin;
public string createdAt;
}

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 > Player. 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
Backnd.Friend.GetFriendList();
// Look up the entire friends list using 'limit' and 'offset'
Backnd.Friend.GetFriendList(5); // Look up five friends(1-5)
Backnd.Friend.GetFriendList(5,5); // Look up the next five friends after the first five(6-10)

Asynchronous

Backnd.Friend.GetFriendList((callback) => 
{
// Post-process
});
Backnd.Friend.GetFriendList(5, (callback) =>
{
// Look up five friends(1-5)
// Post-process
});
Backnd.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 = Backnd.Friend.GetFriendList();

if(!bro.IsSuccess())
return;

BACKND.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());
}
}