1 import { HttpStatusCode, VideoStatsOverall, VideoStatsRetention, VideoStatsTimeserie, VideoStatsTimeserieMetric } from '@shared/models'
2 import { AbstractCommand, OverrideCommandOptions } from '../shared'
4 export class VideoStatsCommand extends AbstractCommand {
6 getOverallStats (options: OverrideCommandOptions & {
7 videoId: number | string
9 const path = '/api/v1/videos/' + options.videoId + '/stats/overall'
11 return this.getRequestBody<VideoStatsOverall>({
16 defaultExpectedStatus: HttpStatusCode.OK_200
20 getTimeserieStats (options: OverrideCommandOptions & {
21 videoId: number | string
22 metric: VideoStatsTimeserieMetric
24 const path = '/api/v1/videos/' + options.videoId + '/stats/timeseries/' + options.metric
26 return this.getRequestBody<VideoStatsTimeserie>({
31 defaultExpectedStatus: HttpStatusCode.OK_200
35 getRetentionStats (options: OverrideCommandOptions & {
36 videoId: number | string
38 const path = '/api/v1/videos/' + options.videoId + '/stats/retention'
40 return this.getRequestBody<VideoStatsRetention>({
45 defaultExpectedStatus: HttpStatusCode.OK_200