2020-06-10 10:58:44 +02:00
|
|
|
import { VideoChannelsSearchQuery } from '@shared/models'
|
2018-08-24 11:04:02 +02:00
|
|
|
import { makeGetRequest } from '../requests/requests'
|
2020-12-07 14:32:36 +01:00
|
|
|
import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
|
2018-08-24 11:04:02 +02:00
|
|
|
|
2020-12-07 14:32:36 +01:00
|
|
|
function searchVideoChannel (url: string, search: string, token?: string, statusCodeExpected = HttpStatusCode.OK_200) {
|
2018-08-24 11:04:02 +02:00
|
|
|
const path = '/api/v1/search/video-channels'
|
|
|
|
|
|
|
|
return makeGetRequest({
|
|
|
|
url,
|
|
|
|
path,
|
|
|
|
query: {
|
|
|
|
sort: '-createdAt',
|
|
|
|
search
|
|
|
|
},
|
|
|
|
token,
|
|
|
|
statusCodeExpected
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-06-10 10:58:44 +02:00
|
|
|
function advancedVideoChannelSearch (url: string, search: VideoChannelsSearchQuery) {
|
|
|
|
const path = '/api/v1/search/video-channels'
|
|
|
|
|
|
|
|
return makeGetRequest({
|
|
|
|
url,
|
|
|
|
path,
|
|
|
|
query: search,
|
2020-12-07 14:32:36 +01:00
|
|
|
statusCodeExpected: HttpStatusCode.OK_200
|
2020-06-10 10:58:44 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2018-08-24 11:04:02 +02:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
export {
|
2020-06-10 10:58:44 +02:00
|
|
|
searchVideoChannel,
|
|
|
|
advancedVideoChannelSearch
|
2018-08-24 11:04:02 +02:00
|
|
|
}
|