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.
57 lines
1006 B
57 lines
1006 B
import { STATS_API_URL } from 'config'
|
|
|
|
import { callApi } from 'helpers'
|
|
|
|
import { Episodes } from './getMatchPlaylists'
|
|
|
|
type Response = {
|
|
data?: Episodes,
|
|
error?: {
|
|
code: string,
|
|
message: string,
|
|
},
|
|
}
|
|
|
|
type GetStatsEventsArgs = {
|
|
matchId: number,
|
|
paramId: number,
|
|
period?: number,
|
|
playerId?: number,
|
|
second?: number,
|
|
sportType: number,
|
|
teamId: number,
|
|
}
|
|
|
|
export const getStatsEvents = async ({
|
|
matchId,
|
|
paramId,
|
|
period,
|
|
playerId,
|
|
second,
|
|
sportType,
|
|
teamId,
|
|
}: GetStatsEventsArgs) => {
|
|
const config = {
|
|
body: {
|
|
half: period,
|
|
match_id: matchId,
|
|
match_second: second,
|
|
offset_end: 6,
|
|
offset_start: 6,
|
|
option_id: 0,
|
|
param_id: paramId,
|
|
player_id: playerId,
|
|
sport_id: sportType,
|
|
team_id: teamId,
|
|
},
|
|
}
|
|
|
|
const response: Response = await callApi({
|
|
config,
|
|
url: `${STATS_API_URL}/video`,
|
|
})
|
|
|
|
if (response.error) Promise.reject(response)
|
|
|
|
return Promise.resolve(response.data || [])
|
|
}
|
|
|