aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/server-commands/server/contact-form-command.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-12-17 09:29:23 +0100
committerChocobozzz <me@florianbigard.com>2021-12-17 09:29:23 +0100
commitbf54587a3e2ad9c2c186828f2a5682b91ee2cc00 (patch)
tree54b40aaf01bae210632473285c3c7571d51e4f89 /shared/server-commands/server/contact-form-command.ts
parent6b5f72beda96d8b7e4d6329c4001827334de27dd (diff)
downloadPeerTube-bf54587a3e2ad9c2c186828f2a5682b91ee2cc00.tar.gz
PeerTube-bf54587a3e2ad9c2c186828f2a5682b91ee2cc00.tar.zst
PeerTube-bf54587a3e2ad9c2c186828f2a5682b91ee2cc00.zip
shared/ typescript types dir server-commands
Diffstat (limited to 'shared/server-commands/server/contact-form-command.ts')
-rw-r--r--shared/server-commands/server/contact-form-command.ts31
1 files changed, 31 insertions, 0 deletions
diff --git a/shared/server-commands/server/contact-form-command.ts b/shared/server-commands/server/contact-form-command.ts
new file mode 100644
index 000000000..0e8fd6d84
--- /dev/null
+++ b/shared/server-commands/server/contact-form-command.ts
@@ -0,0 +1,31 @@
1import { HttpStatusCode } from '@shared/models'
2import { ContactForm } from '../../models/server'
3import { AbstractCommand, OverrideCommandOptions } from '../shared'
4
5export class ContactFormCommand extends AbstractCommand {
6
7 send (options: OverrideCommandOptions & {
8 fromEmail: string
9 fromName: string
10 subject: string
11 body: string
12 }) {
13 const path = '/api/v1/server/contact'
14
15 const body: ContactForm = {
16 fromEmail: options.fromEmail,
17 fromName: options.fromName,
18 subject: options.subject,
19 body: options.body
20 }
21
22 return this.postBodyRequest({
23 ...options,
24
25 path,
26 fields: body,
27 implicitToken: false,
28 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
29 })
30 }
31}