src/pyams_notify/interfaces/__init__.py
changeset 0 f53281280c23
child 9 cfac2a5b97bc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_notify/interfaces/__init__.py	Thu Jun 02 15:52:52 2016 +0200
@@ -0,0 +1,70 @@
+#
+# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+
+__docformat__ = 'restructuredtext'
+
+
+# import standard library
+
+# import interfaces
+from zope.interface import Interface
+
+# import packages
+from zope.schema import TextLine, Text, Dict, Datetime
+
+from pyams_notify import _
+
+
+MEMCACHED_QUEUE_KEY = b'_PyAMS_notify_messages_queue_'
+
+
+class INotification(Interface):
+    """Notification interface"""
+
+    action = TextLine(title=_("Notification action"))
+
+    category = TextLine(title=_("Notification category"))
+
+    title = TextLine(title=_("Notification title"))
+
+    message = Text(title=_("Notification message"))
+
+    source = Dict(title=_("Notification source"),
+                  description=_("Attributes of the principal which emitted the notification"),
+                  key_type=TextLine(),
+                  value_type=TextLine())
+
+    target = Dict(title=_("Notification target"),
+                  description=_("Notification targets (principals, roles...)"),
+                  key_type=TextLine())
+
+    url = TextLine(title=_("Notification URL"),
+                   description=_("URL targetted by this notification"),
+                   required=False)
+
+    timestamp = TextLine(title=_("Notification timestamp"))
+
+    user_data = Dict(title=_("User data"))
+
+    def send(self):
+        """Send notification to recipients"""
+
+
+class INotificationHandler(Interface):
+    """Notification handler interface"""
+
+    def get_target(self):
+        """Get notification target"""
+
+
+class IUserProfileAnnotations(Interface):
+    """User profile annotations subscriptions"""