summaryrefslogtreecommitdiff
path: root/src/mailman/interfaces
diff options
context:
space:
mode:
authorBarry Warsaw2009-12-27 13:21:28 -0500
committerBarry Warsaw2009-12-27 13:21:28 -0500
commit16bf4d15972351c3f8dacc7f28c4cdb24a717e59 (patch)
treee6abad3ad407260b85156b828441e37b0374d7a5 /src/mailman/interfaces
parent7592ba511e37a299e3329f95e584873f3613dc5f (diff)
downloadmailman-16bf4d15972351c3f8dacc7f28c4cdb24a717e59.tar.gz
mailman-16bf4d15972351c3f8dacc7f28c4cdb24a717e59.tar.zst
mailman-16bf4d15972351c3f8dacc7f28c4cdb24a717e59.zip
Add REST API for subscription services.
Diffstat (limited to 'src/mailman/interfaces')
-rw-r--r--src/mailman/interfaces/member.py4
-rw-r--r--src/mailman/interfaces/membership.py55
2 files changed, 59 insertions, 0 deletions
diff --git a/src/mailman/interfaces/member.py b/src/mailman/interfaces/member.py
index 2e966879d..e5a82060a 100644
--- a/src/mailman/interfaces/member.py
+++ b/src/mailman/interfaces/member.py
@@ -29,6 +29,8 @@ __all__ = [
]
+from lazr.restful.declarations import (
+ export_as_webservice_entry, exported)
from munepy import Enum
from zope.interface import Interface, Attribute
@@ -87,6 +89,8 @@ class AlreadySubscribedError(SubscriptionError):
class IMember(Interface):
"""A member of a mailing list."""
+ export_as_webservice_entry()
+
mailing_list = Attribute(
"""The mailing list subscribed to.""")
diff --git a/src/mailman/interfaces/membership.py b/src/mailman/interfaces/membership.py
new file mode 100644
index 000000000..0a04ff630
--- /dev/null
+++ b/src/mailman/interfaces/membership.py
@@ -0,0 +1,55 @@
+# Copyright (C) 2009 by the Free Software Foundation, Inc.
+#
+# This file is part of GNU Mailman.
+#
+# GNU Mailman is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option)
+# any later version.
+#
+# GNU Mailman 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 General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# GNU Mailman. If not, see <http://www.gnu.org/licenses/>.
+
+"""Membership interface for REST."""
+
+from __future__ import absolute_import, unicode_literals
+
+__metaclass__ = type
+__all__ = [
+ 'SubscriptionService',
+ ]
+
+
+from lazr.restful.declarations import (
+ collection_default_content, export_as_webservice_collection,
+ export_factory_operation)
+from zope.interface import Interface
+
+from mailman.core.i18n import _
+from mailman.interfaces.member import IMember
+
+
+
+class ISubscriptionService(Interface):
+ """Subscription services for the REST API."""
+
+ export_as_webservice_collection(IMember)
+
+ @collection_default_content()
+ def get_members():
+ """Return a sequence of all members of all mailing lists.
+
+ The members are sorted first by fully-qualified mailing list name,
+ then by subscribed email address, then by role. Because the user may
+ be a member of the list under multiple roles (e.g. as an owner and as
+ a digest member), the member can appear multiple times in this list.
+ Roles are sorted by: owner, moderator, member.
+
+ :return: The list of all members.
+ :rtype: list of `IMember`
+ """