From 38f3e1a9f509ccd29d308bed7baf1b8157bf66cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20Gonz=C3=A1lez?= Date: Sat, 23 Jun 2018 17:59:28 +0200 Subject: [PATCH] api: Implement GET /messages/. --- zulip/zulip/__init__.py | 10 ++++++++++ zulip/zulip/examples/get-raw-message | 21 +++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100755 zulip/zulip/examples/get-raw-message diff --git a/zulip/zulip/__init__.py b/zulip/zulip/__init__.py index 995e623..0537b9d 100644 --- a/zulip/zulip/__init__.py +++ b/zulip/zulip/__init__.py @@ -697,6 +697,16 @@ class Client(object): request=message_filters ) + def get_raw_message(self, message_id): + # type: (int) -> Dict[str, str] + ''' + See examples/get-raw-message for example usage + ''' + return self.call_endpoint( + url='messages/{}'.format(message_id), + method='GET' + ) + def send_message(self, message_data): # type: (Dict[str, Any]) -> Dict[str, Any] ''' diff --git a/zulip/zulip/examples/get-raw-message b/zulip/zulip/examples/get-raw-message new file mode 100755 index 0000000..189122f --- /dev/null +++ b/zulip/zulip/examples/get-raw-message @@ -0,0 +1,21 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import argparse + +import zulip + +usage = """get-raw-message [options] + + +Example: get-raw-message 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_raw_message(options.message_id))