v2.0.0
Latest
2021.3+

Interface ILeaderboardsService

Namespace: Unity.Services.Leaderboards
Syntax
public interface ILeaderboardsService

Methods

AddPlayerScoreAsync(String, Double, AddPlayerScoreOptions)

Adds or updates an entry for the current player in the specified leaderboard.

Declaration
Task<LeaderboardEntry> AddPlayerScoreAsync(string leaderboardId, double score, AddPlayerScoreOptions options = null)
Parameters
TypeNameDescription
StringleaderboardId

ID string of the leaderboard

Doublescore

Score value to be submitted

AddPlayerScoreOptionsoptions

Options object with "Metadata", an object containing metadata to be stored alongside the score (defaults to null).

Returns
TypeDescription
Task<LeaderboardEntry>

Task for a Response object containing status code, headers, and Models.LeaderboardEntry object containing the added or updated entry.

Exceptions
TypeCondition
LeaderboardsException

An exception containing a Message, Reason, and ErrorCode that can be used to determine the source of the error.

LeaderboardsValidationException

An exception containing a Message, Reason, ErrorCode, and Details that can be used to determine the source of the error.

GetPlayerRangeAsync(String, GetPlayerRangeOptions)

Gets the entries of the current player as well as the specified number of neighboring players ranked either side of the player.

Declaration
Task<LeaderboardScores> GetPlayerRangeAsync(string leaderboardId, GetPlayerRangeOptions options = null)
Parameters
TypeNameDescription
StringleaderboardId

ID string of the leaderboard

GetPlayerRangeOptionsoptions

Options object with "RangeLimit", the number of entries either side of the player to retrieve (defaults to 5), and IncludeMetadata, whether to retrieve stored metadata (defaults to false).

Returns
TypeDescription
Task<LeaderboardScores>

Task for a Response object containing status code, headers, and Models.LeaderboardScores object containing the list of retrieved entries.

Exceptions
TypeCondition
LeaderboardsException

An exception containing a Message, Reason, and ErrorCode that can be used to determine the source of the error.

LeaderboardsValidationException

An exception containing a Message, Reason, ErrorCode, and Details that can be used to determine the source of the error.

GetPlayerScoreAsync(String, GetPlayerScoreOptions)

Gets the entry for the current player in the specified leaderboard.

Declaration
Task<LeaderboardEntry> GetPlayerScoreAsync(string leaderboardId, GetPlayerScoreOptions options = null)
Parameters
TypeNameDescription
StringleaderboardId

ID string of the leaderboard

GetPlayerScoreOptionsoptions

Options object with "IncludeMetadata", whether to retrieve stored metadata (defaults to false).

Returns
TypeDescription
Task<LeaderboardEntry>

Task for a Response object containing status code, headers, and Models.LeaderboardEntry object containing the retrieved entry.

Exceptions
TypeCondition
LeaderboardsException

An exception containing a Message, Reason, and ErrorCode that can be used to determine the source of the error.

LeaderboardsValidationException

An exception containing a Message, Reason, ErrorCode, and Details that can be used to determine the source of the error.

GetScoresAsync(String, GetScoresOptions)

Gets a paginated list of entries for the specified leaderboard.

Declaration
Task<LeaderboardScoresPage> GetScoresAsync(string leaderboardId, GetScoresOptions options = null)
Parameters
TypeNameDescription
StringleaderboardId

ID string of the leaderboard

GetScoresOptionsoptions

Options object with "Offset" and "Limit" pagination options, and "IncludeMetadata" options. "Offset" is the number of entries to skip when retrieving the leaderboard scores, defaults to 0. "Limit" is the number of leaderboard scores to return, defaults to 10. "IncludeMetadata" is whether to return stored metadata, defaults to false.

Returns
TypeDescription
Task<LeaderboardScoresPage>

Task for a Response object containing status code, headers, and Models.LeaderboardScoresPage object containing the paginated list of retrieved entries.

Exceptions
TypeCondition
LeaderboardsException

An exception containing a Message, Reason, and ErrorCode that can be used to determine the source of the error.

LeaderboardsValidationException

An exception containing a Message, Reason, ErrorCode, and Details that can be used to determine the source of the error.

GetScoresByPlayerIdsAsync(String, List<String>, GetScoresByPlayerIdsOptions)

Gets a list of entries from the specified leaderboard for the specified player IDs.

Declaration
Task<LeaderboardScoresWithNotFoundPlayerIds> GetScoresByPlayerIdsAsync(string leaderboardId, List<string> playerIds, GetScoresByPlayerIdsOptions options = null)
Parameters
TypeNameDescription
StringleaderboardId

ID string of the leaderboard

List<String>playerIds

List of player IDs to get entries for

GetScoresByPlayerIdsOptionsoptions

Options object with "IncludeMetadata", whether to retrieve stored metadata (defaults to false).

Returns
TypeDescription
Task<LeaderboardScoresWithNotFoundPlayerIds>

Task for a Response object containing status code, headers, and Models.LeaderboardScores object containing the list of retrieved entries.

Exceptions
TypeCondition
LeaderboardsException

An exception containing a Message, Reason, and ErrorCode that can be used to determine the source of the error.

LeaderboardsValidationException

An exception containing a Message, Reason, ErrorCode, and Details that can be used to determine the source of the error.

GetScoresByTierAsync(String, String, GetScoresByTierOptions)

Gets a paginated list of entries for the specified leaderboard within the specified tier.

Declaration
Task<LeaderboardTierScoresPage> GetScoresByTierAsync(string leaderboardId, string tierId, GetScoresByTierOptions options = null)
Parameters
TypeNameDescription
StringleaderboardId

ID string of the leaderboard

StringtierId

ID string of the tier

GetScoresByTierOptionsoptions

Options object with "Offset" and "Limit" pagination options, and "IncludeMetadata" options. "Offset" is the number of entries to skip when retrieving the leaderboard scores, defaults to 0. "Limit" is the number of leaderboard scores to return, defaults to 10. "IncludeMetadata" is whether to return stored metadata, defaults to false.

Returns
TypeDescription
Task<LeaderboardTierScoresPage>

Task for a Response object containing status code, headers, and Models.LeaderboardTierScoresPage object containing the paginated list of retrieved entries.

Exceptions
TypeCondition
LeaderboardsException

An exception containing a Message, Reason, and ErrorCode that can be used to determine the source of the error.

LeaderboardsValidationException

An exception containing a Message, Reason, ErrorCode, and Details that can be used to determine the source of the error.

GetVersionPlayerRangeAsync(String, String, GetVersionPlayerRangeOptions)

Gets the entries of the current player as well as the specified number of neighboring players ranked either side of the player in the specified leaderboard archive version.

Declaration
Task<LeaderboardVersionScores> GetVersionPlayerRangeAsync(string leaderboardId, string versionId, GetVersionPlayerRangeOptions options = null)
Parameters
TypeNameDescription
StringleaderboardId

ID string of the leaderboard

StringversionId

ID string of the leaderboard archive version

GetVersionPlayerRangeOptionsoptions

Options object with "RangeLimit", the number of entries either side of the player to retrieve (defaults to 5), and IncludeMetadata, whether to retrieve stored metadata (defaults to false).

Returns
TypeDescription
Task<LeaderboardVersionScores>

Task for a Response object containing status code, headers, and Models.LeaderboardVersionScores object containing the list of retrieved entries.

Exceptions
TypeCondition
LeaderboardsException

An exception containing a Message, Reason, and ErrorCode that can be used to determine the source of the error.

LeaderboardsValidationException

An exception containing a Message, Reason, ErrorCode, and Details that can be used to determine the source of the error.

GetVersionPlayerScoreAsync(String, String, GetVersionPlayerScoreOptions)

Gets the entry for the current player in the specified leaderboard archive version.

Declaration
Task<LeaderboardVersionEntry> GetVersionPlayerScoreAsync(string leaderboardId, string versionId, GetVersionPlayerScoreOptions options = null)
Parameters
TypeNameDescription
StringleaderboardId

ID string of the leaderboard

StringversionId

ID string of the leaderboard archive version

GetVersionPlayerScoreOptionsoptions

Options object with "IncludeMetadata", whether to retrieve stored metadata (defaults to false).

Returns
TypeDescription
Task<LeaderboardVersionEntry>

Task for a Response object containing status code, headers, and Models.LeaderboardVersionEntry object containing the retrieved entry.

Exceptions
TypeCondition
LeaderboardsException

An exception containing a Message, Reason, and ErrorCode that can be used to determine the source of the error.

LeaderboardsValidationException

An exception containing a Message, Reason, ErrorCode, and Details that can be used to determine the source of the error.

GetVersionsAsync(String, GetVersionsOptions)

Gets the list of archived leaderboard versions for the specified leaderboard.

Declaration
Task<LeaderboardVersions> GetVersionsAsync(string leaderboardId, GetVersionsOptions options = null)
Parameters
TypeNameDescription
StringleaderboardId

ID string of the leaderboard

GetVersionsOptionsoptions

Options object with "Limit", the number of entries to return (starting with the most recent). Defaults to all entries

Returns
TypeDescription
Task<LeaderboardVersions>

Task for a Response object containing status code, headers, and Models.LeaderboardVersions object containing the list of retrieved versions.

Exceptions
TypeCondition
LeaderboardsException

An exception containing a Message, Reason, and ErrorCode that can be used to determine the source of the error.

LeaderboardsValidationException

An exception containing a Message, Reason, ErrorCode, and Details that can be used to determine the source of the error.

GetVersionScoresAsync(String, String, GetVersionScoresOptions)

Gets a paginated list of entries for the specified leaderboard archive version.

Declaration
Task<LeaderboardVersionScoresPage> GetVersionScoresAsync(string leaderboardId, string versionId, GetVersionScoresOptions options = null)
Parameters
TypeNameDescription
StringleaderboardId

ID string of the leaderboard

StringversionId

ID string of the leaderboard archive version

GetVersionScoresOptionsoptions

Options object with "Offset" and "Limit" pagination options, and "IncludeMetadata" options. "Offset" is the number of entries to skip when retrieving the leaderboard scores, defaults to 0. "Limit" is the number of leaderboard scores to return, defaults to 10. "IncludeMetadata" is whether to return stored metadata, defaults to false.

Returns
TypeDescription
Task<LeaderboardVersionScoresPage>

Task for a Response object containing status code, headers, and Models.LeaderboardVersionScoresPage object containing the paginated list of retrieved entries.

Exceptions
TypeCondition
LeaderboardsException

An exception containing a Message, Reason, and ErrorCode that can be used to determine the source of the error.

LeaderboardsValidationException

An exception containing a Message, Reason, ErrorCode, and Details that can be used to determine the source of the error.

GetVersionScoresByPlayerIdsAsync(String, String, List<String>, GetVersionScoresByPlayerIdsOptions)

Gets a list of entries for the specified players by player ID from the specified leaderboard archive version.

Declaration
Task<LeaderboardVersionScoresWithNotFoundPlayerIds> GetVersionScoresByPlayerIdsAsync(string leaderboardId, string versionId, List<string> playerIds, GetVersionScoresByPlayerIdsOptions options = null)
Parameters
TypeNameDescription
StringleaderboardId

ID string of the leaderboard

StringversionId

ID string of the leaderboard archive version

List<String>playerIds

List of player IDs to get scores for

GetVersionScoresByPlayerIdsOptionsoptions

Options object with "IncludeMetadata", whether to retrieve stored metadata (defaults to false).

Returns
TypeDescription
Task<LeaderboardVersionScoresWithNotFoundPlayerIds>

Task for a Response object containing status code, headers, and Models.LeaderboardVersionScoresByPlayerIds object containing the list of retrieved entries.

Exceptions
TypeCondition
LeaderboardsException

An exception containing a Message, Reason, and ErrorCode that can be used to determine the source of the error.

LeaderboardsValidationException

An exception containing a Message, Reason, ErrorCode, and Details that can be used to determine the source of the error.

GetVersionScoresByTierAsync(String, String, String, GetVersionScoresByTierOptions)

Gets a paginated list of entries from the specified leaderboard archive version and within the specified tier.

Declaration
Task<LeaderboardVersionTierScoresPage> GetVersionScoresByTierAsync(string leaderboardId, string versionId, string tierId, GetVersionScoresByTierOptions options = null)
Parameters
TypeNameDescription
StringleaderboardId

ID string of the leaderboard

StringversionId

ID string of the leaderboard archive version

StringtierId

ID string of the tier

GetVersionScoresByTierOptionsoptions

Options object with "Offset" and "Limit" pagination options, and "IncludeMetadata" options. "Offset" is the number of entries to skip when retrieving the leaderboard scores, defaults to 0. "Limit" is the number of leaderboard scores to return, defaults to 10. "IncludeMetadata" is whether to return stored metadata, defaults to false.

Returns
TypeDescription
Task<LeaderboardVersionTierScoresPage>

Task for a Response object containing status code, headers, and Models.LeaderboardVersionTierScoresPage object containing the paginated list of retrieved entries.

Exceptions
TypeCondition
LeaderboardsException

An exception containing a Message, Reason, and ErrorCode that can be used to determine the source of the error.

LeaderboardsValidationException

An exception containing a Message, Reason, ErrorCode, and Details that can be used to determine the source of the error.