aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/videos/videos.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-05-03 11:06:19 +0200
committerChocobozzz <me@florianbigard.com>2021-05-03 16:42:15 +0200
commit1fd61899eaea245a5844e33e21f04b2562f16e5e (patch)
tree2a1d51b37b12219cade35e189d62686cd0fec105 /shared/extra-utils/videos/videos.ts
parentdfcb6f50a607b6b402b4f8fa3d43792d61c912a5 (diff)
downloadPeerTube-1fd61899eaea245a5844e33e21f04b2562f16e5e.tar.gz
PeerTube-1fd61899eaea245a5844e33e21f04b2562f16e5e.tar.zst
PeerTube-1fd61899eaea245a5844e33e21f04b2562f16e5e.zip
Add ability to filter my videos by live
Diffstat (limited to 'shared/extra-utils/videos/videos.ts')
-rw-r--r--shared/extra-utils/videos/videos.ts16
1 files changed, 15 insertions, 1 deletions
diff --git a/shared/extra-utils/videos/videos.ts b/shared/extra-utils/videos/videos.ts
index 67fe82d41..a0143b0ef 100644
--- a/shared/extra-utils/videos/videos.ts
+++ b/shared/extra-utils/videos/videos.ts
@@ -8,6 +8,7 @@ import * as request from 'supertest'
8import { v4 as uuidv4 } from 'uuid' 8import { v4 as uuidv4 } from 'uuid'
9import validator from 'validator' 9import validator from 'validator'
10import { HttpStatusCode } from '@shared/core-utils' 10import { HttpStatusCode } from '@shared/core-utils'
11import { VideosCommonQuery } from '@shared/models'
11import { loadLanguages, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } from '../../../server/initializers/constants' 12import { loadLanguages, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } from '../../../server/initializers/constants'
12import { VideoDetails, VideoPrivacy } from '../../models/videos' 13import { VideoDetails, VideoPrivacy } from '../../models/videos'
13import { 14import {
@@ -195,6 +196,18 @@ function getMyVideos (url: string, accessToken: string, start: number, count: nu
195 .expect('Content-Type', /json/) 196 .expect('Content-Type', /json/)
196} 197}
197 198
199function getMyVideosWithFilter (url: string, accessToken: string, query: { isLive?: boolean }) {
200 const path = '/api/v1/users/me/videos'
201
202 return makeGetRequest({
203 url,
204 path,
205 token: accessToken,
206 query,
207 statusCodeExpected: HttpStatusCode.OK_200
208 })
209}
210
198function getAccountVideos ( 211function getAccountVideos (
199 url: string, 212 url: string,
200 accessToken: string, 213 accessToken: string,
@@ -295,7 +308,7 @@ function getVideosListSort (url: string, sort: string) {
295 .expect('Content-Type', /json/) 308 .expect('Content-Type', /json/)
296} 309}
297 310
298function getVideosWithFilters (url: string, query: { tagsAllOf: string[], categoryOneOf: number[] | number }) { 311function getVideosWithFilters (url: string, query: VideosCommonQuery) {
299 const path = '/api/v1/videos' 312 const path = '/api/v1/videos'
300 313
301 return request(url) 314 return request(url)
@@ -751,6 +764,7 @@ export {
751 completeVideoCheck, 764 completeVideoCheck,
752 checkVideoFilesWereRemoved, 765 checkVideoFilesWereRemoved,
753 getPlaylistVideos, 766 getPlaylistVideos,
767 getMyVideosWithFilter,
754 uploadVideoAndGetId, 768 uploadVideoAndGetId,
755 getLocalIdByUUID, 769 getLocalIdByUUID,
756 getVideoIdFromUUID 770 getVideoIdFromUUID