api: Implement /users/me/<stream_id>/topics.
This commit is contained in:
parent
b1ab308c26
commit
817636cbc6
|
@ -848,6 +848,16 @@ class Client(object):
|
||||||
request=None,
|
request=None,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def get_stream_topics(self, stream_id):
|
||||||
|
# type: (int) -> Dict[str, Any]
|
||||||
|
'''
|
||||||
|
See examples/get-stream-topics for example usage.
|
||||||
|
'''
|
||||||
|
return self.call_endpoint(
|
||||||
|
url='users/me/{}/topics'.format(stream_id),
|
||||||
|
method='GET'
|
||||||
|
)
|
||||||
|
|
||||||
def get_subscribers(self, **request):
|
def get_subscribers(self, **request):
|
||||||
# type: (**Any) -> Dict[str, Any]
|
# type: (**Any) -> Dict[str, Any]
|
||||||
'''
|
'''
|
||||||
|
|
19
zulip/zulip/examples/get-stream-topics
Executable file
19
zulip/zulip/examples/get-stream-topics
Executable file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
|
||||||
|
usage = """get-stream-topics --stream-id=<stream-id> [options]
|
||||||
|
|
||||||
|
Get all the topics for a specific stream.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import zulip
|
||||||
|
|
||||||
|
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
||||||
|
parser.add_argument('--stream-id', required=True)
|
||||||
|
options = parser.parse_args()
|
||||||
|
|
||||||
|
client = zulip.init_from_options(options)
|
||||||
|
|
||||||
|
print(client.get_stream_topics(options.stream_id))
|
Loading…
Reference in a new issue