aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/search/video-playlists.ts
blob: c22831df751a18542d550cb14f05cf9259020297 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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
}