munin/source/targets/_functions.ts

55 lines
1.3 KiB
TypeScript
Raw Normal View History

2025-04-25 12:50:13 +02:00
/*
This file is part of »munin«.
Copyright 2025 'Fenris Wolf' <fenris@folksprak.org>
»munin« is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
»munin« is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with »munin«. If not, see <http://www.gnu.org/licenses/>.
*/
namespace _munin.targets
{
/**
*/
export function factory(
description : {
kind : string,
data : any
}
) : _munin.type_target
{
switch (description.kind) {
default: {
throw (new Error("unhandled target kind: " + description.kind));
break;
}
2025-05-06 21:07:38 +02:00
case "email": {
return _munin.targets.email.implementation_target(
description.data as _munin.targets.email.type_parameters
);
break;
}
2025-04-25 12:50:13 +02:00
case "telegram_bot": {
return _munin.targets.telegram_bot.implementation_target(
description.data as _munin.targets.telegram_bot.type_parameters
);
2025-05-06 21:07:38 +02:00
break;
2025-04-25 12:50:13 +02:00
}
}
}
}