diff options
author | Chocobozzz <me@florianbigard.com> | 2021-10-19 09:44:43 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-10-20 09:25:44 +0200 |
commit | 4beda9e12adc7b1f3b178cecd6863ebf3cf431f1 (patch) | |
tree | 6244a10b286d66c6dcd7799aee630670d0493781 /shared/extra-utils/users | |
parent | 9593a78ae1368a9ad8bb11044fce6fde2892701a (diff) | |
download | PeerTube-4beda9e12adc7b1f3b178cecd6863ebf3cf431f1.tar.gz PeerTube-4beda9e12adc7b1f3b178cecd6863ebf3cf431f1.tar.zst PeerTube-4beda9e12adc7b1f3b178cecd6863ebf3cf431f1.zip |
Add ability to view my followers
Diffstat (limited to 'shared/extra-utils/users')
-rw-r--r-- | shared/extra-utils/users/accounts-command.ts | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/shared/extra-utils/users/accounts-command.ts b/shared/extra-utils/users/accounts-command.ts index 2f586104e..98d9d5927 100644 --- a/shared/extra-utils/users/accounts-command.ts +++ b/shared/extra-utils/users/accounts-command.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { HttpStatusCode, ResultList } from '@shared/models' | 1 | import { HttpStatusCode, ResultList } from '@shared/models' |
2 | import { Account } from '../../models/actors' | 2 | import { Account, ActorFollow } from '../../models/actors' |
3 | import { AccountVideoRate, VideoRateType } from '../../models/videos' | 3 | import { AccountVideoRate, VideoRateType } from '../../models/videos' |
4 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 4 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
5 | 5 | ||
@@ -53,4 +53,26 @@ export class AccountsCommand extends AbstractCommand { | |||
53 | defaultExpectedStatus: HttpStatusCode.OK_200 | 53 | defaultExpectedStatus: HttpStatusCode.OK_200 |
54 | }) | 54 | }) |
55 | } | 55 | } |
56 | |||
57 | listFollowers (options: OverrideCommandOptions & { | ||
58 | accountName: string | ||
59 | start?: number | ||
60 | count?: number | ||
61 | sort?: string | ||
62 | search?: string | ||
63 | }) { | ||
64 | const { accountName, start, count, sort, search } = options | ||
65 | const path = '/api/v1/accounts/' + accountName + '/followers' | ||
66 | |||
67 | const query = { start, count, sort, search } | ||
68 | |||
69 | return this.getRequestBody<ResultList<ActorFollow>>({ | ||
70 | ...options, | ||
71 | |||
72 | path, | ||
73 | query, | ||
74 | implicitToken: true, | ||
75 | defaultExpectedStatus: HttpStatusCode.OK_200 | ||
76 | }) | ||
77 | } | ||
56 | } | 78 | } |