aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/users/accounts.ts
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-12-07 14:32:36 +0100
committerGitHub <noreply@github.com>2020-12-07 14:32:36 +0100
commit2d53be0267acc49cda46707b885096193a1f4e9c (patch)
tree887061a34bc67f40acbb96a6278f9544bf83caeb /shared/extra-utils/users/accounts.ts
parentadc1f09c0dbd997f34028c1c82d1c118dc8ead80 (diff)
downloadPeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.tar.gz
PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.tar.zst
PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.zip
replace numbers with typed http status codes (#3409)
Diffstat (limited to 'shared/extra-utils/users/accounts.ts')
-rw-r--r--shared/extra-utils/users/accounts.ts13
1 files changed, 10 insertions, 3 deletions
diff --git a/shared/extra-utils/users/accounts.ts b/shared/extra-utils/users/accounts.ts
index f87706f6a..4ea7f1402 100644
--- a/shared/extra-utils/users/accounts.ts
+++ b/shared/extra-utils/users/accounts.ts
@@ -8,8 +8,9 @@ import { Account } from '../../models/actors'
8import { root } from '../miscs/miscs' 8import { root } from '../miscs/miscs'
9import { makeGetRequest } from '../requests/requests' 9import { makeGetRequest } from '../requests/requests'
10import { VideoRateType } from '../../models/videos' 10import { VideoRateType } from '../../models/videos'
11import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
11 12
12function getAccountsList (url: string, sort = '-createdAt', statusCodeExpected = 200) { 13function getAccountsList (url: string, sort = '-createdAt', statusCodeExpected = HttpStatusCode.OK_200) {
13 const path = '/api/v1/accounts' 14 const path = '/api/v1/accounts'
14 15
15 return makeGetRequest({ 16 return makeGetRequest({
@@ -20,7 +21,7 @@ function getAccountsList (url: string, sort = '-createdAt', statusCodeExpected =
20 }) 21 })
21} 22}
22 23
23function getAccount (url: string, accountName: string, statusCodeExpected = 200) { 24function getAccount (url: string, accountName: string, statusCodeExpected = HttpStatusCode.OK_200) {
24 const path = '/api/v1/accounts/' + accountName 25 const path = '/api/v1/accounts/' + accountName
25 26
26 return makeGetRequest({ 27 return makeGetRequest({
@@ -55,7 +56,13 @@ async function checkActorFilesWereRemoved (filename: string, serverNumber: numbe
55 } 56 }
56} 57}
57 58
58function getAccountRatings (url: string, accountName: string, accessToken: string, rating?: VideoRateType, statusCodeExpected = 200) { 59function getAccountRatings (
60 url: string,
61 accountName: string,
62 accessToken: string,
63 rating?: VideoRateType,
64 statusCodeExpected = HttpStatusCode.OK_200
65) {
59 const path = '/api/v1/accounts/' + accountName + '/ratings' 66 const path = '/api/v1/accounts/' + accountName + '/ratings'
60 67
61 const query = rating ? { rating } : {} 68 const query = rating ? { rating } : {}