import { HttpStatusCode, IHttp, IModify, IPersistence, IRead } from '@rocket.chat/apps-engine/definition/accessors';
import { ApiEndpoint, IApiEndpointInfo, IApiRequest, IApiResponse } from '@rocket.chat/apps-engine/definition/api';
export class Endpoint extends ApiEndpoint {
request: IApiRequest, endpoint: IApiEndpointInfo, read: IRead, modify: IModify, http: IHttp, persis: IPersistence,
): Promise<IApiResponse> {
const body = Object.entries(request.content)
.map(([key, value]) => `${key}: ${value}`)
const room = await read.getRoomReader().getByName('general');
status: HttpStatusCode.NOT_FOUND,
content: `Room "#general" could not be found`,
const messageBuilder = modify.getCreator().startMessage()
const messageId = await modify.getCreator().finish(messageBuilder);
return this.success(JSON.stringify({ messageId }));