2024-04-22 10:22:18 +02:00
|
|
|
namespace _espe.api
|
2024-04-22 10:02:34 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
export function register_email(
|
|
|
|
rest_subject : lib_plankton.rest.type_rest
|
|
|
|
) : void
|
|
|
|
{
|
|
|
|
lib_plankton.rest.register<
|
|
|
|
{
|
|
|
|
receivers : Array<string>;
|
|
|
|
subject : string;
|
|
|
|
content : string;
|
|
|
|
},
|
|
|
|
null
|
|
|
|
>(
|
|
|
|
rest_subject,
|
|
|
|
lib_plankton.http.enum_method.post,
|
|
|
|
"/email",
|
|
|
|
{
|
|
|
|
"description": "sendet eine E-Mail",
|
|
|
|
"input_schema": () => ({
|
|
|
|
"type": "object",
|
|
|
|
"nullable": false,
|
|
|
|
"properties": {
|
|
|
|
"receivers": {
|
|
|
|
"type": "array",
|
|
|
|
"nullable": false,
|
|
|
|
"items": {
|
|
|
|
"type": "string",
|
|
|
|
"nullable": false,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"subject": {
|
|
|
|
"type": "string",
|
|
|
|
"nullable": false,
|
|
|
|
},
|
|
|
|
"content": {
|
|
|
|
"type": "string",
|
|
|
|
"nullable": false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"additionalProperties": false,
|
|
|
|
"required": [
|
|
|
|
"receivers",
|
|
|
|
"subject",
|
|
|
|
"content",
|
|
|
|
]
|
|
|
|
}),
|
|
|
|
"output_schema": () => ({
|
|
|
|
"nullable": true,
|
|
|
|
}),
|
|
|
|
"restriction": restriction_logged_in,
|
|
|
|
"execution": async ({"input": input}) => {
|
2024-04-22 10:22:18 +02:00
|
|
|
await _espe.helpers.email_send(
|
2024-04-22 10:02:34 +02:00
|
|
|
input.receivers,
|
|
|
|
input.subject,
|
|
|
|
input.content
|
|
|
|
);
|
|
|
|
return Promise.resolve({
|
|
|
|
"status_code": 200,
|
|
|
|
"data": null,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|