2022-07-02 16:00:54 +02:00
|
|
|
from enum import Enum
|
|
|
|
|
|
|
|
|
|
|
|
class NotificationType(str, Enum):
|
2023-05-20 13:10:12 +02:00
|
|
|
"""Enumerate notification types."""
|
|
|
|
{% for provider in notification_providers %}
|
|
|
|
{{ provider.upper().replace(".", "_") }} = "{{ provider }}"
|
|
|
|
"""{{ notification_providers[provider]["title"] }}"""
|
|
|
|
{% endfor %}
|
2022-07-02 16:00:54 +02:00
|
|
|
|
|
|
|
notification_provider_options = {
|
2023-05-20 13:10:12 +02:00
|
|
|
{%- for provider in notification_providers %}
|
|
|
|
NotificationType.{{ provider.upper().replace(".", "_") }}: dict(
|
|
|
|
{%- for input_name in notification_providers[provider]["inputs"] %}
|
|
|
|
{%- set input = notification_providers[provider]["inputs"][input_name] %}
|
|
|
|
{{ input_name }}=dict(type="{{ input["type"] }}", required={{ input["required"] }}),
|
2022-07-02 16:00:54 +02:00
|
|
|
{%- endfor %}
|
2023-05-20 13:10:12 +02:00
|
|
|
),
|
2022-07-02 16:00:54 +02:00
|
|
|
{%- endfor %}
|
|
|
|
}
|
|
|
|
|
2023-05-20 13:10:12 +02:00
|
|
|
notification_provider_conditions = dict(
|
2022-09-07 13:04:16 +02:00
|
|
|
{%- for provider in notification_provider_conditions %}
|
2023-05-20 13:10:12 +02:00
|
|
|
{{ provider }}=dict(
|
2022-09-07 13:04:16 +02:00
|
|
|
{%- for key, value in notification_provider_conditions[provider].items() %}
|
2023-05-20 13:10:12 +02:00
|
|
|
{{ key }}={{ value }},
|
2022-09-07 13:04:16 +02:00
|
|
|
{%- endfor %}
|
2023-05-20 13:10:12 +02:00
|
|
|
),
|
2022-09-07 13:04:16 +02:00
|
|
|
{%- endfor %}
|
2023-05-20 13:10:12 +02:00
|
|
|
)
|
2022-09-07 13:04:16 +02:00
|
|
|
|