Files
physical-expo/types/api.ts
2026-01-13 17:13:40 +08:00

152 lines
3.0 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;
}
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 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[];
};
};
}