Files
physical-expo/types/api.ts

290 lines
5.9 KiB
TypeScript

export interface Sport {
id: number;
name: string;
description: string;
icon: string;
isActive: boolean;
updatedAt: string;
createdAt: string;
}
export interface Match {
id: string;
league: string;
time: string;
home: string;
away: string;
meta?: string;
scoreText: string;
fav: boolean;
leagueId?: number;
sportId?: number;
isLive?: boolean;
}
export interface LiveScoreMatch {
event_key: number;
event_date: string;
event_time: string;
event_home_team: string;
home_team_key: number;
home_team_logo: string;
event_away_team: string;
away_team_key: number;
away_team_logo: string;
event_final_result: string;
event_halftime_result: string;
event_status: string;
event_live: string;
league_key: number;
league_name: string;
league_logo: string;
league_round: string;
league_season: string;
country_name: string;
country_logo: string;
event_country_key: number;
goalscorers?: {
time: string;
home_scorer: string;
home_scorer_id: string;
home_assist: string;
home_assist_id: string;
score: string;
away_scorer: string;
away_scorer_id: string;
away_assist: string;
away_assist_id: string;
info: string;
info_time: string;
}[];
cards?: {
time: string;
home_fault: string;
card: string;
away_fault: string;
info: string;
home_player_id: string;
away_player_id: string;
info_time: string;
}[];
substitutes?: {
time: string;
home_scorer:
| { in: string; out: string; in_id: number; out_id: number }
| any[];
away_scorer:
| { in: string; out: string; in_id: number; out_id: number }
| any[];
info: string;
info_time: string;
score: string;
}[];
lineups?: unknown;
statistics?: {
type: string;
home: string;
away: string;
}[];
}
export interface ApiResponse<T> {
code: number;
message: string;
data: T;
}
export interface ApiListResponse<T> {
list: T[];
total: number;
}
export interface Country {
id: number;
code: string;
name: string;
flagIcon: string;
createdAt: string;
updatedAt: string;
isActive: boolean;
}
export interface League {
id: number;
key: string;
name: string;
description: string;
sportId: number;
countryKey: string;
countryName: string;
countryLogo: string;
logo: string;
isActive: boolean;
createdAt: string;
updatedAt: string;
}
export interface GoalEvent {
time: string;
home_scorer?: string;
away_scorer?: string;
score?: string;
comment?: string;
}
export interface CardEvent {
time: string;
home_fault?: string;
away_fault?: string;
card?: string;
comment?: string;
}
export interface SubstituteEvent {
time: string;
home_scorer?: string;
away_scorer?: string;
home_assist?: string;
away_assist?: string;
home_scorer_out?: string;
away_scorer_out?: string;
comment?: string;
}
export interface MatchEvents {
goalscorers: GoalEvent[];
cards: CardEvent[];
substitutes: SubstituteEvent[];
}
export interface Player {
// AllSports API 常见字段
player?: string; // 有些接口用 player
player_name?: string; // 有些接口用 player_name
name?: string; // 兜底
player_number?: number | string;
number?: number | string;
player_type?: string; // 位置/角色,例如 Goalkeepers
position?: string; // 兜底位置字段
}
export interface UpcomingMatch {
id: number;
eventKey: string;
sportId: number;
leagueKey: string;
leagueName: string;
leagueLogo: string;
leagueGroup: string;
countryKey: string;
countryName: string;
countryLogo: string;
season: string;
round: string;
stageName: string;
eventDate: string;
eventTime: string;
status: string; // scheduled
venue: string;
referee: string;
homeTeamKey: string;
homeTeamName: string;
homeTeamLogo: string;
homeFormation: string;
homeScore: number;
homeHalfScore: number;
homeShots: number;
homeShotsOnTarget: number;
homePossession: number;
homeYellowCards: number;
homeRedCards: number;
awayTeamKey: string;
awayTeamName: string;
awayTeamLogo: string;
awayFormation: string;
awayScore: number;
awayHalfScore: number;
awayShots: number;
awayShotsOnTarget: number;
awayPossession: number;
awayYellowCards: number;
awayRedCards: number;
eventLive: boolean;
createdAt: string;
updatedAt: string;
}
export interface MatchDetailData {
events: any[];
match: {
ID: number;
CreatedAt: string;
UpdatedAt: string;
DeletedAt: string | null;
eventKey: string;
eventDate: string;
eventTime: string;
eventHomeTeam: string;
homeTeamKey: string;
homeTeamLogo: string;
eventAwayTeam: string;
awayTeamKey: string;
awayTeamLogo: string;
eventHalftimeResult: string;
eventFinalResult: string;
eventFtResult: string;
eventPenaltyResult: string;
eventStatus: string;
countryName: string;
leagueName: string;
leagueKey: string;
leagueRound: string;
leagueSeason: string;
eventLive: string;
eventStadium: string;
eventReferee: string;
eventCountryKey: string;
leagueLogo: string;
countryLogo: string;
eventHomeFormation: string;
eventAwayFormation: string;
fkStageKey: string;
stageName: string;
leagueGroup: string;
sportId: number;
eventQuarter: string;
eventSet: string;
eventType: string;
eventToss: string;
eventManOfMatch: string;
events?: MatchEvents;
players?: {
home_team?: Player[];
away_team?: Player[];
};
};
}
// 实时赔率数据项结构
export interface OddsItem {
odd_bookmakers: string;
odd_1?: number;
odd_x?: number;
odd_2?: number;
odd_12?: number;
odd_1x?: number;
odd_x2?: number;
"ah+1_1"?: number;
"ah+1_2"?: number;
"o+2.5"?: number;
"u+2.5"?: number;
[key: string]: any;
}
// 实时赔率响应数据结构
export interface OddsData {
[match_id: string]: {
data: OddsItem[];
};
}