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
Type | Name | Description |
---|---|---|
String | leaderboardId | ID string of the leaderboard |
Double | score | Score value to be submitted |
AddPlayerScoreOptions | options | Options object with "Metadata", an object containing metadata to be stored alongside the score (defaults to null). |
Returns
Type | Description |
---|---|
Task<LeaderboardEntry> | Task for a Response object containing status code, headers, and Models.LeaderboardEntry object containing the added or updated entry. |
Exceptions
Type | Condition |
---|---|
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
Type | Name | Description |
---|---|---|
String | leaderboardId | ID string of the leaderboard |
GetPlayerRangeOptions | options | 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
Type | Description |
---|---|
Task<LeaderboardScores> | Task for a Response object containing status code, headers, and Models.LeaderboardScores object containing the list of retrieved entries. |
Exceptions
Type | Condition |
---|---|
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
Type | Name | Description |
---|---|---|
String | leaderboardId | ID string of the leaderboard |
GetPlayerScoreOptions | options | Options object with "IncludeMetadata", whether to retrieve stored metadata (defaults to false). |
Returns
Type | Description |
---|---|
Task<LeaderboardEntry> | Task for a Response object containing status code, headers, and Models.LeaderboardEntry object containing the retrieved entry. |
Exceptions
Type | Condition |
---|---|
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
Type | Name | Description |
---|---|---|
String | leaderboardId | ID string of the leaderboard |
GetScoresOptions | options | 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
Type | Description |
---|---|
Task<LeaderboardScoresPage> | Task for a Response object containing status code, headers, and Models.LeaderboardScoresPage object containing the paginated list of retrieved entries. |
Exceptions
Type | Condition |
---|---|
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
Type | Name | Description |
---|---|---|
String | leaderboardId | ID string of the leaderboard |
List<String> | playerIds | List of player IDs to get entries for |
GetScoresByPlayerIdsOptions | options | Options object with "IncludeMetadata", whether to retrieve stored metadata (defaults to false). |
Returns
Type | Description |
---|---|
Task<LeaderboardScoresWithNotFoundPlayerIds> | Task for a Response object containing status code, headers, and Models.LeaderboardScores object containing the list of retrieved entries. |
Exceptions
Type | Condition |
---|---|
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
Type | Name | Description |
---|---|---|
String | leaderboardId | ID string of the leaderboard |
String | tierId | ID string of the tier |
GetScoresByTierOptions | options | 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
Type | Description |
---|---|
Task<LeaderboardTierScoresPage> | Task for a Response object containing status code, headers, and Models.LeaderboardTierScoresPage object containing the paginated list of retrieved entries. |
Exceptions
Type | Condition |
---|---|
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
Type | Name | Description |
---|---|---|
String | leaderboardId | ID string of the leaderboard |
String | versionId | ID string of the leaderboard archive version |
GetVersionPlayerRangeOptions | options | 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
Type | Description |
---|---|
Task<LeaderboardVersionScores> | Task for a Response object containing status code, headers, and Models.LeaderboardVersionScores object containing the list of retrieved entries. |
Exceptions
Type | Condition |
---|---|
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
Type | Name | Description |
---|---|---|
String | leaderboardId | ID string of the leaderboard |
String | versionId | ID string of the leaderboard archive version |
GetVersionPlayerScoreOptions | options | Options object with "IncludeMetadata", whether to retrieve stored metadata (defaults to false). |
Returns
Type | Description |
---|---|
Task<LeaderboardVersionEntry> | Task for a Response object containing status code, headers, and Models.LeaderboardVersionEntry object containing the retrieved entry. |
Exceptions
Type | Condition |
---|---|
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
Type | Name | Description |
---|---|---|
String | leaderboardId | ID string of the leaderboard |
GetVersionsOptions | options | Options object with "Limit", the number of entries to return (starting with the most recent). Defaults to all entries |
Returns
Type | Description |
---|---|
Task<LeaderboardVersions> | Task for a Response object containing status code, headers, and Models.LeaderboardVersions object containing the list of retrieved versions. |
Exceptions
Type | Condition |
---|---|
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
Type | Name | Description |
---|---|---|
String | leaderboardId | ID string of the leaderboard |
String | versionId | ID string of the leaderboard archive version |
GetVersionScoresOptions | options | 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
Type | Description |
---|---|
Task<LeaderboardVersionScoresPage> | Task for a Response object containing status code, headers, and Models.LeaderboardVersionScoresPage object containing the paginated list of retrieved entries. |
Exceptions
Type | Condition |
---|---|
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
Type | Name | Description |
---|---|---|
String | leaderboardId | ID string of the leaderboard |
String | versionId | ID string of the leaderboard archive version |
List<String> | playerIds | List of player IDs to get scores for |
GetVersionScoresByPlayerIdsOptions | options | Options object with "IncludeMetadata", whether to retrieve stored metadata (defaults to false). |
Returns
Type | Description |
---|---|
Task<LeaderboardVersionScoresWithNotFoundPlayerIds> | Task for a Response object containing status code, headers, and Models.LeaderboardVersionScoresByPlayerIds object containing the list of retrieved entries. |
Exceptions
Type | Condition |
---|---|
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
Type | Name | Description |
---|---|---|
String | leaderboardId | ID string of the leaderboard |
String | versionId | ID string of the leaderboard archive version |
String | tierId | ID string of the tier |
GetVersionScoresByTierOptions | options | 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
Type | Description |
---|---|
Task<LeaderboardVersionTierScoresPage> | Task for a Response object containing status code, headers, and Models.LeaderboardVersionTierScoresPage object containing the paginated list of retrieved entries. |
Exceptions
Type | Condition |
---|---|
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. |