-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathtypes.ts
More file actions
102 lines (87 loc) · 1.92 KB
/
types.ts
File metadata and controls
102 lines (87 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
export interface Match {
id: string | number;
sport: string;
homeTeam: string;
awayTeam: string;
status: string; // Allow flexible status strings from API
startTime: string;
endTime?: string;
homeScore: number;
awayScore: number;
createdAt?: string;
}
export interface MatchResponse {
data: Match[];
}
export type ConnectionStatus = 'disconnected' | 'connecting' | 'connected' | 'reconnecting' | 'error';
export interface Commentary {
id: string | number;
matchId: string | number;
minute?: number;
sequence?: number;
period?: string;
eventType?: string;
actor?: string;
team?: string;
message: string;
metadata?: Record<string, unknown>;
tags?: string[];
createdAt?: string;
}
export interface CommentaryResponse {
data: Commentary[];
}
// WebSocket Message Types
export interface WSMessageCommentary {
type: 'commentary';
data: Commentary;
}
export interface WSMessageScore {
type: 'score_update';
matchId: string | number;
data: {
homeScore: number;
awayScore: number;
};
}
export interface WSMessageWelcome {
type: 'welcome';
message?: string;
}
export interface WSMessagePong {
type: 'pong';
}
export interface WSMessageError {
type: 'error';
code: string;
message: string;
}
export interface WSMessageSubscribed {
type: 'subscribed';
matchId: string | number;
}
export interface WSMessageUnsubscribed {
type: 'unsubscribed';
matchId: string | number;
}
export interface WSMessageSubscriptions {
type: 'subscriptions';
matchIds: Array<string | number>;
}
export interface WSMessageSubscribedAll {
type: 'subscribed_all';
}
export interface WSMessageUnsubscribedAll {
type: 'unsubscribed_all';
}
export type WSMessage =
| WSMessageCommentary
| WSMessageScore
| WSMessageWelcome
| WSMessagePong
| WSMessageError
| WSMessageSubscribed
| WSMessageUnsubscribed
| WSMessageSubscriptions
| WSMessageSubscribedAll
| WSMessageUnsubscribedAll;