diff --git a/zulip/zulip/__init__.py b/zulip/zulip/__init__.py index ba8d243..995e623 100644 --- a/zulip/zulip/__init__.py +++ b/zulip/zulip/__init__.py @@ -728,6 +728,16 @@ class Client(object): request=message_data, ) + def delete_message(self, message_id): + # type: (Dict[str, Any]) -> Dict[str, Any] + ''' + See examples/delete-message for example usage. + ''' + return self.call_endpoint( + url='messages/{}'.format(message_id), + method='DELETE' + ) + def get_events(self, **request): # type: (**Any) -> Dict[str, Any] ''' diff --git a/zulip/zulip/examples/delete-message b/zulip/zulip/examples/delete-message new file mode 100755 index 0000000..3429bd0 --- /dev/null +++ b/zulip/zulip/examples/delete-message @@ -0,0 +1,22 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import argparse + +import zulip + +usage = """delete-message [options] + +Please note that an administrator user is required for this example. + +Example: delete-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.delete_message(options.message_id))