Types
AddScoreCallback = proc (result: PDResult[PDScore]) {....raises: [].}
BoardsListCallback = proc (result: PDResult[PDBoardsList]) {....raises: [].}
PDBoard = object of RootObj boardID*, name*: string
PDBoardsList = object of RootObj lastUpdated*: uint32 boards*: seq[PDBoard]
PDResult[T] = object case kind*: PDResultKind of PDResultSuccess: result*: T of PDResultUnavailable: nil of PDResultError: message*: string
PDResultKind = enum PDResultSuccess, PDResultUnavailable, ## The operation completed successfully, but the response had no data PDResultError
PDScore = object of RootObj value*, rank*: uint32 player*: string
PDScoresList = object of RootObj boardID*: string lastUpdated*: uint32 scores*: seq[PDScore]
PersonalBestCallback = proc (result: PDResult[PDScore]) {....raises: [].}
ScoresCallback = proc (result: PDResult[PDScoresList]) {....raises: [].}
Procs
proc addScore(this: ptr PlaydateScoreboards; boardID: string; value: uint32; callback: AddScoreCallback): int32 {.discardable, ...raises: [], tags: [RootEffect], forbids: [].}
- Responds with PDResultUnavailable if the score was queued for later submission. Probably, Wi-Fi is not available.
proc getPersonalBest(this: ptr PlaydateScoreboards; boardID: string; callback: PersonalBestCallback): int32 {.discardable, ...raises: [], tags: [RootEffect], forbids: [].}
- Responds with PDResultUnavailable if no score exists for the current player.
proc getScoreboards(this: ptr PlaydateScoreboards; callback: BoardsListCallback): int32 {. discardable, ...raises: [], tags: [RootEffect], forbids: [].}
proc getScores(this: ptr PlaydateScoreboards; boardID: string; callback: ScoresCallback): int32 {.discardable, ...raises: [], tags: [RootEffect], forbids: [].}