api: Implement DELETE /streams/<stream_id>.

This commit is contained in:
Yago González 2018-08-17 01:19:32 +02:00 committed by Eeshan Garg
parent 6151f2db40
commit bf752a860c
2 changed files with 30 additions and 0 deletions

View file

@ -1043,6 +1043,16 @@ class Client(object):
request=stream_data, request=stream_data,
) )
def delete_stream(self, stream_id):
# type: (int) -> Dict[str, Any]
'''
See examples/delete-stream for example usage.
'''
return self.call_endpoint(
url='streams/{}'.format(stream_id),
method='DELETE',
)
def get_members(self, request=None): def get_members(self, request=None):
# type: (Optional[Dict[str, Any]]) -> Dict[str, Any] # type: (Optional[Dict[str, Any]]) -> Dict[str, Any]
''' '''

View file

@ -0,0 +1,20 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import zulip
usage = """delete-stream <stream_id>
Example: delete-stream 42
"""
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
parser.add_argument('stream_id', type=int)
options = parser.parse_args()
client = zulip.init_from_options(options)
print(client.delete_stream(options.stream_id))