]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/extra-utils/users/accounts-command.ts
Add bin directory creation for parallel tests
[github/Chocobozzz/PeerTube.git] / shared / extra-utils / users / accounts-command.ts
index 4cd1d2158a793803c9ac23c46ea9cfeccda9bfcf..98d9d59271d3b0416a4b4e44d48000beaf9b1439 100644 (file)
@@ -1,6 +1,5 @@
-import { ResultList } from '@shared/models'
-import { HttpStatusCode } from '../../core-utils/miscs/http-error-codes'
-import { Account } from '../../models/actors'
+import { HttpStatusCode, ResultList } from '@shared/models'
+import { Account, ActorFollow } from '../../models/actors'
 import { AccountVideoRate, VideoRateType } from '../../models/videos'
 import { AbstractCommand, OverrideCommandOptions } from '../shared'
 
@@ -54,4 +53,26 @@ export class AccountsCommand extends AbstractCommand {
       defaultExpectedStatus: HttpStatusCode.OK_200
     })
   }
+
+  listFollowers (options: OverrideCommandOptions & {
+    accountName: string
+    start?: number
+    count?: number
+    sort?: string
+    search?: string
+  }) {
+    const { accountName, start, count, sort, search } = options
+    const path = '/api/v1/accounts/' + accountName + '/followers'
+
+    const query = { start, count, sort, search }
+
+    return this.getRequestBody<ResultList<ActorFollow>>({
+      ...options,
+
+      path,
+      query,
+      implicitToken: true,
+      defaultExpectedStatus: HttpStatusCode.OK_200
+    })
+  }
 }