]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/extra-utils/users/blocklist-command.ts
Add mute status in account and channel pages
[github/Chocobozzz/PeerTube.git] / shared / extra-utils / users / blocklist-command.ts
index 089b5a5791d10b1231c7c72c2a5293045a54bd29..2e7ed074dc3f36df77d6d42df5238fc6d75eef67 100644 (file)
@@ -1,7 +1,6 @@
 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
-import { HttpStatusCode } from '@shared/core-utils'
-import { AccountBlock, ResultList, ServerBlock } from '@shared/models'
+import { AccountBlock, BlockStatus, HttpStatusCode, ResultList, ServerBlock } from '@shared/models'
 import { AbstractCommand, OverrideCommandOptions } from '../shared'
 
 type ListBlocklistOptions = OverrideCommandOptions & {
@@ -38,6 +37,29 @@ export class BlocklistCommand extends AbstractCommand {
 
   // ---------------------------------------------------------------------------
 
+  getStatus (options: OverrideCommandOptions & {
+    accounts?: string[]
+    hosts?: string[]
+  }) {
+    const { accounts, hosts } = options
+
+    const path = '/api/v1/blocklist/status'
+
+    return this.getRequestBody<BlockStatus>({
+      ...options,
+
+      path,
+      query: {
+        accounts,
+        hosts
+      },
+      implicitToken: false,
+      defaultExpectedStatus: HttpStatusCode.OK_200
+    })
+  }
+
+  // ---------------------------------------------------------------------------
+
   addToMyBlocklist (options: OverrideCommandOptions & {
     account?: string
     server?: string