api: Implement PATCH /users/me/subscriptions/muted_topics.
This commit is contained in:
parent
ab97b37ce1
commit
f6646f9cba
|
@ -939,6 +939,17 @@ class Client(object):
|
|||
request=request,
|
||||
)
|
||||
|
||||
def mute_topic(self, request):
|
||||
# type: (Dict[str, Any]) -> Dict[str, Any]
|
||||
'''
|
||||
See examples/mute-topic for example usage.
|
||||
'''
|
||||
return self.call_endpoint(
|
||||
url='users/me/subscriptions/muted_topics',
|
||||
method='PATCH',
|
||||
request=request
|
||||
)
|
||||
|
||||
def get_stream_id(self, stream):
|
||||
# type: (str) -> Dict[str, Any]
|
||||
'''
|
||||
|
|
31
zulip/zulip/examples/mute-topic
Executable file
31
zulip/zulip/examples/mute-topic
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import argparse
|
||||
|
||||
import zulip
|
||||
|
||||
usage = """mute-topic (mute | unmute) <stream> <topic> [options]
|
||||
|
||||
Example: mute-topic mute Verona dinner
|
||||
Example: mute-topic unmute Denmark party
|
||||
"""
|
||||
|
||||
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
||||
parser.add_argument('op', choices=['mute', 'unmute'])
|
||||
parser.add_argument('stream')
|
||||
parser.add_argument('topic')
|
||||
options = parser.parse_args()
|
||||
|
||||
client = zulip.init_from_options(options)
|
||||
|
||||
OPERATIONS = {
|
||||
'mute': 'add',
|
||||
'unmute': 'remove'
|
||||
}
|
||||
|
||||
print(client.mute_topic({
|
||||
'op': OPERATIONS[options.op],
|
||||
'stream': options.stream,
|
||||
'topic': options.topic
|
||||
}))
|
Loading…
Reference in a new issue