]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/extra-utils/search/videos.ts
Share playlists state
[github/Chocobozzz/PeerTube.git] / shared / extra-utils / search / videos.ts
index ba46270175f45edc395deb80a450b38c9f83897a..da806e692082f2269a6ef94b3c18b076847325f8 100644 (file)
@@ -6,9 +6,11 @@ import { immutableAssign } from '../miscs/miscs'
 
 function searchVideo (url: string, search: string) {
   const path = '/api/v1/search/videos'
+
+  const query = { sort: '-publishedAt', search: search }
   const req = request(url)
     .get(path)
-    .query({ sort: '-publishedAt', search })
+    .query(query)
     .set('Accept', 'application/json')
 
   return req.expect(200)
@@ -27,29 +29,14 @@ function searchVideoWithToken (url: string, search: string, token: string, query
             .expect('Content-Type', /json/)
 }
 
-function searchVideoWithPagination (url: string, search: string, start: number, count: number, sort?: string) {
-  const path = '/api/v1/search/videos'
-
-  const req = request(url)
-    .get(path)
-    .query({ start })
-    .query({ search })
-    .query({ count })
-
-  if (sort) req.query({ sort })
-
-  return req.set('Accept', 'application/json')
-            .expect(200)
-            .expect('Content-Type', /json/)
-}
-
 function searchVideoWithSort (url: string, search: string, sort: string) {
   const path = '/api/v1/search/videos'
 
+  const query = { search, sort }
+
   return request(url)
     .get(path)
-    .query({ search })
-    .query({ sort })
+    .query(query)
     .set('Accept', 'application/json')
     .expect(200)
     .expect('Content-Type', /json/)
@@ -72,6 +59,5 @@ export {
   searchVideo,
   advancedVideosSearch,
   searchVideoWithToken,
-  searchVideoWithPagination,
   searchVideoWithSort
 }