From f8fd7b6fbfd523e744850bba5dc019fc86308d6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20Gonz=C3=A1lez?= Date: Wed, 27 Jun 2018 22:18:40 +0200 Subject: [PATCH] api: Implement GET /messages//history. --- zulip/zulip/__init__.py | 10 ++++++++++ zulip/zulip/examples/message-history | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100755 zulip/zulip/examples/message-history diff --git a/zulip/zulip/__init__.py b/zulip/zulip/__init__.py index 0374b61..e2b7bcb 100644 --- a/zulip/zulip/__init__.py +++ b/zulip/zulip/__init__.py @@ -748,6 +748,16 @@ class Client(object): method='DELETE' ) + def get_message_history(self, message_id): + # type: (int) -> Dict[str, Any] + ''' + See examples/message-history for example usage. + ''' + return self.call_endpoint( + url='messages/{}/history'.format(message_id), + method='GET' + ) + def get_events(self, **request): # type: (**Any) -> Dict[str, Any] ''' diff --git a/zulip/zulip/examples/message-history b/zulip/zulip/examples/message-history new file mode 100755 index 0000000..8b451c5 --- /dev/null +++ b/zulip/zulip/examples/message-history @@ -0,0 +1,19 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import argparse + +import zulip + +usage = """message-history [options] + +Example: message-history 42 +""" + +parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage)) +parser.add_argument('message_id', type=int) +options = parser.parse_args() + +client = zulip.init_from_options(options) + +print(client.get_message_history(options.message_id))