aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/custom-pages/custom-pages-command.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-06 10:22:37 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:16 +0200
commitf59545d97a80bf06025bf6343a80d834c7eb237f (patch)
tree7ed34f26b94964e8e707504da5fb90ff9d7486ad /shared/extra-utils/custom-pages/custom-pages-command.ts
parentc1bc8ee4783d6ce3102524e6c2a02b2f0f6aab6d (diff)
downloadPeerTube-f59545d97a80bf06025bf6343a80d834c7eb237f.tar.gz
PeerTube-f59545d97a80bf06025bf6343a80d834c7eb237f.tar.zst
PeerTube-f59545d97a80bf06025bf6343a80d834c7eb237f.zip
Rename command files
Diffstat (limited to 'shared/extra-utils/custom-pages/custom-pages-command.ts')
-rw-r--r--shared/extra-utils/custom-pages/custom-pages-command.ts30
1 files changed, 30 insertions, 0 deletions
diff --git a/shared/extra-utils/custom-pages/custom-pages-command.ts b/shared/extra-utils/custom-pages/custom-pages-command.ts
new file mode 100644
index 000000000..a062c9774
--- /dev/null
+++ b/shared/extra-utils/custom-pages/custom-pages-command.ts
@@ -0,0 +1,30 @@
1import { CustomPage } from '@shared/models'
2import { HttpStatusCode } from '../../core-utils/miscs/http-error-codes'
3import { AbstractCommand, OverrideCommandOptions } from '../shared'
4
5export class CustomPagesCommand extends AbstractCommand {
6
7 getInstanceHomepage (options: OverrideCommandOptions = {}) {
8 const path = '/api/v1/custom-pages/homepage/instance'
9
10 return this.getRequestBody<CustomPage>({
11 ...options,
12 path,
13 defaultExpectedStatus: HttpStatusCode.OK_200
14 })
15 }
16
17 updateInstanceHomepage (options: OverrideCommandOptions & {
18 content: string
19 }) {
20 const { content } = options
21 const path = '/api/v1/custom-pages/homepage/instance'
22
23 return this.putBodyRequest({
24 ...options,
25 path,
26 fields: { content },
27 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
28 })
29 }
30}