From bf752a860c4bf0783af07984b63c4062ab4a2753 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20Gonz=C3=A1lez?= Date: Fri, 17 Aug 2018 01:19:32 +0200 Subject: [PATCH] api: Implement DELETE /streams/. --- zulip/zulip/__init__.py | 10 ++++++++++ zulip/zulip/examples/delete-stream | 20 ++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100755 zulip/zulip/examples/delete-stream 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))