api: Implement DELETE /messages/<message_id>.
This commit is contained in:
parent
005829192e
commit
e2f379675b
|
@ -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]
|
||||
'''
|
||||
|
|
22
zulip/zulip/examples/delete-message
Executable file
22
zulip/zulip/examples/delete-message
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import argparse
|
||||
|
||||
import zulip
|
||||
|
||||
usage = """delete-message <message_id> [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))
|
Loading…
Reference in a new issue