Logo Xanthos

Serialization Module

Provides helpers for decoding and encoding JV-Link payloads into strongly typed domain records.

Functions and values

Function or value Description

deserialiseOdds payload

Full Usage: deserialiseOdds payload

Parameters:
    payload : byte[] - UTF-8 or Shift-JIS encoded JSON byte array.

Returns: Result<RaceOdds list, XanthosError> A list of RaceOdds or a XanthosError.

Deserialises odds snapshots from JSON. This is an alias for parseOdds.

payload : byte[]

UTF-8 or Shift-JIS encoded JSON byte array.

Returns: Result<RaceOdds list, XanthosError>

A list of RaceOdds or a XanthosError.

parseNativeWatchEvent event

Full Usage: parseNativeWatchEvent event

Parameters:
Returns: Result<WatchEvent, JvError>

Adapts the same official key parser used by JvLink.parseEvent to the legacy domain record.

event : JvEvent
Returns: Result<WatchEvent, JvError>

parseOdds payload

Full Usage: parseOdds payload

Parameters:
    payload : byte[] - Raw bytes returned by JV-Link.

Returns: Result<RaceOdds list, XanthosError> A list of RaceOdds or a XanthosError.

Decodes JV odds payloads (Shift-JIS or UTF-8) expressed as JSON into strongly typed snapshots.

payload : byte[]

Raw bytes returned by JV-Link.

Returns: Result<RaceOdds list, XanthosError>

A list of RaceOdds or a XanthosError.

parseRaceCard payload

Full Usage: parseRaceCard payload

Parameters:
    payload : byte[] - Raw bytes returned by JV-Link.

Returns: Result<RaceInfo list, XanthosError> A list of RaceInfo or a XanthosError.

Decodes JV race card payloads (Shift-JIS or UTF-8) expressed as JSON into strongly typed records.

payload : byte[]

Raw bytes returned by JV-Link.

Returns: Result<RaceInfo list, XanthosError>

A list of RaceInfo or a XanthosError.

parseWatchEvent rawKey

Full Usage: parseWatchEvent rawKey

Parameters:
    rawKey : string - The raw key string from JVWatchEvent callback.

Returns: WatchEvent A WatchEvent with parsed fields including event type, meeting date, course code, etc.

Parses historical application-formatted watch strings. For SDK callbacks use parseNativeWatchEvent.

Historical application strings used formats like "0B12RA20240101010112..." where:

  • 0B12/0B11/0B16 = dataspec prefix indicating event category
  • RA/JC/WE/CC/AV/TC = record type (optional)
  • yyyyMMdd = meeting date
  • JJ = course/venue code
  • RR = race number

rawKey : string

The raw key string from JVWatchEvent callback.

Returns: WatchEvent

A WatchEvent with parsed fields including event type, meeting date, course code, etc.

serialiseOdds snapshots

Full Usage: serialiseOdds snapshots

Parameters:
    snapshots : RaceOdds list - The odds snapshots to serialise.

Returns: Result<byte[], XanthosError> UTF-8 encoded JSON byte array or a XanthosError.

Serialises odds snapshots to JSON for persistence or caching scenarios. The output format is compatible with parseOdds.

snapshots : RaceOdds list

The odds snapshots to serialise.

Returns: Result<byte[], XanthosError>

UTF-8 encoded JSON byte array or a XanthosError.

Type something to start searching.