Leaderboard

AV. Leaderboard

new Leaderboard()

Source:

Members

(nullable) createdAt :Date

Source:
Type:
  • Date

(nullable) nextResetAt :Date

Source:
Type:
  • Date

order :AV.LeaderboardOrder

Source:
Type:

statisticName :string

Source:
Type:
  • string

updateStrategy :AV.LeaderboardUpdateStrategy

Source:
Type:

version :number

Source:
Type:
  • number

versionChangeInterval :AV.LeaderboardVersionChangeInterval

Source:
Type:

Methods

(static) createLeaderboard(options, authOptionsopt) → {Promise.<AV.Leaderboard>}

Source:
(masterKey required) Create a new Leaderboard.
Parameters:
Name Type Attributes Description
options Object
Properties
Name Type Attributes Description
statisticName string
order AV.LeaderboardOrder
versionChangeInterval AV.LeaderboardVersionChangeInterval <optional>
default to WEEK
updateStrategy AV.LeaderboardUpdateStrategy <optional>
default to BETTER
authOptions AuthOptions <optional>
Returns:
Type
Promise.<AV.Leaderboard>

(static) createWithoutData(statisticName) → {AV.Leaderboard}

Source:
Create an instance of Leaderboard for the give statistic name.
Parameters:
Name Type Description
statisticName string
Returns:
Type
AV.Leaderboard

(static) deleteStatistics(user, statistics, optionsopt) → {Promise.<void>}

Source:
Delete Statistics for the specified user.
Parameters:
Name Type Attributes Description
user AV.User The specified AV.User pointer.
statistics Object A name-value pair representing the statistics to delete.
options AuthOptions <optional>
Returns:
Type
Promise.<void>

(static) getLeaderboard(statisticName, authOptionsopt) → {Promise.<AV.Leaderboard>}

Source:
Get the Leaderboard with the specified statistic name.
Parameters:
Name Type Attributes Description
statisticName string
authOptions AuthOptions <optional>
Returns:
Type
Promise.<AV.Leaderboard>

(static) getStatistics(user, optionsopt, authOptionsopt) → {Promise.<Array.<Statistic>>}

Source:
Get Statistics for the specified user.
Parameters:
Name Type Attributes Description
user AV.User The specified AV.User pointer.
options Object <optional>
Properties
Name Type Attributes Description
statisticNames Array.<string> <optional>
Specify the statisticNames. If not set, all statistics of the user will be fetched.
authOptions AuthOptions <optional>
Returns:
Type
Promise.<Array.<Statistic>>

(static) updateStatistics(user, statistics, optionsopt) → {Promise.<Array.<Statistic>>}

Source:
Update Statistics for the specified user.
Parameters:
Name Type Attributes Description
user AV.User The specified AV.User pointer.
statistics Object A name-value pair representing the statistics to update.
options AuthOptions <optional>
AuthOptions plus:
Properties
Name Type Attributes Description
overwrite boolean <optional>
Wethere to overwrite these statistics disregarding the updateStrategy of there leaderboards
Returns:
Type
Promise.<Array.<Statistic>>

count(optionsopt, authOptionsopt) → {Promise.<number>}

Source:
Counts the number of users participated in this leaderboard
Parameters:
Name Type Attributes Description
options Object <optional>
Properties
Name Type Attributes Description
version number <optional>
Specify the version of the leaderboard
authOptions AuthOptions <optional>
Returns:
Type
Promise.<number>

destroy(authOptionsopt) → {void}

Source:
(masterKey required) Delete the Leaderboard and its all archived versions.
Parameters:
Name Type Attributes Description
authOptions AuthOptions <optional>
Returns:
Type
void

fetch(authOptionsopt) → {Promise.<AV.Leaderboard>}

Source:
Fetch data from the srever.
Parameters:
Name Type Attributes Description
authOptions AuthOptions <optional>
Returns:
Type
Promise.<AV.Leaderboard>

getArchives(optionsopt, authOptionsopt) → {Promise.<Array.<LeaderboardArchive>>}

Source:
(masterKey required) Get archived versions.
Parameters:
Name Type Attributes Description
options Object <optional>
Properties
Name Type Attributes Description
skip number <optional>
The number of results to skip. This is useful for pagination.
limit number <optional>
The limit of the number of results.
authOptions AuthOptions <optional>
Returns:
Type
Promise.<Array.<LeaderboardArchive>>

getResults(optionsopt, authOptionsopt) → {Promise.<Array.<Ranking>>}

Source:
Retrieve a list of ranked users for this Leaderboard.
Parameters:
Name Type Attributes Description
options Object <optional>
Properties
Name Type Attributes Description
skip number <optional>
The number of results to skip. This is useful for pagination.
limit number <optional>
The limit of the number of results.
selectUserKeys Array.<string> <optional>
Specify keys of the users to include in the Rankings
includeUserKeys Array.<string> <optional>
If the value of a selected user keys is a Pointer, use this options to include its value.
includeStatistics Array.<string> <optional>
Specify other statistics to include in the Rankings
version number <optional>
Specify the version of the leaderboard
authOptions AuthOptions <optional>
Returns:
Type
Promise.<Array.<Ranking>>

getResultsAroundUser(user, optionsopt, authOptionsopt) → {Promise.<Array.<Ranking>>}

Source:
Retrieve a list of ranked users for this Leaderboard, centered on the specified user.
Parameters:
Name Type Attributes Description
user AV.User The specified AV.User pointer.
options Object <optional>
Properties
Name Type Attributes Description
limit number <optional>
The limit of the number of results.
selectUserKeys Array.<string> <optional>
Specify keys of the users to include in the Rankings
includeUserKeys Array.<string> <optional>
If the value of a selected user keys is a Pointer, use this options to include its value.
includeStatistics Array.<string> <optional>
Specify other statistics to include in the Rankings
version number <optional>
Specify the version of the leaderboard
authOptions AuthOptions <optional>
Returns:
Type
Promise.<Array.<Ranking>>

reset(authOptionsopt) → {Promise.<AV.Leaderboard>}

Source:
(masterKey required) Reset the Leaderboard. The version of the Leaderboard will be incremented by 1.
Parameters:
Name Type Attributes Description
authOptions AuthOptions <optional>
Returns:
Type
Promise.<AV.Leaderboard>

updateUpdateStrategy(updateStrategy, authOptionsopt) → {Promise.<AV.Leaderboard>}

Source:
(masterKey required) Update the version change interval of the Leaderboard.
Parameters:
Name Type Attributes Description
updateStrategy AV.LeaderboardUpdateStrategy
authOptions AuthOptions <optional>
Returns:
Type
Promise.<AV.Leaderboard>

updateVersionChangeInterval(versionChangeInterval, authOptionsopt) → {Promise.<AV.Leaderboard>}

Source:
(masterKey required) Update the version change interval of the Leaderboard.
Parameters:
Name Type Attributes Description
versionChangeInterval AV.LeaderboardVersionChangeInterval
authOptions AuthOptions <optional>
Returns:
Type
Promise.<AV.Leaderboard>