From 37a44fc915eef2140e22ceb96aba6b6eb2509007 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 17 Jun 2021 16:02:38 +0200 Subject: Add ability to search playlists --- shared/extra-utils/search/video-playlists.ts | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 shared/extra-utils/search/video-playlists.ts (limited to 'shared/extra-utils/search/video-playlists.ts') diff --git a/shared/extra-utils/search/video-playlists.ts b/shared/extra-utils/search/video-playlists.ts new file mode 100644 index 000000000..c22831df7 --- /dev/null +++ b/shared/extra-utils/search/video-playlists.ts @@ -0,0 +1,36 @@ +import { VideoPlaylistsSearchQuery } from '@shared/models' +import { HttpStatusCode } from '../../core-utils/miscs/http-error-codes' +import { makeGetRequest } from '../requests/requests' + +function searchVideoPlaylists (url: string, search: string, token?: string, statusCodeExpected = HttpStatusCode.OK_200) { + const path = '/api/v1/search/video-playlists' + + return makeGetRequest({ + url, + path, + query: { + sort: '-createdAt', + search + }, + token, + statusCodeExpected + }) +} + +function advancedVideoPlaylistSearch (url: string, search: VideoPlaylistsSearchQuery) { + const path = '/api/v1/search/video-playlists' + + return makeGetRequest({ + url, + path, + query: search, + statusCodeExpected: HttpStatusCode.OK_200 + }) +} + +// --------------------------------------------------------------------------- + +export { + searchVideoPlaylists, + advancedVideoPlaylistSearch +} -- cgit v1.2.3