diff options
Diffstat (limited to 'shared/extra-utils/videos/history-command.ts')
-rw-r--r-- | shared/extra-utils/videos/history-command.ts | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/shared/extra-utils/videos/history-command.ts b/shared/extra-utils/videos/history-command.ts deleted file mode 100644 index 13b7150c1..000000000 --- a/shared/extra-utils/videos/history-command.ts +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
1 | import { HttpStatusCode, ResultList, Video } from '@shared/models' | ||
2 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | ||
3 | |||
4 | export class HistoryCommand extends AbstractCommand { | ||
5 | |||
6 | wathVideo (options: OverrideCommandOptions & { | ||
7 | videoId: number | string | ||
8 | currentTime: number | ||
9 | }) { | ||
10 | const { videoId, currentTime } = options | ||
11 | |||
12 | const path = '/api/v1/videos/' + videoId + '/watching' | ||
13 | const fields = { currentTime } | ||
14 | |||
15 | return this.putBodyRequest({ | ||
16 | ...options, | ||
17 | |||
18 | path, | ||
19 | fields, | ||
20 | implicitToken: true, | ||
21 | defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204 | ||
22 | }) | ||
23 | } | ||
24 | |||
25 | list (options: OverrideCommandOptions & { | ||
26 | search?: string | ||
27 | } = {}) { | ||
28 | const { search } = options | ||
29 | const path = '/api/v1/users/me/history/videos' | ||
30 | |||
31 | return this.getRequestBody<ResultList<Video>>({ | ||
32 | ...options, | ||
33 | |||
34 | path, | ||
35 | query: { | ||
36 | search | ||
37 | }, | ||
38 | implicitToken: true, | ||
39 | defaultExpectedStatus: HttpStatusCode.OK_200 | ||
40 | }) | ||
41 | } | ||
42 | |||
43 | remove (options: OverrideCommandOptions & { | ||
44 | beforeDate?: string | ||
45 | } = {}) { | ||
46 | const { beforeDate } = options | ||
47 | const path = '/api/v1/users/me/history/videos/remove' | ||
48 | |||
49 | return this.postBodyRequest({ | ||
50 | ...options, | ||
51 | |||
52 | path, | ||
53 | fields: { beforeDate }, | ||
54 | implicitToken: true, | ||
55 | defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204 | ||
56 | }) | ||
57 | } | ||
58 | } | ||