widgrensitasobi-defold
widgrensit/asobi-defold/asobi.api.leaderboards
asobi leaderboards over REST. A project reaches it as client.leaderboards.
- GitHub: widgrensit/asobi-defold — pinned to
v1.18.1- Pick a release from widgrensit/asobi-defold releases and add its Source code (zip) URL (or a packaged
.zipasset, if the library ships one) togame.projectunder[project]dependencies, then Fetch Libraries in the Defold editor. - Run
bunx @defold-typescript/cli resolveto materialize its types. - Import it under a namespace alias of your choice:
import * as api_leaderboards from "asobi.api.leaderboards"
- Pick a release from widgrensit/asobi-defold releases and add its Source code (zip) URL (or a packaged
Functions
get_top(client: Client, leaderboard_id: string, limit?: number, callback?: HttpCallback)get_around_player(client: Client, leaderboard_id: string, player_id: string, range_size?: number, callback?: HttpCallback)get_around_self(client: Client, leaderboard_id: string, range_size?: number, callback?: HttpCallback)submit_score(client: Client, leaderboard_id: string, score: number, sub_score?: number, callback?: HttpCallback)
get_top(client: Client, leaderboard_id: string, limit?: number, callback?: HttpCallback)
Fetches a leaderboard's top entries.
Parameters
client:Client— The client.leaderboard_id:string— The leaderboard's id.limit?:number— The most entries to return. Defaults to100.callback?:HttpCallback— Receives the entries, or the error.
get_around_player(client: Client, leaderboard_id: string, player_id: string, range_size?: number, callback?: HttpCallback)
Fetches the entries around a player's rank.
Parameters
client:Client— The client.leaderboard_id:string— The leaderboard's id.player_id:string— The player's id.range_size?:number— How many entries on each side. Defaults to5.callback?:HttpCallback— Receives the entries, or the error.
get_around_self(client: Client, leaderboard_id: string, range_size?: number, callback?: HttpCallback)
Fetches the entries around the signed-in player's rank. The client must be signed in:
it raises an error while client.player_id is unset.
Parameters
client:Client— The client.leaderboard_id:string— The leaderboard's id.range_size?:number— How many entries on each side. Defaults to5.callback?:HttpCallback— Receives the entries, or the error.
submit_score(client: Client, leaderboard_id: string, score: number, sub_score?: number, callback?: HttpCallback)
Submits the signed-in player's score.
Parameters
client:Client— The client.leaderboard_id:string— The leaderboard's id.score:number— The score.sub_score?:number— The tie-breaking score. Defaults to0.callback?:HttpCallback— Receives the entry, or the error.