You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.0 KiB
63 lines
1.0 KiB
import {
|
|
DATA_URL,
|
|
PROCEDURES,
|
|
} from 'config'
|
|
|
|
import { callApi } from 'helpers'
|
|
|
|
const proc = PROCEDURES.get_match_info
|
|
|
|
export type Team = {
|
|
abbrev_eng: string,
|
|
abbrev_rus: string,
|
|
id: number,
|
|
name_eng: string,
|
|
name_rus: string,
|
|
score: number,
|
|
}
|
|
|
|
export type VideoBound = {
|
|
e: string,
|
|
h: string,
|
|
s: string,
|
|
}
|
|
|
|
type VideoBounds = Array<VideoBound>
|
|
|
|
export type MatchInfo = {
|
|
access?: boolean,
|
|
calc: boolean,
|
|
country_id: number,
|
|
date: string,
|
|
has_video: boolean,
|
|
live: boolean,
|
|
playbackUrl?: string,
|
|
storage: boolean,
|
|
sub: boolean,
|
|
team1: Team,
|
|
team2: Team,
|
|
tournament: {
|
|
id: number,
|
|
name_eng: string,
|
|
name_rus: string,
|
|
},
|
|
video_bounds?: VideoBounds,
|
|
youtube_link?: string,
|
|
} | null
|
|
|
|
export const getMatchInfo = (sportId: number, matchId: number): Promise<MatchInfo> => {
|
|
const config = {
|
|
body: {
|
|
params: {
|
|
_p_match_id: matchId,
|
|
_p_sport: sportId,
|
|
},
|
|
proc,
|
|
},
|
|
}
|
|
|
|
return callApi({
|
|
config,
|
|
url: DATA_URL,
|
|
})
|
|
}
|
|
|