video-channels.ts 904 B

123456789101112131415161718192021222324252627282930313233343536
  1. import { VideoChannelsSearchQuery } from '@shared/models'
  2. import { makeGetRequest } from '../requests/requests'
  3. import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
  4. function searchVideoChannel (url: string, search: string, token?: string, statusCodeExpected = HttpStatusCode.OK_200) {
  5. const path = '/api/v1/search/video-channels'
  6. return makeGetRequest({
  7. url,
  8. path,
  9. query: {
  10. sort: '-createdAt',
  11. search
  12. },
  13. token,
  14. statusCodeExpected
  15. })
  16. }
  17. function advancedVideoChannelSearch (url: string, search: VideoChannelsSearchQuery) {
  18. const path = '/api/v1/search/video-channels'
  19. return makeGetRequest({
  20. url,
  21. path,
  22. query: search,
  23. statusCodeExpected: HttpStatusCode.OK_200
  24. })
  25. }
  26. // ---------------------------------------------------------------------------
  27. export {
  28. searchVideoChannel,
  29. advancedVideoChannelSearch
  30. }