47 lines
1.4 KiB
Python
47 lines
1.4 KiB
Python
"""Abstract notification template persistence API."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from abc import ABC, abstractmethod
|
|
from typing import Any
|
|
|
|
|
|
class NotificationTemplateStore(ABC):
|
|
@abstractmethod
|
|
async def list_templates(
|
|
self,
|
|
*,
|
|
keyword: str | None = None,
|
|
enabled: bool | None = None,
|
|
tag: str | None = None,
|
|
page: int = 1,
|
|
page_size: int = 20,
|
|
) -> dict[str, Any]:
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
async def get_template(self, template_id: str) -> dict[str, Any] | None:
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
async def create_template(self, data: dict[str, Any], *, created_by: str | None = None) -> dict[str, Any]:
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
async def update_template(
|
|
self, template_id: str, data: dict[str, Any], *, expected_version: int, updated_by: str | None = None
|
|
) -> dict[str, Any]:
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
async def delete_template(self, template_id: str) -> bool:
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
async def duplicate_template(self, template_id: str, *, created_by: str | None = None) -> dict[str, Any]:
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
async def name_exists(self, name: str, exclude_id: str | None = None) -> bool:
|
|
raise NotImplementedError
|