Class AirshipLeaderboardService

This service provides access to leaderboard information as well as methods for updating existing leaderboards. Leaderboards must be created using the https://create.airship.gg website. Once a leaderboard is created, it can be accessed using the name provided during setup.

Methods

  • Gets the rank of a given id.

    Parameters

    • leaderboardName: string

      The name of the leaderboard

    • id: string

      The id

    Returns Promise<Result<undefined | RankData, undefined>>

  • Gets a section of the leaderboard. This function is helpful for displaying leaderboards in your game. By default, this function returns the top 100 entries.

    This function returns a subsection of the top 1000 entries. Rankings are tracked for users below the top 1000, but they can only be accessed using the GetRank function.

    Parameters

    • leaderboardName: string

      The leaderboard name

    • startIndex: number = 0

      The start index of the selection. Defaults to 0, which is the top of the leaderboard.

    • count: number = 100

      The number of entries to retrieve. Defaults to 100.

    Returns Promise<Result<RankData[], undefined>>

  • Sends an update to the provided leaderboard. The scores provided are added to, subtracted from, or replace the existing scores based on the leaderboard configuration.

    Parameters

    • leaderboardName: string

      The name of the leaderboard that should be updated with the given scores

    • update: LeaderboardUpdate

      An object containing a map of ids and scores.

    Returns Promise<Result<undefined, undefined>>