1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-03 17:59:37 +02:00

Add ability to set start/end date to timeserie

This commit is contained in:
Chocobozzz 2022-04-07 10:53:35 +02:00 committed by Chocobozzz
parent ac907dc7c1
commit 901bcf5c18
12 changed files with 296 additions and 22 deletions

View file

@ -1,3 +1,4 @@
import { pick } from '@shared/core-utils'
import { HttpStatusCode, VideoStatsOverall, VideoStatsRetention, VideoStatsTimeserie, VideoStatsTimeserieMetric } from '@shared/models'
import { AbstractCommand, OverrideCommandOptions } from '../shared'
@ -20,6 +21,8 @@ export class VideoStatsCommand extends AbstractCommand {
getTimeserieStats (options: OverrideCommandOptions & {
videoId: number | string
metric: VideoStatsTimeserieMetric
startDate?: Date
endDate?: Date
}) {
const path = '/api/v1/videos/' + options.videoId + '/stats/timeseries/' + options.metric
@ -27,6 +30,7 @@ export class VideoStatsCommand extends AbstractCommand {
...options,
path,
query: pick(options, [ 'startDate', 'endDate' ]),
implicitToken: true,
defaultExpectedStatus: HttpStatusCode.OK_200
})