diff options
Diffstat (limited to 'shared/extra-utils')
-rw-r--r-- | shared/extra-utils/index.ts | 2 | ||||
-rw-r--r-- | shared/extra-utils/search/video-playlists.ts | 36 |
2 files changed, 38 insertions, 0 deletions
diff --git a/shared/extra-utils/index.ts b/shared/extra-utils/index.ts index 3bc09ead5..87ee8abba 100644 --- a/shared/extra-utils/index.ts +++ b/shared/extra-utils/index.ts | |||
@@ -19,6 +19,8 @@ export * from './plugins/mock-blocklist' | |||
19 | export * from './requests/check-api-params' | 19 | export * from './requests/check-api-params' |
20 | export * from './requests/requests' | 20 | export * from './requests/requests' |
21 | 21 | ||
22 | export * from './search/video-channels' | ||
23 | export * from './search/video-playlists' | ||
22 | export * from './search/videos' | 24 | export * from './search/videos' |
23 | 25 | ||
24 | export * from './server/activitypub' | 26 | export * from './server/activitypub' |
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 @@ | |||
1 | import { VideoPlaylistsSearchQuery } from '@shared/models' | ||
2 | import { HttpStatusCode } from '../../core-utils/miscs/http-error-codes' | ||
3 | import { makeGetRequest } from '../requests/requests' | ||
4 | |||
5 | function searchVideoPlaylists (url: string, search: string, token?: string, statusCodeExpected = HttpStatusCode.OK_200) { | ||
6 | const path = '/api/v1/search/video-playlists' | ||
7 | |||
8 | return makeGetRequest({ | ||
9 | url, | ||
10 | path, | ||
11 | query: { | ||
12 | sort: '-createdAt', | ||
13 | search | ||
14 | }, | ||
15 | token, | ||
16 | statusCodeExpected | ||
17 | }) | ||
18 | } | ||
19 | |||
20 | function advancedVideoPlaylistSearch (url: string, search: VideoPlaylistsSearchQuery) { | ||
21 | const path = '/api/v1/search/video-playlists' | ||
22 | |||
23 | return makeGetRequest({ | ||
24 | url, | ||
25 | path, | ||
26 | query: search, | ||
27 | statusCodeExpected: HttpStatusCode.OK_200 | ||
28 | }) | ||
29 | } | ||
30 | |||
31 | // --------------------------------------------------------------------------- | ||
32 | |||
33 | export { | ||
34 | searchVideoPlaylists, | ||
35 | advancedVideoPlaylistSearch | ||
36 | } | ||