summaryrefslogtreecommitdiff
path: root/src/mailman/rest/docs
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/rest/docs')
-rw-r--r--src/mailman/rest/docs/lists.rst11
-rw-r--r--src/mailman/rest/docs/plugins.rst60
2 files changed, 67 insertions, 4 deletions
diff --git a/src/mailman/rest/docs/lists.rst b/src/mailman/rest/docs/lists.rst
index 6a034df94..67cbb697a 100644
--- a/src/mailman/rest/docs/lists.rst
+++ b/src/mailman/rest/docs/lists.rst
@@ -191,10 +191,13 @@ Apply a style at list creation time
of a particular type, e.g. discussion lists. We can see which styles are
available, and which is the default style.
- >>> dump_json('http://localhost:9001/3.0/lists/styles')
- default: legacy-default
- http_etag: "..."
- style_names: ['legacy-announce', 'legacy-default']
+ >>> json = call_http('http://localhost:9001/3.0/lists/styles')
+ >>> json['default']
+ 'legacy-default'
+ >>> for style in json['styles']:
+ ... print('{}: {}'.format(style['name'], style['description']))
+ legacy-announce: Announce only mailing list style.
+ legacy-default: Ordinary discussion mailing list style.
When creating a list, if we don't specify a style to apply, the default style
is used. However, we can provide a style name in the POST data to choose a
diff --git a/src/mailman/rest/docs/plugins.rst b/src/mailman/rest/docs/plugins.rst
new file mode 100644
index 000000000..737a911c0
--- /dev/null
+++ b/src/mailman/rest/docs/plugins.rst
@@ -0,0 +1,60 @@
+=========
+ Plugins
+=========
+
+Plugins can supply REST routes.
+::
+
+ >>> dump_json('http://localhost:9001/3.1/plugins')
+ entry 0:
+ class: mailman.testing.plugin.ExamplePlugin
+ configuration:
+ enable: True
+ http_etag: "..."
+ name: example
+ path:
+ http_etag: "..."
+ start: 0
+ total_size: 1
+
+ >>> dump_json('http://localhost:9001/3.1/plugins/example')
+ example-plugin-reply: yes
+ http_etag: "..."
+
+ >>> dump_json('http://localhost:9001/3.1/plugins/example/good')
+ good: True
+ http_etag: "..."
+
+ >>> dump_json('http://localhost:9001/3.1/plugins/example/bad')
+ Traceback (most recent call last):
+ ...
+ urllib.error.HTTPError: HTTP Error 400: ...
+
+For example this route that presents a counter.
+::
+
+ >>> dump_json('http://localhost:9001/3.1/plugins/example/count')
+ count: 0
+ http_etag: "..."
+
+ >>> call_http('http://localhost:9001/3.1/plugins/example/count',
+ ... {'count':3}, method='POST')
+ content-length: 0
+ date: ...
+ server: ...
+ status: 204
+
+ >>> dump_json('http://localhost:9001/3.1/plugins/example/count')
+ count: 3
+ http_etag: "..."
+
+ >>> call_http('http://localhost:9001/3.1/plugins/example/count',
+ ... method='DELETE')
+ content-length: 0
+ date: ...
+ server: ...
+ status: 204
+
+ >>> dump_json('http://localhost:9001/3.1/plugins/example/count')
+ count: 0
+ http_etag: "..."