1 import { HttpStatusCode, ResultList, Video } from '@shared/models'
2 import { AbstractCommand, OverrideCommandOptions } from '../shared'
4 export class HistoryCommand extends AbstractCommand {
6 wathVideo (options: OverrideCommandOptions & {
7 videoId: number | string
10 const { videoId, currentTime } = options
12 const path = '/api/v1/videos/' + videoId + '/watching'
13 const fields = { currentTime }
15 return this.putBodyRequest({
21 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
25 list (options: OverrideCommandOptions & {
28 const { search } = options
29 const path = '/api/v1/users/me/history/videos'
31 return this.getRequestBody<ResultList<Video>>({
39 defaultExpectedStatus: HttpStatusCode.OK_200
43 remove (options: OverrideCommandOptions & {
46 const { beforeDate } = options
47 const path = '/api/v1/users/me/history/videos/remove'
49 return this.postBodyRequest({
53 fields: { beforeDate },
55 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204