Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions docs/godot/leaderboards.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,24 @@ func _on_pressed() -> void:

### Getting entries for the current player

You can also get entries exclusively created by the current player using `Talo.leaderboards.get_entries_for_current_player()`. This automatically sets the `alias_id` option:
Since a player can have many aliases, you can use the `player_id` option to fetch entries across all of a player's aliases:

```gdscript
var options := Talo.leaderboards.GetEntriesOptions.new()
options.page = page
options.player_id = Talo.current_player.id

var res := await Talo.leaderboards.get_entries_for_current_player(internal_name, options)
var res := await Talo.leaderboards.get_entries(internal_name, options)
```

If you want to scope entries to a specific alias instead, use the `alias_id` option:

```gdscript
var options := Talo.leaderboards.GetEntriesOptions.new()
options.page = page
options.alias_id = Talo.current_alias.id

var res := await Talo.leaderboards.get_entries(internal_name, options)
```

### Getting archived entries
Expand All @@ -120,7 +131,7 @@ var res := await Talo.leaderboards.get_entries(internal_name, options)

After fetching your leaderboard entries you can take advantage of the internal cache to construct your UI, removing the need for any subsequent network requests.

You can use `Talo.leaderboards.get_cached_entries()` in the same way as `get_entries()` above. Every entry fetched previously using `get_entries()` will exist in the cache. The same logic applies for `get_entries_for_current_player()` with `get_cached_entries_for_current_player()`.
You can use `Talo.leaderboards.get_cached_entries()` in the same way as `get_entries()` above. Every entry fetched previously using `get_entries()` will exist in the cache. The same logic applies for entries fetched with `alias_id` set, using `get_cached_entries_for_current_player()`. Note that `player_id` is not supported by `get_cached_entries_for_current_player()`.

Similarly, updated results from `add_entry()` will also be reflected in the cache - the entry returned from the response will be upserted and the positions of the other entries in the cache will be updated.

Expand Down
18 changes: 15 additions & 3 deletions docs/unity/leaderboards.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,22 @@ public async void FetchEntries()

### Getting entries for the current player

You can also get entries exclusively created by the current player using `Talo.Leaderboards.GetEntriesForCurrentPlayer()`. This automatically sets the `aliasId` option:
Since a player can have many aliases, you can use the `playerId` option to fetch entries across all of a player's aliases:

```csharp
var entries = await Talo.Leaderboards.GetEntriesForCurrentPlayer(internalName, new GetEntriesOptions() { page = page });
var entries = await Talo.Leaderboards.GetEntries(internalName, new GetEntriesOptions() {
page = page,
playerId = Talo.CurrentPlayer.id
});
```

If you want to scope entries to a specific alias instead, use the `aliasId` option:

```csharp
var entries = await Talo.Leaderboards.GetEntries(internalName, new GetEntriesOptions() {
page = page,
aliasId = Talo.CurrentAlias.id
});
```

### Getting archived entries
Expand All @@ -128,7 +140,7 @@ var entries = await Talo.Leaderboards.GetEntries(internalName, new GetEntriesOpt

After fetching your leaderboard entries you can take advantage of the internal cache to construct your UI, removing the need for any subsequent network requests.

You can use `Talo.Leaderboard.GetCachedEntries()` in the same way as `GetEntries()` above. Every entry fetched previously using `GetEntries()` will exist in the cache. The same logic applies for `GetEntriesForCurrentPlayer()` with `GetCachedEntriesForCurrentPlayer()`.
You can use `Talo.Leaderboard.GetCachedEntries()` in the same way as `GetEntries()` above. Every entry fetched previously using `GetEntries()` will exist in the cache. The same logic applies for entries fetched with `aliasId` set, using `GetCachedEntriesForCurrentPlayer()`. Note that `playerId` is not supported by `GetCachedEntriesForCurrentPlayer()`.

Similarly, updated results from `AddEntry()` will also be reflected in the cache - the entry returned from the response will be upserted and the positions of the other entries in the cache will be updated.

Expand Down