aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/server-commands/videos/video-stats-command.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-04-07 10:53:35 +0200
committerChocobozzz <chocobozzz@cpy.re>2022-04-15 09:49:35 +0200
commit901bcf5c188ea79350fecd499ad76460b866617b (patch)
tree1e79f26cc3f2b952371d31bfa9b94a2b150be38a /shared/server-commands/videos/video-stats-command.ts
parentac907dc7c158056e9b6a5cb58acd27df5c7c2670 (diff)
downloadPeerTube-901bcf5c188ea79350fecd499ad76460b866617b.tar.gz
PeerTube-901bcf5c188ea79350fecd499ad76460b866617b.tar.zst
PeerTube-901bcf5c188ea79350fecd499ad76460b866617b.zip
Add ability to set start/end date to timeserie
Diffstat (limited to 'shared/server-commands/videos/video-stats-command.ts')
-rw-r--r--shared/server-commands/videos/video-stats-command.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/shared/server-commands/videos/video-stats-command.ts b/shared/server-commands/videos/video-stats-command.ts
index 90f7ffeaf..bd4808f63 100644
--- a/shared/server-commands/videos/video-stats-command.ts
+++ b/shared/server-commands/videos/video-stats-command.ts
@@ -1,3 +1,4 @@
1import { pick } from '@shared/core-utils'
1import { HttpStatusCode, VideoStatsOverall, VideoStatsRetention, VideoStatsTimeserie, VideoStatsTimeserieMetric } from '@shared/models' 2import { HttpStatusCode, VideoStatsOverall, VideoStatsRetention, VideoStatsTimeserie, VideoStatsTimeserieMetric } from '@shared/models'
2import { AbstractCommand, OverrideCommandOptions } from '../shared' 3import { AbstractCommand, OverrideCommandOptions } from '../shared'
3 4
@@ -20,6 +21,8 @@ export class VideoStatsCommand extends AbstractCommand {
20 getTimeserieStats (options: OverrideCommandOptions & { 21 getTimeserieStats (options: OverrideCommandOptions & {
21 videoId: number | string 22 videoId: number | string
22 metric: VideoStatsTimeserieMetric 23 metric: VideoStatsTimeserieMetric
24 startDate?: Date
25 endDate?: Date
23 }) { 26 }) {
24 const path = '/api/v1/videos/' + options.videoId + '/stats/timeseries/' + options.metric 27 const path = '/api/v1/videos/' + options.videoId + '/stats/timeseries/' + options.metric
25 28
@@ -27,6 +30,7 @@ export class VideoStatsCommand extends AbstractCommand {
27 ...options, 30 ...options,
28 path, 31 path,
29 32
33 query: pick(options, [ 'startDate', 'endDate' ]),
30 implicitToken: true, 34 implicitToken: true,
31 defaultExpectedStatus: HttpStatusCode.OK_200 35 defaultExpectedStatus: HttpStatusCode.OK_200
32 }) 36 })