1 import { HttpStatusCode } from '@shared/models'
2 import { ResultList, Video } from '@shared/models'
3 import { AbstractCommand, OverrideCommandOptions } from '../shared'
5 export class HistoryCommand extends AbstractCommand {
7 wathVideo (options: OverrideCommandOptions & {
8 videoId: number | string
11 const { videoId, currentTime } = options
13 const path = '/api/v1/videos/' + videoId + '/watching'
14 const fields = { currentTime }
16 return this.putBodyRequest({
22 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
26 list (options: OverrideCommandOptions & {
29 const { search } = options
30 const path = '/api/v1/users/me/history/videos'
32 return this.getRequestBody<ResultList<Video>>({
40 defaultExpectedStatus: HttpStatusCode.OK_200
44 remove (options: OverrideCommandOptions & {
47 const { beforeDate } = options
48 const path = '/api/v1/users/me/history/videos/remove'
50 return this.postBodyRequest({
54 fields: { beforeDate },
56 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204