Documentation
Browse documentation

DocumentationReference

Result shapes

What the services of PlayerVox OverCrow answer: the shape of each result and of each subscription update. The SDK exports a TypeScript type of the same name for each shape, so the logic never describes them by hand.

TSwidgets/stopwatch/logic.ts
declare module "@overcrow/sdk" {
  interface WidgetState {
    /** The latest state, or `null` while it is unknown. */
    stopwatch: Stopwatch | null;
    /** The buttons take input only in Interactive mode. */
    interactive: boolean;
  }
}

The Stopwatch widget keeps the latest Stopwatch value in its state, and the view reads its members:

OCMLwidgets/stopwatch/view.ocml
      <elapsed class="value" base={state.stopwatch.elapsedMs} at={state.stopwatch.at} running={state.stopwatch.running} format="hh:mm:ss.cc"/>

How to read a shape

  • A shape is an exact record: every member is present, and a member without a value is null, never absent.
  • "text or null" means that the member may be null: test it before you show it.
  • An integer is below 2^53, so it is exact in JavaScript. Times are in milliseconds: "Unix milliseconds" count from 1970 in UTC, as Date.now() does.
  • A member that goes with offsetMinutes is a timestamp to format with that UTC offset; see time, dates and numbers.
  • An asset: handle is an image that PlayerVox OverCrow holds for the widget: bind it to the src of an image or an avatar, or draw it on a canvas. It is not a URL and cannot be read as bytes.
  • A subscription whose shape is "… or null" delivers null when there is nothing to show: no active game, no media player.

Which service gives which shape is in the service reference.

Shapes

HttpResponse

Answer of http.fetch. { status, contentType } or { status, asset }

MemberShapeMeaning
statusintegerHTTP status.
contentTypetext or nullResponse media type; the SDK adds the decoded body, body.
MemberShapeMeaning
statusintegerHTTP status.
assetasset: handleThe decoded image (as: "image").

GameEvent

One game event. { event, at }

MemberShapeMeaning
eventtextA declared game event.
atintegerHost monotonic clock in ms.

Session

Duration of the active game session. { elapsedMs, at }

MemberShapeMeaning
elapsedMsintegerTime since the game process started.
atintegerHost monotonic clock in ms at which elapsedMs was measured.

Telemetry

Resource use of the active game. { cpu, ram, cpuTemperature, gpuTemperature, sources }

MemberShapeMeaning
cpunumber or nullThe game's share of the whole machine in %, from 0 to 100.
raminteger or nullResident bytes of the game.
cpuTemperaturenumber or null°C.
gpuTemperaturenumber or null°C.
sources{ cpuTemperature, gpuTemperature }Sensors the host has.
sources.cpuTemperaturebooleanThe host has a CPU sensor.
sources.gpuTemperaturebooleanThe host has a GPU sensor.

Fps

Frame rate of the active game. { fps, stale, status }

MemberShapeMeaning
fpsinteger or nullFrames per second.
stalebooleanNo sample for 3 s.
statusready | waiting | unsupported | permission_denied | ambiguous | events_lost | unavailableMeasurement state.

Stopwatch

The manual stopwatch. { running, elapsedMs, at, shortcuts }

MemberShapeMeaning
runningbooleanIt is counting.
elapsedMsintegerElapsed time at at.
atintegerHost monotonic clock in ms at which elapsedMs was measured.
shortcuts{ toggle, reset, bound }Stopwatch shortcuts.
shortcuts.toggletextHost-formatted key chord.
shortcuts.resettextHost-formatted key chord.
shortcuts.boundbooleanThe shortcuts are active.

Media

The current media player. { player, title, artists, playing, canPrevious, canPlayPause, canNext, cover }

MemberShapeMeaning
playertextOpaque ID of the current player.
titletext or nullTrack title.
artistslist of textArtists.
playingbooleanPlaying.
canPreviousbooleanThe player supports previous.
canPlayPausebooleanThe player supports play/pause.
canNextbooleanThe player supports next.
coverasset: handle or nullCover art, at most 512 px.

NoteItem

One checklist item. { id, text, checked }

MemberShapeMeaning
idtext or nullItem ID.
texttextText.
checkedbooleanChecked.

Note

One note. { id, title, body, items }

MemberShapeMeaning
idtext or nullNote ID.
titletextTitle.
bodytextBody text.
itemslist of NoteItemChecklist.

Notes

The user's notes document. { active, notes }

MemberShapeMeaning
activetext or nullID of the active note.
noteslist of NoteNotes.

CreatedNote

Answer of notes.create. { note }

MemberShapeMeaning
noteNoteThe new note.

Score

PlayerVox score of the active game. { state, name, score, grade, ratingsCount, criteria }

MemberShapeMeaning
stateidle | unsupported | loading | ready | no_ratings | not_found | unavailableScore state: idle without an active game, unsupported for a game without a Steam app ID, loading until the game's first answer (never the previous game's score), ready and no_ratings with the score, not_found for a game PlayerVox cannot match, unavailable while the host retries. Every state but ready and no_ratings has a null name and score, grade --, no ratings and null criteria.
nametext or nullGame name.
scorenumber or null0–100.
gradeS+ | S | A | B | C | D | F | --Grade of the score.
ratingsCountintegerNumber of ratings.
criteria{ gameplay, art, tech }Criteria scores.
criteria.gameplaynumber or null0–100.
criteria.artnumber or null0–100.
criteria.technumber or null0–100.

Rating

The user's PlayerVox rating of the active game. { gameplay, art, tech, review, publishedAt, offsetMinutes }

MemberShapeMeaning
gameplayinteger0–100.
artinteger0–100.
techinteger0–100.
reviewtext or nullReview text.
publishedAtinteger or nullUnix milliseconds.
offsetMinutesinteger or nullUTC offset in minutes to show the timestamp with.

RatingState

The user's own rating of the active game, with its state. { state, name, offline, rating }

MemberShapeMeaning
stateidle | unsupported | loading | ready | unavailableRating state: idle without an active game, unsupported for a game without a Steam app ID, loading until the first answer for this game and account (never the previous game's rating), ready with the rating, unavailable while the host retries a failed read. Every state but ready has a null name and rating.
nametext or nullGame name on PlayerVox.
offlinebooleanPlayerVox is unreachable: the rating is the last one read, and playervox.rating.publish answers not_connected.
ratingRating or nullThe user's rating; null before the first one.

Review

One player review. { id, author, grade, score, text, original, hidden, publishedAt, offsetMinutes }

MemberShapeMeaning
idtextReview ID.
authortextAuthor name.
gradeS+ | S | A | B | C | D | F | --Grade.
scoreinteger0–100.
texttext or nullText, translated when a translation exists.
originaltext or nullUntranslated text when text is a translation; null otherwise.
hiddenbooleanHidden by the community: show the text only once the user asks for it.
publishedAtintegerUnix milliseconds.
offsetMinutesintegerUTC offset in minutes to show the timestamp with.

ReviewsState

The player reviews of the active game: what to read, not the reviews. { state, revision, offline }

MemberShapeMeaning
stateidle | unsupported | readyidle without an active game, unsupported for a game without a Steam app ID, ready when playervox.reviews.page reads the game's reviews.
revisionintegerChanges whenever the reviews to read change: another game, another PlayerVox account, or reviews changed on PlayerVox.
offlinebooleanPlayerVox is unreachable: playervox.reviews.page answers not_connected.

ReviewsPage

A page of player reviews. { gameName, items, page, totalPages, count }

MemberShapeMeaning
gameNametextGame name on PlayerVox.
itemslist of ReviewReviews.
pageintegerPage number.
totalPagesintegerNumber of pages.
countintegerNumber of reviews.

JournalSession

One journal session. { id, startedAt, offsetMinutes, durationMs, source }

MemberShapeMeaning
idtextSession ID.
startedAtintegerUnix milliseconds.
offsetMinutesintegerUTC offset in minutes to show the timestamp with.
durationMsintegerDuration.
sourcelocal | cloudWhere the session is stored.

JournalState

The journal of the active game. { revision, notice }

MemberShapeMeaning
revisionintegerChanges whenever the merged journal of the active game changes.
noticeoffline | storage_unavailable | full | expired | busy | unavailable or nullJournal condition to show above the sessions: offline sync is offline (local sessions remain), storage_unavailable the local journal cannot be read, full the local journal is full, expired the PlayerVox sign-in expired, busy PlayerVox asks to retry later, unavailable any other failure; null when none.

JournalPage

A page of the game journal. { gameName, items, page, next, previous }

MemberShapeMeaning
gameNametextActive game; empty when the host has no name.
itemslist of JournalSessionSessions, newest first.
pageintegerPage number, from 1.
nexttext or nullCursor of the next page.
previoustext or nullCursor of the previous page.

ChatFragment

A text run or an emote of a chat message. { text } or { emote, alt }

MemberShapeMeaning
texttextText run.
MemberShapeMeaning
emoteasset: handleEmote image.
alttextEmote name.

ChatMessage

One chat message. { id, author, color, badges, fragments, reply, deleted, receivedAt }

MemberShapeMeaning
idtextMessage ID.
authortextAuthor name.
colortext or nullAuthor colour #rrggbb.
badgeslist of asset: handleBadge images.
fragmentslist of ChatFragmentContent runs.
reply{ author, text } or nullThe message replied to.
reply.authortextAuthor replied to.
reply.texttextText replied to.
deletedbooleanDeleted by a moderator.
receivedAtintegerWhen the host received the message, in Unix milliseconds of the host's clock: compare it with Date.now() to age a message (the fade of Passive mode), also after a reset.

TwitchChat

Twitch chat state. { account, channel, joinState, failure, favorites, canSend, generation, reset, messages, removed, skipped }

MemberShapeMeaning
accountsigned_out | pending | connected | expiredTwitch account state; sign-in is drawn by the host.
channeltext or nullJoined channel login.
joinStateidle | connecting | joined | reconnecting | failedChannel connection state.
failurechannel_unavailable | connection | provider | limit or nullWhy joinState is failed, as a fixed category: the channel does not exist or refuses the account, the connection failed, Twitch answered something unexpected, or another widget holds the host's one chat connection (limit). null in every other state. An account failure is not here: the host draws it.
favoriteslist of textFavorite channels.
canSendbooleanA message can be sent now.
generationintegerChanges with the channel or account.
resetbooleanmessages replaces the whole list.
messageslist of ChatMessageMessages, oldest first: the whole list with reset; otherwise the new messages, to append, and the changed ones, which replace the message of the same id in place.
removedlist of textIDs of removed messages.
skippedintegerNew messages the host left out since the previous update, because the chat is faster than it delivers; 0 with reset. A removal is never left out.