6 VideoChannelsSearchQuery,
8 VideoPlaylistsSearchQuery,
10 } from '@shared/models'
11 import { AbstractCommand, OverrideCommandOptions } from '../shared'
13 export class SearchCommand extends AbstractCommand {
15 searchChannels (options: OverrideCommandOptions & {
18 return this.advancedChannelSearch({
21 search: { search: options.search }
25 advancedChannelSearch (options: OverrideCommandOptions & {
26 search: VideoChannelsSearchQuery
28 const { search } = options
29 const path = '/api/v1/search/video-channels'
31 return this.getRequestBody<ResultList<VideoChannel>>({
37 defaultExpectedStatus: HttpStatusCode.OK_200
41 searchPlaylists (options: OverrideCommandOptions & {
44 return this.advancedPlaylistSearch({
47 search: { search: options.search }
51 advancedPlaylistSearch (options: OverrideCommandOptions & {
52 search: VideoPlaylistsSearchQuery
54 const { search } = options
55 const path = '/api/v1/search/video-playlists'
57 return this.getRequestBody<ResultList<VideoPlaylist>>({
63 defaultExpectedStatus: HttpStatusCode.OK_200
67 searchVideos (options: OverrideCommandOptions & {
71 const { search, sort } = options
73 return this.advancedVideoSearch({
78 sort: sort ?? '-publishedAt'
83 advancedVideoSearch (options: OverrideCommandOptions & {
84 search: VideosSearchQuery
86 const { search } = options
87 const path = '/api/v1/search/videos'
89 return this.getRequestBody<ResultList<Video>>({
95 defaultExpectedStatus: HttpStatusCode.OK_200