1 import { HttpStatusCode, ResultList } from '@shared/models'
2 import { Account } from '../../models/actors'
3 import { AccountVideoRate, VideoRateType } from '../../models/videos'
4 import { AbstractCommand, OverrideCommandOptions } from '../shared'
6 export class AccountsCommand extends AbstractCommand {
8 list (options: OverrideCommandOptions & {
9 sort?: string // default -createdAt
11 const { sort = '-createdAt' } = options
12 const path = '/api/v1/accounts'
14 return this.getRequestBody<ResultList<Account>>({
20 defaultExpectedStatus: HttpStatusCode.OK_200
24 get (options: OverrideCommandOptions & {
27 const path = '/api/v1/accounts/' + options.accountName
29 return this.getRequestBody<Account>({
34 defaultExpectedStatus: HttpStatusCode.OK_200
38 listRatings (options: OverrideCommandOptions & {
40 rating?: VideoRateType
42 const { rating, accountName } = options
43 const path = '/api/v1/accounts/' + accountName + '/ratings'
45 const query = { rating }
47 return this.getRequestBody<ResultList<AccountVideoRate>>({
53 defaultExpectedStatus: HttpStatusCode.OK_200