diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-08 16:21:42 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:18 +0200 |
commit | 313228e9c3b5bcef5391228c9b949d05d32ad7bb (patch) | |
tree | d2f39a2bd32ef093224c594d72219809504321b7 /shared/extra-utils/videos/video-history.ts | |
parent | e6346d59e63135cf012ed18c102d3b0179ef565f (diff) | |
download | PeerTube-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.ts | 49 |
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 @@ | |||
1 | import { makeGetRequest, makePostBodyRequest, makePutBodyRequest } from '../requests/requests' | ||
2 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
3 | |||
4 | function 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 | |||
17 | function 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 | |||
31 | function 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 | |||
45 | export { | ||
46 | userWatchVideo, | ||
47 | listMyVideosHistory, | ||
48 | removeMyVideosHistory | ||
49 | } | ||