Skip to content

Data types

Shapes of the data the API returns, so editors can autocomplete field names.

These are TypedDicts: at runtime everything is still a plain dict, so nothing changes for your code. They just tell your editor (and type checkers like mypy or Pylance) which keys exist, so player["Usernmae"] gets flagged before you run it.

Every class is total=False because the API can leave fields out (a player who's still loading in only has UserId, Username and DisplayName) and adds new fields over time. Anything the API marks as "or null" is Optional.

Field reference: https://docs.oxfd.re/#reference

ServerInfo

Bases: TypedDict

data["Server"]: the server's core details.

Player

Bases: TypedDict

One entry in Players.

Tracks

Bases: TypedDict

Tracks: samples are [t, x, z, heading] with t in seconds after From.

Els

Bases: TypedDict

Emergency lights and siren.

Vehicle

Bases: TypedDict

One entry in Vehicles.

TeamStatus

Bases: TypedDict

One team in Teams (keyed by team name).

Staff

Bases: TypedDict

Staff.

LogEntry

Bases: TypedDict

Fields every log entry has.

Event

Bases: LogEntry

A game event. Which fields are present depends on Type: see https://docs.oxfd.re/#events. The common ones are listed here.

CommandResult

Bases: TypedDict

What run_command and the helpers return.

CommandStatus

Bases: TypedDict

What get_command returns (the API's older shape, lower-case Status).