ILeaderboardService interface


Provides methods for managing scores and reading leaderboards rankings.

public interface ILeaderboardService

Methods

List leaderboards

List all leaderboards and get details for each of them.
To get generated custom data for leaderboards, specify generic TProperty type to deserialize custom data.

IEnumerable<Leaderboard> GetLeaderboards();
IEnumerable<Leaderboard<TProperty>> GetLeaderboards<TProperty>();

Get leaderboard

Get specific leaderboard by providing leaderboard shortCode.

Leaderboard GetLeaderboard(string shortCode);
Leaderboard<TProperty> GetLeaderboard<TProperty>(string shortCode);

Search leaderboards

Search through leaderboards with query restriction and generic custom properties.

IEnumerable<Leaderboard> Search(IRestriction<Leaderboard> restriction);
IEnumerable<Leaderboard<TProperty>> Search(IRestriction<Leaderboard<TProperty>> restriction);

Example:

var queryRestriction = new QueryBuilder<Leaderboard>()
        .GreaterThan(leaderboard => leaderboard.Data.Prop2, 5);
        .OrderByDescending(leaderboard => leaderboard.Name)
        .ApplyPaging(0, 10);

var leaderboards = await leaderboardService.Search(query);

Submit score

Insert or update existing score for user for specific Leaderboard. Score is referring to current version of specified leaderboard.
If user already has score, scores will be updated following leaderboard mode rules.
Check ScoreEntry

Score SubmitScore(ScoreEntry score);
Score<TProperty> SubmitScore<TProperty>(ScoreEntry<TProperty> score);

Get high scores

Returns scores ordered by leaderboard ranking type. For getting scores of older version of leaderboard, use leaderboardVersion. By default, it will be referred to the current version of leaderboard.

IEnumerable<Score> GetHighScores(string leaderboardShortCode, int page, int perPage);
IEnumerable<Score> GetHighScores(string leaderboardShortCode, int leaderboardVersion, int page, int perPage);
IEnumerable<Score<TProperty>> GetHighScores<TProperty>(string leaderboardShortCode, int page, int perPage);
IEnumerable<Score<TProperty>> GetHighScores<TProperty>(string leaderboardShortCode, int leaderboardVersion, int page, int perPage);

Get my score

Returns score for currently authenticated user.

Score GetMyScore(string leaderboardShortCode);
Score GetMyScore(string leaderboardShortCode, int leaderboardVersion);
Score<TProperty> GetMyScore<TProperty>(string leaderboardShortCode);
Score<TProperty> GetMyScore<TProperty>(string leaderboardShortCode, int leaderboardVersion);

Get score for specific user

Returns score for user with specific id.

Score GetScoreForUser(string userId, string leaderboardShortCode);
Score GetScoreForUser(string userId, string leaderboardShortCode, int leaderboardVersion);
Score<TProperty> GetScoreForUser<TProperty>(string userId, string leaderboardShortCode);
Score<TProperty> GetScoreForUser<TProperty>(string userId, string leaderboardShortCode, int leaderboardVersion);

Get scores surrounding

Returns ordered scores surrounding currently authenticated user.
Range is representing number of scores in front of and behind the current user.

IEnumerable<Score> GetScoresSurroundingMe(int range, string leaderboardShortCode);
IEnumerable<Score> GetScoresSurroundingMe(int range, string leaderboardShortCode, int leaderboardVersion);
IEnumerable<Score<TProperty>> GetScoresSurroundingMe<TProperty>(int range, string leaderboardShortCode);
IEnumerable<Score<TProperty>> GetScoresSurroundingMe<TProperty>(int range, string leaderboardShortCode, int leaderboardVersion);

Get scores surrounding user

Return ordered scores surrounding specific user Range is representing number of scores in front of and behind the specific user.

IEnumerable<Score> GetScoresSurroundingUser(string userId, int range, string leaderboardShortCode);
IEnumerable<Score> GetScoresSurroundingUser(string userId, int range, string leaderboardShortCode, int leaderboardVersion);
IEnumerable<Score<TProperty>> GetScoresSurroundingUser<TProperty>(string userId, int range, string leaderboardShortCode);
IEnumerable<Score<TProperty>> GetScoresSurroundingUser<TProperty>(string userId, int range, string leaderboardShortCode, int leaderboardVersion);

Search through scores with query restriction

Use query builder to filter scores by defining a custom query filter.

IEnumerable<Score> Search(IRestriction<ScoreQuery> restriction, string leaderboardShortCode);
IEnumerable<Score> Search(IRestriction<ScoreQuery> restriction, string leaderboardShortCode, int leaderboardVersion);
IEnumerable<Score<TProperty>> Search<TProperty>(IRestriction<ScoreQuery<TProperty>> restriction, string leaderboardShortCode);
IEnumerable<Score<TProperty>> Search<TProperty>(IRestriction<ScoreQuery<TProperty>> restriction, string leaderboardShortCode);

results matching ""

    No results matching ""