diff --git a/zulip/zulip/__init__.py b/zulip/zulip/__init__.py index 0d29fca..54caa1d 100644 --- a/zulip/zulip/__init__.py +++ b/zulip/zulip/__init__.py @@ -1043,6 +1043,16 @@ class Client(object): 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): # type: (Optional[Dict[str, Any]]) -> Dict[str, Any] ''' diff --git a/zulip/zulip/examples/delete-stream b/zulip/zulip/examples/delete-stream new file mode 100755 index 0000000..b6ecb8b --- /dev/null +++ b/zulip/zulip/examples/delete-stream @@ -0,0 +1,20 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import argparse + +import zulip + +usage = """delete-stream + +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))