mirror of
https://github.com/Kozea/Radicale.git
synced 2025-08-01 18:18:31 +00:00
Code cleanup and refactoring
This commit is contained in:
parent
5253a464ab
commit
389a6b9906
5 changed files with 41 additions and 31 deletions
|
@ -1,4 +1,7 @@
|
|||
import json
|
||||
|
||||
from radicale import utils
|
||||
from enum import Enum
|
||||
|
||||
INTERNAL_TYPES = ("none", "rabbitmq")
|
||||
|
||||
|
@ -20,6 +23,21 @@ class BaseHook:
|
|||
"""
|
||||
self.configuration = configuration
|
||||
|
||||
def notify(self, content):
|
||||
def notify(self, notification_item):
|
||||
"""Upload a new or replace an existing item."""
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
class HookNotificationItemTypes(Enum):
|
||||
UPSERT = "upsert"
|
||||
DELETE = "delete"
|
||||
|
||||
|
||||
class HookNotificationItem:
|
||||
|
||||
def __init__(self, notification_item_type, content):
|
||||
self.type = notification_item_type.value
|
||||
self.content = content
|
||||
|
||||
def to_json(self):
|
||||
return json.dumps(self, default=lambda o: o.__dict__, sort_keys=True, indent=4)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue