aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/videos/channels-command.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-10-19 09:44:43 +0200
committerChocobozzz <me@florianbigard.com>2021-10-20 09:25:44 +0200
commit4beda9e12adc7b1f3b178cecd6863ebf3cf431f1 (patch)
tree6244a10b286d66c6dcd7799aee630670d0493781 /shared/extra-utils/videos/channels-command.ts
parent9593a78ae1368a9ad8bb11044fce6fde2892701a (diff)
downloadPeerTube-4beda9e12adc7b1f3b178cecd6863ebf3cf431f1.tar.gz
PeerTube-4beda9e12adc7b1f3b178cecd6863ebf3cf431f1.tar.zst
PeerTube-4beda9e12adc7b1f3b178cecd6863ebf3cf431f1.zip
Add ability to view my followers
Diffstat (limited to 'shared/extra-utils/videos/channels-command.ts')
-rw-r--r--shared/extra-utils/videos/channels-command.ts26
1 files changed, 24 insertions, 2 deletions
diff --git a/shared/extra-utils/videos/channels-command.ts b/shared/extra-utils/videos/channels-command.ts
index 255e1d62d..e406e570b 100644
--- a/shared/extra-utils/videos/channels-command.ts
+++ b/shared/extra-utils/videos/channels-command.ts
@@ -1,5 +1,5 @@
1import { pick } from '@shared/core-utils' 1import { pick } from '@shared/core-utils'
2import { HttpStatusCode, ResultList, VideoChannel, VideoChannelCreateResult } from '@shared/models' 2import { ActorFollow, HttpStatusCode, ResultList, VideoChannel, VideoChannelCreateResult } from '@shared/models'
3import { VideoChannelCreate } from '../../models/videos/channel/video-channel-create.model' 3import { VideoChannelCreate } from '../../models/videos/channel/video-channel-create.model'
4import { VideoChannelUpdate } from '../../models/videos/channel/video-channel-update.model' 4import { VideoChannelUpdate } from '../../models/videos/channel/video-channel-update.model'
5import { unwrapBody } from '../requests' 5import { unwrapBody } from '../requests'
@@ -47,7 +47,7 @@ export class ChannelsCommand extends AbstractCommand {
47 } 47 }
48 48
49 async create (options: OverrideCommandOptions & { 49 async create (options: OverrideCommandOptions & {
50 attributes: VideoChannelCreate 50 attributes: Partial<VideoChannelCreate>
51 }) { 51 }) {
52 const path = '/api/v1/video-channels/' 52 const path = '/api/v1/video-channels/'
53 53
@@ -153,4 +153,26 @@ export class ChannelsCommand extends AbstractCommand {
153 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204 153 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
154 }) 154 })
155 } 155 }
156
157 listFollowers (options: OverrideCommandOptions & {
158 channelName: string
159 start?: number
160 count?: number
161 sort?: string
162 search?: string
163 }) {
164 const { channelName, start, count, sort, search } = options
165 const path = '/api/v1/video-channels/' + channelName + '/followers'
166
167 const query = { start, count, sort, search }
168
169 return this.getRequestBody<ResultList<ActorFollow>>({
170 ...options,
171
172 path,
173 query,
174 implicitToken: true,
175 defaultExpectedStatus: HttpStatusCode.OK_200
176 })
177 }
156} 178}