1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 02:39:33 +02:00

Extends the search feature by customizing the search field (name,

podUrl...)
This commit is contained in:
Chocobozzz 2016-05-22 09:15:00 +02:00
parent 68ce3ae021
commit 46246b5f19
8 changed files with 149 additions and 20 deletions

View file

@ -291,24 +291,31 @@ function runServer (number, callback) {
})
}
function searchVideo (url, search, end) {
const path = '/api/v1/videos'
function searchVideo (url, search, field, end) {
if (!end) {
end = field
field = null
}
request(url)
.get(path + '/search/' + search)
.set('Accept', 'application/json')
.expect(200)
.expect('Content-Type', /json/)
.end(end)
const path = '/api/v1/videos'
const req = request(url)
.get(path + '/search/' + search)
.set('Accept', 'application/json')
if (field) req.query({ field: field })
req.expect(200)
.expect('Content-Type', /json/)
.end(end)
}
function searchVideoWithPagination (url, search, start, count, end) {
function searchVideoWithPagination (url, search, field, start, count, end) {
const path = '/api/v1/videos'
request(url)
.get(path + '/search/' + search)
.query({ start: start })
.query({ count: count })
.query({ field: field })
.set('Accept', 'application/json')
.expect(200)
.expect('Content-Type', /json/)