Skip to main content
Version: 5.17.0

GetLeaderboard

public BackendGuildLeaderboardReturnObject GetLeaderboard(string leaderboardUuid);\ public BackendGuildLeaderboardReturnObject GetLeaderboard(string leaderboardUuid, int limit);\ public BackendGuildLeaderboardReturnObject GetLeaderboard(string leaderboardUuid, int limit, int offset);

Parameters

ValueTypeDescriptionDefault
leaderboardUuidstringuuid of the ranking to look up-
limitintNumber of rank holders to look up (1 - 50)10
offsetintStarting point of the ranking to look up (0 or more)0

The leaderboardUuid value can be checked using the following methods:

Description

Looks up the list of top-ranking players in the same group as the user using the user's uuid.\ You can use limit and offset to look up rankings from a specific position.\ This allows you to look up 50 players at a time, from rank 1 to the last-ranked player.

  • For users who are not in the group, looks up the leaderboard for the NULL group.

In the case of joint ranks, gamer_ids(member numbers) are sorted lexicographically according to the set rank-sorting criteria (ascending/descending order).

  • Users without nicknames will be marked as "".
  • If a number smaller than 0 is entered for the limit, it will be adjusted to 0.
  • If a number smaller than 0 is entered for the offset, it will be adjusted to 0.
  • This method cannot be called using SendQueue.

BackendGuildLeaderboardReturnObject

namespace BackEnd.Leaderboard
{
public class GuildLeaderboardItem
{
public string guildInDate;
public string guildName;
public string score;
public string index;
public string rank;
}

public class BackendGuildLeaderboardReturnObject : BackendReturnObject
{
public long GetTotalCount();
public List<GuildLeaderboardItem> GetGuildLeaderboardList();
}
}

Example

Synchronous

// example 1. xample 1. Look up rankings from 1st place to 150th place.
// Look up the 1st - 50th rank holders in the leaderboardUuid ranking.
bro = Backend.Leaderboard.Guild.GetLeaderboard("leaderboardUuid", 50);
// Look up the 51st - 100th rank holders in the leaderboardUuid ranking.
bro = Backend.Leaderboard.Guild.GetLeaderboard("leaderboardUuid", 50, 50);
// Look up the 101st - 150th rank holders in the leaderboardUuid ranking.
bro = Backend.Leaderboard.Guild.GetLeaderboard("leaderboardUuid", 50, 100);

// example 2. Look up certain ranks and default value
// Look up the 11th - 30th rank holders in the leaderboardUuid ranking
bro = Backend.Leaderboard.Guild.GetLeaderboard("leaderboardUuid", 20, 10);
// Look up the 1st - 10th rank holders in the leaderboardUuid ranking
bro = Backend.Leaderboard.Guild.GetLeaderboard("leaderboardUuid");

// After looking up the ranks.
if (bro.IsSuccess() == false)
{
return;
}

Debug.Log("Total number of users registered to the leaderboard : " + bro.GetTotalCount());

foreach (BackEnd.Leaderboard.GuildLeaderboardItem item in bro.GetGuildLeaderboardList())
{
Debug.Log($”{item.rank}rank : {item.guildName}");
Debug.Log(item.ToString());
}

Asynchronous

// example 1. Look up rankings from 1st place to 150th place.
// Look up the 1st - 50th rank holders in the leaderboardUuid ranking.
Backend.Leaderboard.Guild.GetLeaderboard("leaderboardUuid", 50, callback=> {
if(callback.IsSuccess() == false) {
return;
}

Debug.Log("Total number of users registered to the leaderboard : " + bro.GetTotalCount());

foreach (BackEnd.Leaderboard.GuildLeaderboardItem item in bro.GetGuildLeaderboardList())
{
Debug.Log($”{item.rank}rank : {item.guildName}");
Debug.Log(item.ToString());
}
});
// Look up the 51st - 100th rank holders in the leaderboardUuid ranking.
Backend.Leaderboard.Guild.GetLeaderboard("leaderboardUuid", 50, 50 callback=> {
// Post-process
});
// Look up the 101st - 150th rank holders in the leaderboardUuid ranking.
Backend.Leaderboard.Guild.GetLeaderboard("leaderboardUuid", 50, 100 callback=> {
// Post-process
});

// example 2. Look up certain ranks and default value
// Look up the 11st - 30th rank holders in the leaderboardUuid ranking.
Backend.Leaderboard.Guild.GetLeaderboard("leaderboardUuid", 20, 10, callback=> {
// Post-process
});
// Look up the 1st - 10th rank holders in the leaderboardUuid ranking.
Backend.Leaderboard.Guild.GetLeaderboard("leaderboardUuid", callback=> {
// Post-process
});

ReturnCase

Success cases

When the lookup is successful\ statusCode : 200\ message : Success\ returnValue : refer to GetReturnValuetoJSON

When the lookup is successful but the rank holder is not in the lookup range\ statusCode : 200\ message : Success\ returnValue : {"rows":[]}

Error cases

When leaderboardUuid is null or string.Empty\ statusCode : 400\ errorCode : ValidationException\ message : leaderboardUuid is null or empty

When the uuid does not exist\ StatusCode : 404\ ErrorCode : NotFoundException\ Message : leaderboard not found, leaderboard cannot be found

GetReturnValuetoJSON

{
"rows": [
{
"guildName": "guild1",
"guildInDate": "2024-05-08T07:17:22.915Z",
"rank": 1,
"index": 0,
"score": "36"
},
{
"guildName": "guild2",
"guildInDate": "2024-05-08T07:17:22.408Z",
"rank": 2,
"index": 1,
"score": "32"
}
],
"totalCount": 18
}