diff options
author | Chocobozzz <me@florianbigard.com> | 2021-05-03 11:06:19 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-05-03 16:42:15 +0200 |
commit | 1fd61899eaea245a5844e33e21f04b2562f16e5e (patch) | |
tree | 2a1d51b37b12219cade35e189d62686cd0fec105 /shared/extra-utils/videos | |
parent | dfcb6f50a607b6b402b4f8fa3d43792d61c912a5 (diff) | |
download | PeerTube-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')
-rw-r--r-- | shared/extra-utils/videos/videos.ts | 16 |
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' | |||
8 | import { v4 as uuidv4 } from 'uuid' | 8 | import { v4 as uuidv4 } from 'uuid' |
9 | import validator from 'validator' | 9 | import validator from 'validator' |
10 | import { HttpStatusCode } from '@shared/core-utils' | 10 | import { HttpStatusCode } from '@shared/core-utils' |
11 | import { VideosCommonQuery } from '@shared/models' | ||
11 | import { loadLanguages, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } from '../../../server/initializers/constants' | 12 | import { loadLanguages, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } from '../../../server/initializers/constants' |
12 | import { VideoDetails, VideoPrivacy } from '../../models/videos' | 13 | import { VideoDetails, VideoPrivacy } from '../../models/videos' |
13 | import { | 14 | import { |
@@ -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 | ||
199 | function 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 | |||
198 | function getAccountVideos ( | 211 | function 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 | ||
298 | function getVideosWithFilters (url: string, query: { tagsAllOf: string[], categoryOneOf: number[] | number }) { | 311 | function 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 |