1
0
Fork 0
peertube/shared/server-commands/server/contact-form-command.ts
2021-12-17 09:29:23 +01:00

31 lines
751 B
TypeScript

import { HttpStatusCode } from '@shared/models'
import { ContactForm } from '../../models/server'
import { AbstractCommand, OverrideCommandOptions } from '../shared'
export class ContactFormCommand extends AbstractCommand {
send (options: OverrideCommandOptions & {
fromEmail: string
fromName: string
subject: string
body: string
}) {
const path = '/api/v1/server/contact'
const body: ContactForm = {
fromEmail: options.fromEmail,
fromName: options.fromName,
subject: options.subject,
body: options.body
}
return this.postBodyRequest({
...options,
path,
fields: body,
implicitToken: false,
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
})
}
}