aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/videos/video-history.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-08 16:21:42 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commit313228e9c3b5bcef5391228c9b949d05d32ad7bb (patch)
treed2f39a2bd32ef093224c594d72219809504321b7 /shared/extra-utils/videos/video-history.ts
parente6346d59e63135cf012ed18c102d3b0179ef565f (diff)
downloadPeerTube-313228e9c3b5bcef5391228c9b949d05d32ad7bb.tar.gz
PeerTube-313228e9c3b5bcef5391228c9b949d05d32ad7bb.tar.zst
PeerTube-313228e9c3b5bcef5391228c9b949d05d32ad7bb.zip
Introduce history command
Diffstat (limited to 'shared/extra-utils/videos/video-history.ts')
-rw-r--r--shared/extra-utils/videos/video-history.ts49
1 files changed, 0 insertions, 49 deletions
diff --git a/shared/extra-utils/videos/video-history.ts b/shared/extra-utils/videos/video-history.ts
deleted file mode 100644
index b989e14dc..000000000
--- a/shared/extra-utils/videos/video-history.ts
+++ /dev/null
@@ -1,49 +0,0 @@
1import { makeGetRequest, makePostBodyRequest, makePutBodyRequest } from '../requests/requests'
2import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
3
4function userWatchVideo (
5 url: string,
6 token: string,
7 videoId: number | string,
8 currentTime: number,
9 statusCodeExpected = HttpStatusCode.NO_CONTENT_204
10) {
11 const path = '/api/v1/videos/' + videoId + '/watching'
12 const fields = { currentTime }
13
14 return makePutBodyRequest({ url, path, token, fields, statusCodeExpected })
15}
16
17function listMyVideosHistory (url: string, token: string, search?: string) {
18 const path = '/api/v1/users/me/history/videos'
19
20 return makeGetRequest({
21 url,
22 path,
23 token,
24 query: {
25 search
26 },
27 statusCodeExpected: HttpStatusCode.OK_200
28 })
29}
30
31function removeMyVideosHistory (url: string, token: string, beforeDate?: string) {
32 const path = '/api/v1/users/me/history/videos/remove'
33
34 return makePostBodyRequest({
35 url,
36 path,
37 token,
38 fields: beforeDate ? { beforeDate } : {},
39 statusCodeExpected: HttpStatusCode.NO_CONTENT_204
40 })
41}
42
43// ---------------------------------------------------------------------------
44
45export {
46 userWatchVideo,
47 listMyVideosHistory,
48 removeMyVideosHistory
49}