diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-17 16:02:38 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-06-25 14:44:01 +0200 |
commit | 37a44fc915eef2140e22ceb96aba6b6eb2509007 (patch) | |
tree | dd4a370ecc96cf38c99b940261aadc27065da7ae /shared/extra-utils | |
parent | 33eb19e5199cc9fa4d73c6675c97508e3e072ef9 (diff) | |
download | PeerTube-37a44fc915eef2140e22ceb96aba6b6eb2509007.tar.gz PeerTube-37a44fc915eef2140e22ceb96aba6b6eb2509007.tar.zst PeerTube-37a44fc915eef2140e22ceb96aba6b6eb2509007.zip |
Add ability to search playlists
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 | } | ||