@indiegems/gem-web-sdk 7.6.0 → 7.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/function.d.ts +20 -4
- package/dist/game.d.ts +23 -5
- package/dist/gem-web-sdk.esm.js +1 -1
- package/dist/gem-web-sdk.function.js +2 -2
- package/dist/gem-web-sdk.game.js +2 -2
- package/dist/gem-web-sdk.min.js +2 -2
- package/dist/gem-web-sdk.sdk.js +2 -2
- package/dist/gem-web-sdk.server-api.js +1 -1
- package/dist/gem-web-sdk.server.js +2 -2
- package/dist/sdk.d.ts +59 -11
- package/dist/server-api.d.ts +33 -6
- package/dist/server.d.ts +36 -6
- package/docs/api/api-reference-game.md +333 -9
- package/docs/api/api-reference-server.md +1 -1
- package/docs/api/reference.json +349 -9
- package/docs/daily-challenges.md +14 -2
- package/docs/getting-started.md +1 -1
- package/docs/leaderboards.md +140 -0
- package/docs/manifest.json +10 -10
- package/docs/server-bundles.md +2 -2
- package/docs/serverless-functions.md +35 -5
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# The browser surface — API reference
|
|
2
2
|
|
|
3
|
-
Generated from `@indiegems/gem-web-sdk/sdk` v7.
|
|
3
|
+
Generated from `@indiegems/gem-web-sdk/sdk` v7.7.0. Every symbol below links to its page on the Gem Arcade developer site.
|
|
4
4
|
|
|
5
5
|
`@indiegems/gem-web-sdk/sdk` is the one import a game writes, wherever its code runs. `@indiegems/gem-web-sdk/game` exports exactly the symbols on this page and nothing else, for a build that wants only this half.
|
|
6
6
|
|
|
@@ -7991,6 +7991,43 @@ What [LeaderboardsApi.mine](https://gemarcade.com/developer/api/game#leaderboard
|
|
|
7991
7991
|
Separate from [GetLeaderboardOptions](https://gemarcade.com/developer/api/game#getleaderboardoptions) because `limit` has no meaning
|
|
7992
7992
|
there — the global board arrives whole.
|
|
7993
7993
|
|
|
7994
|
+
## LeaderboardPeriod
|
|
7995
|
+
|
|
7996
|
+
[LeaderboardPeriod](https://gemarcade.com/developer/api/game#leaderboardperiod)
|
|
7997
|
+
|
|
7998
|
+
```ts
|
|
7999
|
+
interface LeaderboardPeriod
|
|
8000
|
+
```
|
|
8001
|
+
|
|
8002
|
+
Which period a `per_period` board's result is for.
|
|
8003
|
+
|
|
8004
|
+
A board whose config sets `per_period: true` exists once per period of the
|
|
8005
|
+
challenge its run type names: one board for each day of a daily challenge,
|
|
8006
|
+
each week of a weekly one. Present on a result exactly when the board is one
|
|
8007
|
+
of those; absent — not `null` — on an ordinary board.
|
|
8008
|
+
|
|
8009
|
+
⚠️ **Players on the same date share a board, whatever their time zone.** On
|
|
8010
|
+
a challenge that follows each player's own time zone (the default), a date
|
|
8011
|
+
begins for each player at their own midnight, so one day's board is open for
|
|
8012
|
+
about 50 hours worldwide and the standings can still change after YOUR day
|
|
8013
|
+
has ended. [LeaderboardPeriod.final](https://gemarcade.com/developer/api/game#leaderboardperiod-final) says when they no longer can.
|
|
8014
|
+
|
|
8015
|
+
## PeriodOptions
|
|
8016
|
+
|
|
8017
|
+
[PeriodOptions](https://gemarcade.com/developer/api/game#periodoptions)
|
|
8018
|
+
|
|
8019
|
+
```ts
|
|
8020
|
+
interface PeriodOptions
|
|
8021
|
+
```
|
|
8022
|
+
|
|
8023
|
+
Which period of a `per_period` board to read. Shared by every read.
|
|
8024
|
+
|
|
8025
|
+
Name at most one of [PeriodOptions.periodsBack](https://gemarcade.com/developer/api/game#periodoptions-periodsback) and
|
|
8026
|
+
[PeriodOptions.period](https://gemarcade.com/developer/api/game#periodoptions-period); with neither, the read answers for the current
|
|
8027
|
+
period. On a board that is not `per_period` both are refused with `invalid`
|
|
8028
|
+
rather than ignored — asking an all-time board for yesterday and being
|
|
8029
|
+
handed all time would be a different answer with nothing saying so.
|
|
8030
|
+
|
|
7994
8031
|
## ShowcaseApi
|
|
7995
8032
|
|
|
7996
8033
|
[ShowcaseApi](https://gemarcade.com/developer/api/game#showcaseapi)
|
|
@@ -11038,6 +11075,101 @@ A unit test that constructs the SDK in a simulated DOM has to give its
|
|
|
11038
11075
|
window a parent of its own, because a simulated top-level window is exactly
|
|
11039
11076
|
what this refuses.
|
|
11040
11077
|
|
|
11078
|
+
## LeaderboardPeriod.id
|
|
11079
|
+
|
|
11080
|
+
[LeaderboardPeriod.id](https://gemarcade.com/developer/api/game#leaderboardperiod-id)
|
|
11081
|
+
|
|
11082
|
+
```ts
|
|
11083
|
+
readonly id: string
|
|
11084
|
+
```
|
|
11085
|
+
|
|
11086
|
+
The period this board is for: the date for a daily challenge, the Monday
|
|
11087
|
+
for a weekly, the 1st for a monthly (`2026-10-02`), or a cron challenge's
|
|
11088
|
+
start as `2026-10-02T06:00:00Z`.
|
|
11089
|
+
|
|
11090
|
+
**This is the board's identity.** Pass it back as
|
|
11091
|
+
[GetLeaderboardOptions.period](https://gemarcade.com/developer/api/game#getleaderboardoptions-period) to read this same board again later —
|
|
11092
|
+
from a shared link, or a history screen — and key any cache on it.
|
|
11093
|
+
|
|
11094
|
+
## LeaderboardPeriod.localDate
|
|
11095
|
+
|
|
11096
|
+
[LeaderboardPeriod.localDate](https://gemarcade.com/developer/api/game#leaderboardperiod-localdate)
|
|
11097
|
+
|
|
11098
|
+
```ts
|
|
11099
|
+
readonly localDate?: string
|
|
11100
|
+
```
|
|
11101
|
+
|
|
11102
|
+
The period's calendar date, `YYYY-MM-DD` — the same value
|
|
11103
|
+
`gem.challenges.list()` gives as `periodLocalDate` for the challenge, so
|
|
11104
|
+
the two can be compared. Absent for a cron challenge, which has no date.
|
|
11105
|
+
|
|
11106
|
+
## LeaderboardPeriod.startAt
|
|
11107
|
+
|
|
11108
|
+
[LeaderboardPeriod.startAt](https://gemarcade.com/developer/api/game#leaderboardperiod-startat)
|
|
11109
|
+
|
|
11110
|
+
```ts
|
|
11111
|
+
readonly startAt?: number
|
|
11112
|
+
```
|
|
11113
|
+
|
|
11114
|
+
When this period began for the player the read answered for, in Unix
|
|
11115
|
+
seconds. Absent when the read answered for no player — a server or a
|
|
11116
|
+
function that named none — on a challenge that follows each player's own
|
|
11117
|
+
time zone.
|
|
11118
|
+
|
|
11119
|
+
## LeaderboardPeriod.endsAt
|
|
11120
|
+
|
|
11121
|
+
[LeaderboardPeriod.endsAt](https://gemarcade.com/developer/api/game#leaderboardperiod-endsat)
|
|
11122
|
+
|
|
11123
|
+
```ts
|
|
11124
|
+
readonly endsAt?: number
|
|
11125
|
+
```
|
|
11126
|
+
|
|
11127
|
+
When this period ends for that player, in Unix seconds: their own runs stop
|
|
11128
|
+
counting towards this board then.
|
|
11129
|
+
|
|
11130
|
+
⚠️ **Not when the board stops changing.** Players in later time zones are
|
|
11131
|
+
still on this date after it; see [LeaderboardPeriod.closesAt](https://gemarcade.com/developer/api/game#leaderboardperiod-closesat) and
|
|
11132
|
+
[LeaderboardPeriod.final](https://gemarcade.com/developer/api/game#leaderboardperiod-final). Absent exactly when
|
|
11133
|
+
[LeaderboardPeriod.startAt](https://gemarcade.com/developer/api/game#leaderboardperiod-startat) is.
|
|
11134
|
+
|
|
11135
|
+
## LeaderboardPeriod.opensAt
|
|
11136
|
+
|
|
11137
|
+
[LeaderboardPeriod.opensAt](https://gemarcade.com/developer/api/game#leaderboardperiod-opensat)
|
|
11138
|
+
|
|
11139
|
+
```ts
|
|
11140
|
+
readonly opensAt: number
|
|
11141
|
+
```
|
|
11142
|
+
|
|
11143
|
+
When this board started accepting runs from anyone, in Unix seconds. `0`
|
|
11144
|
+
when the platform sent something this SDK could not read.
|
|
11145
|
+
|
|
11146
|
+
## LeaderboardPeriod.closesAt
|
|
11147
|
+
|
|
11148
|
+
[LeaderboardPeriod.closesAt](https://gemarcade.com/developer/api/game#leaderboardperiod-closesat)
|
|
11149
|
+
|
|
11150
|
+
```ts
|
|
11151
|
+
readonly closesAt: number
|
|
11152
|
+
```
|
|
11153
|
+
|
|
11154
|
+
When this board stops accepting runs from anyone, in Unix seconds. `0`
|
|
11155
|
+
when the platform sent something this SDK could not read.
|
|
11156
|
+
|
|
11157
|
+
## LeaderboardPeriod.final
|
|
11158
|
+
|
|
11159
|
+
[LeaderboardPeriod.final](https://gemarcade.com/developer/api/game#leaderboardperiod-final)
|
|
11160
|
+
|
|
11161
|
+
```ts
|
|
11162
|
+
readonly final: boolean
|
|
11163
|
+
```
|
|
11164
|
+
|
|
11165
|
+
`true` once no run can still arrive, so the standings will not change
|
|
11166
|
+
again — stop polling, and say "final" if your screen says anything.
|
|
11167
|
+
|
|
11168
|
+
While it is `false` the standings may change, **including after the
|
|
11169
|
+
viewer's own period has ended**: a "you finished 3rd today" shown at the
|
|
11170
|
+
player's midnight can be wrong an hour later. Say "so far" until this is
|
|
11171
|
+
`true`.
|
|
11172
|
+
|
|
11041
11173
|
## LeaderboardEntry.playerId
|
|
11042
11174
|
|
|
11043
11175
|
[LeaderboardEntry.playerId](https://gemarcade.com/developer/api/game#leaderboardentry-playerid)
|
|
@@ -11135,6 +11267,12 @@ readonly occurredAt: number
|
|
|
11135
11267
|
|
|
11136
11268
|
When the ranked run occurred — Unix seconds.
|
|
11137
11269
|
|
|
11270
|
+
⚠️ **`0` on a `per_period` board whose challenge follows each player's own
|
|
11271
|
+
time zone** (the default `local` boundary). The platform serves no time
|
|
11272
|
+
there: beside the board's date, the time of a run would show which time
|
|
11273
|
+
zones its player could be in. Render no time for `0` rather than 1970.
|
|
11274
|
+
Ranks are unaffected — ties are still broken by the real time.
|
|
11275
|
+
|
|
11138
11276
|
## LeaderboardEntry.entityId
|
|
11139
11277
|
|
|
11140
11278
|
[LeaderboardEntry.entityId](https://gemarcade.com/developer/api/game#leaderboardentry-entityid)
|
|
@@ -11278,6 +11416,20 @@ interval: polling faster re-downloads the same rendering.
|
|
|
11278
11416
|
Absent if the server did not state one. Absent means *unknown*, not
|
|
11279
11417
|
"refreshes constantly" — do not substitute `0` and poll on it.
|
|
11280
11418
|
|
|
11419
|
+
## Leaderboard.period
|
|
11420
|
+
|
|
11421
|
+
[Leaderboard.period](https://gemarcade.com/developer/api/game#leaderboard-period)
|
|
11422
|
+
|
|
11423
|
+
```ts
|
|
11424
|
+
readonly period?: LeaderboardPeriod
|
|
11425
|
+
```
|
|
11426
|
+
|
|
11427
|
+
Which period this result is for, on a board whose config sets
|
|
11428
|
+
`per_period`. Absent on an ordinary board, which ranks every run.
|
|
11429
|
+
|
|
11430
|
+
Once `period.final` is `true` the board no longer changes and need not be
|
|
11431
|
+
polled.
|
|
11432
|
+
|
|
11281
11433
|
## RankedRow.rank
|
|
11282
11434
|
|
|
11283
11435
|
[RankedRow.rank](https://gemarcade.com/developer/api/game#rankedrow-rank)
|
|
@@ -11296,7 +11448,9 @@ readonly rank: number
|
|
|
11296
11448
|
readonly occurredAt: number
|
|
11297
11449
|
```
|
|
11298
11450
|
|
|
11299
|
-
When the ranked run occurred — Unix seconds.
|
|
11451
|
+
When the ranked run occurred — Unix seconds. `0` on a `per_period` board
|
|
11452
|
+
whose challenge follows each player's own time zone, where the platform
|
|
11453
|
+
serves no time; render nothing for it.
|
|
11300
11454
|
|
|
11301
11455
|
## RankedRow.stats
|
|
11302
11456
|
|
|
@@ -11326,7 +11480,9 @@ The run's freeform properties.
|
|
|
11326
11480
|
readonly occurredAt: number
|
|
11327
11481
|
```
|
|
11328
11482
|
|
|
11329
|
-
When the ranked run occurred — Unix seconds.
|
|
11483
|
+
When the ranked run occurred — Unix seconds. `0` on a `per_period` board
|
|
11484
|
+
whose challenge follows each player's own time zone, where the platform
|
|
11485
|
+
serves no time; render nothing for it.
|
|
11330
11486
|
|
|
11331
11487
|
## EntityLeaderboardEntry.properties
|
|
11332
11488
|
|
|
@@ -11488,6 +11644,107 @@ readonly generatedAt: number
|
|
|
11488
11644
|
|
|
11489
11645
|
When this rendering was computed — Unix seconds.
|
|
11490
11646
|
|
|
11647
|
+
## EntityLeaderboard.period
|
|
11648
|
+
|
|
11649
|
+
[EntityLeaderboard.period](https://gemarcade.com/developer/api/game#entityleaderboard-period)
|
|
11650
|
+
|
|
11651
|
+
```ts
|
|
11652
|
+
readonly period?: LeaderboardPeriod
|
|
11653
|
+
```
|
|
11654
|
+
|
|
11655
|
+
Which period these runs are from, on a board whose config sets
|
|
11656
|
+
`per_period`: `entries`, `personalBest` and `totalRuns`
|
|
11657
|
+
are then that ONE period's, not the entity's whole history. Absent on an
|
|
11658
|
+
ordinary board.
|
|
11659
|
+
|
|
11660
|
+
## PeriodOptions.periodsBack
|
|
11661
|
+
|
|
11662
|
+
[PeriodOptions.periodsBack](https://gemarcade.com/developer/api/game#periodoptions-periodsback)
|
|
11663
|
+
|
|
11664
|
+
```ts
|
|
11665
|
+
readonly periodsBack?: number
|
|
11666
|
+
```
|
|
11667
|
+
|
|
11668
|
+
How many periods back to read. `0` — the default — is the current period;
|
|
11669
|
+
`1` is yesterday's board for a daily challenge, last week's for a weekly.
|
|
11670
|
+
|
|
11671
|
+
An integer from 0 to 400. Anything else is a `TypeError` before the
|
|
11672
|
+
request is made.
|
|
11673
|
+
|
|
11674
|
+
## PeriodOptions.period
|
|
11675
|
+
|
|
11676
|
+
[PeriodOptions.period](https://gemarcade.com/developer/api/game#periodoptions-period)
|
|
11677
|
+
|
|
11678
|
+
```ts
|
|
11679
|
+
readonly period?: string
|
|
11680
|
+
```
|
|
11681
|
+
|
|
11682
|
+
The period to read, as an earlier result's [LeaderboardPeriod.id](https://gemarcade.com/developer/api/game#leaderboardperiod-id) —
|
|
11683
|
+
for a board reached from a shared link or a history screen. At most 400
|
|
11684
|
+
periods back.
|
|
11685
|
+
|
|
11686
|
+
⚠️ A period that has not begun for the player is refused, even when it has
|
|
11687
|
+
already begun for players in time zones ahead of theirs.
|
|
11688
|
+
|
|
11689
|
+
## PeriodOptions.playerId
|
|
11690
|
+
|
|
11691
|
+
[PeriodOptions.playerId](https://gemarcade.com/developer/api/game#periodoptions-playerid)
|
|
11692
|
+
|
|
11693
|
+
```ts
|
|
11694
|
+
readonly playerId?: string
|
|
11695
|
+
```
|
|
11696
|
+
|
|
11697
|
+
For a serverless function or a dedicated server: the player whose period
|
|
11698
|
+
to answer for. Their credential names no player, so without this a
|
|
11699
|
+
`per_period` board on each player's own time zone is answered in UTC,
|
|
11700
|
+
which is not that player's day.
|
|
11701
|
+
|
|
11702
|
+
Ignored in the browser, where the read is always for the signed-in player.
|
|
11703
|
+
|
|
11704
|
+
## EntityLeaderboardOptions.periodsBack
|
|
11705
|
+
|
|
11706
|
+
[EntityLeaderboardOptions.periodsBack](https://gemarcade.com/developer/api/game#entityleaderboardoptions-periodsback)
|
|
11707
|
+
|
|
11708
|
+
```ts
|
|
11709
|
+
readonly periodsBack?: number
|
|
11710
|
+
```
|
|
11711
|
+
|
|
11712
|
+
How many periods back to read. `0` — the default — is the current period;
|
|
11713
|
+
`1` is yesterday's board for a daily challenge, last week's for a weekly.
|
|
11714
|
+
|
|
11715
|
+
An integer from 0 to 400. Anything else is a `TypeError` before the
|
|
11716
|
+
request is made.
|
|
11717
|
+
|
|
11718
|
+
## EntityLeaderboardOptions.period
|
|
11719
|
+
|
|
11720
|
+
[EntityLeaderboardOptions.period](https://gemarcade.com/developer/api/game#entityleaderboardoptions-period)
|
|
11721
|
+
|
|
11722
|
+
```ts
|
|
11723
|
+
readonly period?: string
|
|
11724
|
+
```
|
|
11725
|
+
|
|
11726
|
+
The period to read, as an earlier result's [LeaderboardPeriod.id](https://gemarcade.com/developer/api/game#leaderboardperiod-id) —
|
|
11727
|
+
for a board reached from a shared link or a history screen. At most 400
|
|
11728
|
+
periods back.
|
|
11729
|
+
|
|
11730
|
+
⚠️ A period that has not begun for the player is refused, even when it has
|
|
11731
|
+
already begun for players in time zones ahead of theirs.
|
|
11732
|
+
|
|
11733
|
+
## EntityLeaderboardOptions.playerId
|
|
11734
|
+
|
|
11735
|
+
[EntityLeaderboardOptions.playerId](https://gemarcade.com/developer/api/game#entityleaderboardoptions-playerid)
|
|
11736
|
+
|
|
11737
|
+
```ts
|
|
11738
|
+
readonly playerId?: string
|
|
11739
|
+
```
|
|
11740
|
+
|
|
11741
|
+
For a serverless function or a dedicated server: the player whose period
|
|
11742
|
+
to answer for. Their credential names no player, so without this a
|
|
11743
|
+
`per_period` board on each player's own time zone is answered in UTC,
|
|
11744
|
+
which is not that player's day.
|
|
11745
|
+
|
|
11746
|
+
Ignored in the browser, where the read is always for the signed-in player.
|
|
11747
|
+
|
|
11491
11748
|
## EntityLeaderboardOptions.bucket1
|
|
11492
11749
|
|
|
11493
11750
|
[EntityLeaderboardOptions.bucket1](https://gemarcade.com/developer/api/game#entityleaderboardoptions-bucket1)
|
|
@@ -11534,6 +11791,50 @@ readonly signal?: AbortSignal
|
|
|
11534
11791
|
|
|
11535
11792
|
Abort the read.
|
|
11536
11793
|
|
|
11794
|
+
## GetLeaderboardOptions.periodsBack
|
|
11795
|
+
|
|
11796
|
+
[GetLeaderboardOptions.periodsBack](https://gemarcade.com/developer/api/game#getleaderboardoptions-periodsback)
|
|
11797
|
+
|
|
11798
|
+
```ts
|
|
11799
|
+
readonly periodsBack?: number
|
|
11800
|
+
```
|
|
11801
|
+
|
|
11802
|
+
How many periods back to read. `0` — the default — is the current period;
|
|
11803
|
+
`1` is yesterday's board for a daily challenge, last week's for a weekly.
|
|
11804
|
+
|
|
11805
|
+
An integer from 0 to 400. Anything else is a `TypeError` before the
|
|
11806
|
+
request is made.
|
|
11807
|
+
|
|
11808
|
+
## GetLeaderboardOptions.period
|
|
11809
|
+
|
|
11810
|
+
[GetLeaderboardOptions.period](https://gemarcade.com/developer/api/game#getleaderboardoptions-period)
|
|
11811
|
+
|
|
11812
|
+
```ts
|
|
11813
|
+
readonly period?: string
|
|
11814
|
+
```
|
|
11815
|
+
|
|
11816
|
+
The period to read, as an earlier result's [LeaderboardPeriod.id](https://gemarcade.com/developer/api/game#leaderboardperiod-id) —
|
|
11817
|
+
for a board reached from a shared link or a history screen. At most 400
|
|
11818
|
+
periods back.
|
|
11819
|
+
|
|
11820
|
+
⚠️ A period that has not begun for the player is refused, even when it has
|
|
11821
|
+
already begun for players in time zones ahead of theirs.
|
|
11822
|
+
|
|
11823
|
+
## GetLeaderboardOptions.playerId
|
|
11824
|
+
|
|
11825
|
+
[GetLeaderboardOptions.playerId](https://gemarcade.com/developer/api/game#getleaderboardoptions-playerid)
|
|
11826
|
+
|
|
11827
|
+
```ts
|
|
11828
|
+
readonly playerId?: string
|
|
11829
|
+
```
|
|
11830
|
+
|
|
11831
|
+
For a serverless function or a dedicated server: the player whose period
|
|
11832
|
+
to answer for. Their credential names no player, so without this a
|
|
11833
|
+
`per_period` board on each player's own time zone is answered in UTC,
|
|
11834
|
+
which is not that player's day.
|
|
11835
|
+
|
|
11836
|
+
Ignored in the browser, where the read is always for the signed-in player.
|
|
11837
|
+
|
|
11537
11838
|
## GetLeaderboardOptions.bucket1
|
|
11538
11839
|
|
|
11539
11840
|
[GetLeaderboardOptions.bucket1](https://gemarcade.com/developer/api/game#getleaderboardoptions-bucket1)
|
|
@@ -11581,14 +11882,28 @@ A bucketed board (config `bucket_by`) needs exactly its bucket values —
|
|
|
11581
11882
|
faster than the result's `updateFrequencySeconds`; the server regenerates
|
|
11582
11883
|
at that cadence and faster polling re-reads the same rendering.
|
|
11583
11884
|
|
|
11885
|
+
A `per_period` board answers for one period — the current one by default:
|
|
11886
|
+
|
|
11887
|
+
```js
|
|
11888
|
+
const today = await gem.leaderboards.get('daily');
|
|
11889
|
+
const yesterday = await gem.leaderboards.get('daily', { periodsBack: 1 });
|
|
11890
|
+
label(today.period.final ? 'Final standings' : 'Standings so far');
|
|
11891
|
+
```
|
|
11892
|
+
|
|
11584
11893
|
| Parameter | Type | Description |
|
|
11585
11894
|
| --- | --- | --- |
|
|
11586
11895
|
| `leaderboardType` | `string` | The board's id in your game config. |
|
|
11587
11896
|
| `options` | `GetLeaderboardOptions` | |
|
|
11588
11897
|
|
|
11589
|
-
**Throws.** `
|
|
11898
|
+
**Throws.** `TypeError` when `periodsBack` is not an integer from 0 to 400,
|
|
11899
|
+
`period` is not a period id, or both are passed — refused before the
|
|
11900
|
+
request.
|
|
11901
|
+
|
|
11902
|
+
`not_found` when no board with this id is in the channel's active
|
|
11590
11903
|
config, `invalid` when bucket values do not match the board's
|
|
11591
|
-
`bucket_by
|
|
11904
|
+
`bucket_by`, when a period is asked of a board that is not `per_period`
|
|
11905
|
+
(`code` `invalid_period`), or when the period has not begun for the
|
|
11906
|
+
player (`code` `period_not_begun`).
|
|
11592
11907
|
|
|
11593
11908
|
## LeaderboardsApi.friends
|
|
11594
11909
|
|
|
@@ -11619,16 +11934,20 @@ for (const row of board.entries) {
|
|
|
11619
11934
|
}
|
|
11620
11935
|
```
|
|
11621
11936
|
|
|
11937
|
+
On a `per_period` board this takes the same `periodsBack` and `period` as
|
|
11938
|
+
`get`. A friend in another time zone who is on the same date is on
|
|
11939
|
+
the same board.
|
|
11940
|
+
|
|
11622
11941
|
| Parameter | Type |
|
|
11623
11942
|
| --- | --- |
|
|
11624
11943
|
| `leaderboardType` | `string` |
|
|
11625
11944
|
| `options` | `GetLeaderboardOptions` |
|
|
11626
11945
|
|
|
11627
11946
|
**Throws.** `not_found` when no board with this id is in the channel's active
|
|
11628
|
-
config, `invalid` when bucket values do not match the board
|
|
11629
|
-
`
|
|
11630
|
-
view is a player surface, and a game server has no friends. (The
|
|
11631
|
-
`get` declares no such refusal: it needs no viewer.)
|
|
11947
|
+
config, `invalid` when bucket values or a period do not match the board
|
|
11948
|
+
(as on `get`), and `forbidden` in a context with no player — the
|
|
11949
|
+
friend view is a player surface, and a game server has no friends. (The
|
|
11950
|
+
global `get` declares no such refusal: it needs no viewer.)
|
|
11632
11951
|
|
|
11633
11952
|
## LeaderboardsApi.mine
|
|
11634
11953
|
|
|
@@ -11664,6 +11983,11 @@ a `200` with no entries, not an error. If it is *always* empty, see
|
|
|
11664
11983
|
[LeaderboardsApi](https://gemarcade.com/developer/api/game#leaderboardsapi) on where runs come from: a browser cannot submit
|
|
11665
11984
|
one.
|
|
11666
11985
|
|
|
11986
|
+
On a `per_period` board the runs, the personal best and the total are ONE
|
|
11987
|
+
period's — the current one unless `periodsBack` or `period` names another
|
|
11988
|
+
— so `personalBest` is "your best today", and an empty result at the start
|
|
11989
|
+
of a day is the ordinary state.
|
|
11990
|
+
|
|
11667
11991
|
| Parameter | Type |
|
|
11668
11992
|
| --- | --- |
|
|
11669
11993
|
| `leaderboardType` | `string` |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# The server surface — API reference
|
|
2
2
|
|
|
3
|
-
Generated from `@indiegems/gem-web-sdk/sdk` v7.
|
|
3
|
+
Generated from `@indiegems/gem-web-sdk/sdk` v7.7.0. Every symbol below links to its page on the Gem Arcade developer site.
|
|
4
4
|
|
|
5
5
|
`@indiegems/gem-web-sdk/sdk` is the one import a game writes, wherever its code runs. `@indiegems/gem-web-sdk/server` exports exactly the symbols on this page and nothing else, for a build that wants only this half.
|
|
6
6
|
|