diff options
author | Chocobozzz <me@florianbigard.com> | 2019-05-29 15:09:38 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-05-29 15:09:38 +0200 |
commit | 91b6631984fa7097bd60aa013d1cf041d7b95f58 (patch) | |
tree | 717cc94c3cba7b02ba404f2536ebc76118adf504 /shared/extra-utils/videos | |
parent | b247a132709eb212fef4f77c4912dc0ec108f36b (diff) | |
download | PeerTube-91b6631984fa7097bd60aa013d1cf041d7b95f58.tar.gz PeerTube-91b6631984fa7097bd60aa013d1cf041d7b95f58.tar.zst PeerTube-91b6631984fa7097bd60aa013d1cf041d7b95f58.zip |
Add pagination to account video channels endpoint
Diffstat (limited to 'shared/extra-utils/videos')
-rw-r--r-- | shared/extra-utils/videos/video-channels.ts | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/shared/extra-utils/videos/video-channels.ts b/shared/extra-utils/videos/video-channels.ts index 93a257bf9..b4755b486 100644 --- a/shared/extra-utils/videos/video-channels.ts +++ b/shared/extra-utils/videos/video-channels.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import * as request from 'supertest' | 1 | import * as request from 'supertest' |
2 | import { VideoChannelCreate, VideoChannelUpdate } from '../../models/videos' | 2 | import { VideoChannelCreate, VideoChannelUpdate } from '../../models/videos' |
3 | import { updateAvatarRequest } from '../requests/requests' | 3 | import { makeGetRequest, updateAvatarRequest } from '../requests/requests' |
4 | import { getMyUserInformation, ServerInfo } from '..' | 4 | import { getMyUserInformation, ServerInfo } from '..' |
5 | import { User } from '../..' | 5 | import { User } from '../..' |
6 | 6 | ||
@@ -19,14 +19,28 @@ function getVideoChannelsList (url: string, start: number, count: number, sort?: | |||
19 | .expect('Content-Type', /json/) | 19 | .expect('Content-Type', /json/) |
20 | } | 20 | } |
21 | 21 | ||
22 | function getAccountVideoChannelsList (url: string, accountName: string, specialStatus = 200) { | 22 | function getAccountVideoChannelsList (parameters: { |
23 | url: string, | ||
24 | accountName: string, | ||
25 | start?: number, | ||
26 | count?: number, | ||
27 | sort?: string, | ||
28 | specialStatus?: number | ||
29 | }) { | ||
30 | const { url, accountName, start, count, sort = 'createdAt', specialStatus = 200 } = parameters | ||
31 | |||
23 | const path = '/api/v1/accounts/' + accountName + '/video-channels' | 32 | const path = '/api/v1/accounts/' + accountName + '/video-channels' |
24 | 33 | ||
25 | return request(url) | 34 | return makeGetRequest({ |
26 | .get(path) | 35 | url, |
27 | .set('Accept', 'application/json') | 36 | path, |
28 | .expect(specialStatus) | 37 | query: { |
29 | .expect('Content-Type', /json/) | 38 | start, |
39 | count, | ||
40 | sort | ||
41 | }, | ||
42 | statusCodeExpected: specialStatus | ||
43 | }) | ||
30 | } | 44 | } |
31 | 45 | ||
32 | function addVideoChannel ( | 46 | function addVideoChannel ( |