Skip to content

Commit

Permalink
Also export events to ts api.
Browse files Browse the repository at this point in the history
  • Loading branch information
kunyavskiy committed Sep 16, 2023
1 parent 39018d4 commit 6cafe1f
Show file tree
Hide file tree
Showing 2 changed files with 388 additions and 0 deletions.
383 changes: 383 additions & 0 deletions schemas/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,386 @@ export namespace ProblemResult {
isFirstBest: boolean;
}
}

export type MainScreenEvent =
| MainScreenEvent.HideWidget
| MainScreenEvent.MainScreenSnapshot
| MainScreenEvent.ShowWidget;

export namespace MainScreenEvent {
export enum Type {
HideWidget = "HideWidget",
MainScreenSnapshot = "MainScreenSnapshot",
ShowWidget = "ShowWidget",
}

export interface HideWidget {
type: MainScreenEvent.Type.HideWidget;
id: string;
}

export interface MainScreenSnapshot {
type: MainScreenEvent.Type.MainScreenSnapshot;
widgets: Widget[];
}

export interface ShowWidget {
type: MainScreenEvent.Type.ShowWidget;
widget: Widget;
}
}

export type Widget =
| Widget.AdvertisementWidget
| Widget.FullScreenClockWidget
| Widget.PictureWidget
| Widget.QueueWidget
| Widget.ScoreboardWidget
| Widget.StatisticsWidget
| Widget.SvgWidget
| Widget.TeamLocatorWidget
| Widget.TeamViewWidget
| Widget.TickerWidget;

export namespace Widget {
export enum Type {
AdvertisementWidget = "AdvertisementWidget",
FullScreenClockWidget = "FullScreenClockWidget",
PictureWidget = "PictureWidget",
QueueWidget = "QueueWidget",
ScoreboardWidget = "ScoreboardWidget",
StatisticsWidget = "StatisticsWidget",
SvgWidget = "SvgWidget",
TeamLocatorWidget = "TeamLocatorWidget",
TeamViewWidget = "TeamViewWidget",
TickerWidget = "TickerWidget",
}

export interface AdvertisementWidget {
type: Widget.Type.AdvertisementWidget;
widgetId: string;
location: LocationRectangle;
advertisement: AdvertisementSettings;
}

export interface FullScreenClockWidget {
type: Widget.Type.FullScreenClockWidget;
widgetId: string;
location: LocationRectangle;
settings: FullScreenClockSettings;
}

export interface PictureWidget {
type: Widget.Type.PictureWidget;
widgetId: string;
location: LocationRectangle;
picture: PictureSettings;
}

export interface QueueWidget {
type: Widget.Type.QueueWidget;
widgetId: string;
location: LocationRectangle;
settings: QueueSettings;
}

export interface ScoreboardWidget {
type: Widget.Type.ScoreboardWidget;
widgetId: string;
location: LocationRectangle;
settings: ScoreboardSettings;
}

export interface StatisticsWidget {
type: Widget.Type.StatisticsWidget;
widgetId: string;
location: LocationRectangle;
settings: StatisticsSettings;
}

export interface SvgWidget {
type: Widget.Type.SvgWidget;
widgetId: string;
location: LocationRectangle;
content: string;
}

export interface TeamLocatorWidget {
type: Widget.Type.TeamLocatorWidget;
widgetId: string;
location: LocationRectangle;
settings: TeamLocatorSettings;
}

export interface TeamViewWidget {
type: Widget.Type.TeamViewWidget;
widgetId: string;
location: LocationRectangle;
settings: OverlayTeamViewSettings;
}

export interface TickerWidget {
type: Widget.Type.TickerWidget;
widgetId: string;
location: LocationRectangle;
settings: TickerSettings;
}
}

export interface LocationRectangle {
positionX: number;
positionY: number;
sizeX: number;
sizeY: number;
}

export interface AdvertisementSettings {
text: string;
}

export interface FullScreenClockSettings {
globalTimeMode?: boolean;
quietMode?: boolean;
contestCountdownMode?: boolean;
}

export interface PictureSettings {
url: string;
name: string;
}

export interface QueueSettings {
}

export interface ScoreboardSettings {
isInfinite?: boolean;
numRows?: number | null;
startFromRow?: number;
optimismLevel?: OptimismLevel;
teamsOnPage?: number;
group?: string;
}

export interface StatisticsSettings {
}

export interface TeamLocatorSettings {
circles?: TeamLocatorCircleSettings[];
scene?: string;
}

export interface OverlayTeamViewSettings {
content?: MediaType[];
position?: TeamViewPosition;
}

export interface TickerSettings {
}

export enum OptimismLevel {
normal = "normal",
optimistic = "optimistic",
pessimistic = "pessimistic",
}

export enum TeamViewPosition {
SINGLE_TOP_RIGHT = "SINGLE_TOP_RIGHT",
PVP_TOP = "PVP_TOP",
PVP_BOTTOM = "PVP_BOTTOM",
TOP_LEFT = "TOP_LEFT",
TOP_RIGHT = "TOP_RIGHT",
BOTTOM_LEFT = "BOTTOM_LEFT",
BOTTOM_RIGHT = "BOTTOM_RIGHT",
}

export interface TeamLocatorCircleSettings {
x: number;
y: number;
radius: number;
teamId: number;
}

export type QueueEvent =
| QueueEvent.AddRunToQueue
| QueueEvent.ModifyRunInQueue
| QueueEvent.QueueSnapshot
| QueueEvent.RemoveRunFromQueue;

export namespace QueueEvent {
export enum Type {
AddRunToQueue = "AddRunToQueue",
ModifyRunInQueue = "ModifyRunInQueue",
QueueSnapshot = "QueueSnapshot",
RemoveRunFromQueue = "RemoveRunFromQueue",
}

export interface AddRunToQueue {
type: QueueEvent.Type.AddRunToQueue;
info: RunInfo;
}

export interface ModifyRunInQueue {
type: QueueEvent.Type.ModifyRunInQueue;
info: RunInfo;
}

export interface QueueSnapshot {
type: QueueEvent.Type.QueueSnapshot;
infos: RunInfo[];
}

export interface RemoveRunFromQueue {
type: QueueEvent.Type.RemoveRunFromQueue;
info: RunInfo;
}
}

export type AnalyticsEvent =
| AnalyticsEvent.AddAnalyticsMessage
| AnalyticsEvent.AnalyticsMessageSnapshot
| AnalyticsEvent.ModifyAnalyticsMessage;

export namespace AnalyticsEvent {
export enum Type {
AddAnalyticsMessage = "AddAnalyticsMessage",
AnalyticsMessageSnapshot = "AnalyticsMessageSnapshot",
ModifyAnalyticsMessage = "ModifyAnalyticsMessage",
}

export interface AddAnalyticsMessage {
type: AnalyticsEvent.Type.AddAnalyticsMessage;
message: AnalyticsMessage;
}

export interface AnalyticsMessageSnapshot {
type: AnalyticsEvent.Type.AnalyticsMessageSnapshot;
messages: AnalyticsMessage[];
}

export interface ModifyAnalyticsMessage {
type: AnalyticsEvent.Type.ModifyAnalyticsMessage;
message: AnalyticsMessage;
}
}

export type AnalyticsMessage =
| AnalyticsMessage.commentary;

export namespace AnalyticsMessage {
export enum Type {
commentary = "commentary",
}

export interface commentary {
type: AnalyticsMessage.Type.commentary;
id: string;
message: string;
timeUnixMs: number;
relativeTimeMs: number;
teamIds: number[];
runIds: number[];
priority?: number;
tags?: string[];
advertisement?: AnalyticsCompanionPreset | null;
tickerMessage?: AnalyticsCompanionPreset | null;
featuredRun?: AnalyticsCompanionRun | null;
}
}

export interface AnalyticsCompanionPreset {
presetId: number;
expirationTimeUnixMs: number | null;
}

export interface AnalyticsCompanionRun {
expirationTimeUnixMs: number | null;
mediaType: MediaType;
}

export type TickerEvent =
| TickerEvent.AddMessage
| TickerEvent.RemoveMessage
| TickerEvent.TickerSnapshot;

export namespace TickerEvent {
export enum Type {
AddMessage = "AddMessage",
RemoveMessage = "RemoveMessage",
TickerSnapshot = "TickerSnapshot",
}

export interface AddMessage {
type: TickerEvent.Type.AddMessage;
message: TickerMessage;
}

export interface RemoveMessage {
type: TickerEvent.Type.RemoveMessage;
messageId: string;
}

export interface TickerSnapshot {
type: TickerEvent.Type.TickerSnapshot;
messages: TickerMessage[];
}
}

export type TickerMessage =
| TickerMessage.clock
| TickerMessage.scoreboard
| TickerMessage.text;

export namespace TickerMessage {
export enum Type {
clock = "clock",
scoreboard = "scoreboard",
text = "text",
}

export interface clock {
type: TickerMessage.Type.clock;
id: string;
part: TickerPart;
periodMs: number;
settings: clock;
}

export interface scoreboard {
type: TickerMessage.Type.scoreboard;
id: string;
part: TickerPart;
periodMs: number;
settings: scoreboard;
}

export interface text {
type: TickerMessage.Type.text;
id: string;
part: TickerPart;
periodMs: number;
settings: text;
}
}

export enum TickerPart {
short = "short",
long = "long",
}

export interface clock {
part: TickerPart;
periodMs: number;
}

export interface scoreboard {
part: TickerPart;
periodMs: number;
from: number;
to: number;
}

export interface text {
part: TickerPart;
periodMs: number;
text: string;
}
Loading

0 comments on commit 6cafe1f

Please sign in to comment.