aboutsummaryrefslogtreecommitdiffstats
path: root/server.py
diff options
context:
space:
mode:
authorBlake DeMarcy <ofunknowndescent@gmail.com>2017-04-26 14:51:03 -0500
committerBlake DeMarcy <ofunknowndescent@gmail.com>2017-04-26 14:51:03 -0500
commit33b591293750db1de93c2c372706cf2e3b134dee (patch)
tree6114beb9dbabe7495885fb57adf7c2cb92947aed /server.py
parentc4f04173c44ec79c80de1eed47892e28fde2d704 (diff)
downloadbbj-33b591293750db1de93c2c372706cf2e3b134dee.tar.gz
add message feeds
Diffstat (limited to 'server.py')
-rw-r--r--server.py37
1 files changed, 31 insertions, 6 deletions
diff --git a/server.py b/server.py
index d20432f..cb9a4f8 100644
--- a/server.py
+++ b/server.py
@@ -212,6 +212,37 @@ class API(object):
@api_method
+ def message_feed(self, args, database, user, **kwargs):
+ """
+ Returns a special object representing all activity on the board since
+ the argument `time`, a unix/epoch timestamp.
+
+ {
+ "threads": {
+ "thread_id": {
+ ...thread object
+ },
+ ...more thread_id/object pairs
+ },
+ "messages": [...standard message object array sorted by date]
+ }
+
+ The message objects in "messages" are the same objects returned
+ in threads normally. They each have a thread_id parameter, and
+ you can access metadata for these threads by the "threads" object
+ which is also provided.
+
+ The "messages" array is already sorted by submission time, newest
+ first. The order in the threads object is undefined and you should
+ instead use their `last_mod` attribute if you intend to list them
+ out visually.
+ """
+ validate(args, ["time"])
+ return db.message_feed(database, args["time"])
+
+
+
+ @api_method
def thread_create(self, args, database, user, **kwargs):
"""
Creates a new thread and returns it. Requires the non-empty
@@ -435,12 +466,6 @@ class API(object):
return response
- def test(self, **kwargs):
- print(cherrypy.request.body.read())
- return "{\"wow\": \"jolly good show!\"}"
- test.exposed = True
-
-
def api_http_error(status, message, traceback, version):
return json.dumps(schema.error(2, "HTTP error {}: {}".format(status, message)))
Un proyecto texto-plano.xyz