[manual] Extend /api/v1/streams API endpoint.
Previously it only provided the list of all public streams; now it allows one to specify any union of some of the following: * all public streams * all streams the user subscribed to (the most relevant being the union of those two, which is what we want for the "streams" page). Or: * all streams in realm (superuser only) The manual task required is that when this is pushed to prod, we need to also deploy the new sync-public-streams version to zmirror. (imported from commit 27848b8bd136e2777f399b7d05b2fdcec35e4e21)
This commit is contained in:
parent
81aebf897b
commit
0b9ea4db05
|
@ -16,7 +16,7 @@ def fetch_public_streams():
|
||||||
public_streams = set()
|
public_streams = set()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
res = zulip_client.get_public_streams()
|
res = zulip_client.get_streams(include_all_active=True)
|
||||||
if res.get("result") == "success":
|
if res.get("result") == "success":
|
||||||
streams = res["streams"]
|
streams = res["streams"]
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -43,4 +43,4 @@ parser.add_option_group(zulip.generate_option_group(parser))
|
||||||
|
|
||||||
client = zulip.init_from_options(options)
|
client = zulip.init_from_options(options)
|
||||||
|
|
||||||
print client.get_public_streams()
|
print client.get_streams(include_public=True, include_subscribed=False)
|
||||||
|
|
|
@ -286,13 +286,16 @@ def _mk_events(event_types=None):
|
||||||
return dict()
|
return dict()
|
||||||
return dict(event_types=event_types)
|
return dict(event_types=event_types)
|
||||||
|
|
||||||
|
def _kwargs_to_dict(**kwargs):
|
||||||
|
return kwargs
|
||||||
|
|
||||||
Client._register('send_message', url='messages', make_request=(lambda request: request))
|
Client._register('send_message', url='messages', make_request=(lambda request: request))
|
||||||
Client._register('update_message', method='PATCH', url='messages', make_request=(lambda request: request))
|
Client._register('update_message', method='PATCH', url='messages', make_request=(lambda request: request))
|
||||||
Client._register('get_messages', method='GET', url='messages/latest', longpolling=True)
|
Client._register('get_messages', method='GET', url='messages/latest', longpolling=True)
|
||||||
Client._register('get_events', url='events', method='GET', longpolling=True, make_request=(lambda **kwargs: kwargs))
|
Client._register('get_events', url='events', method='GET', longpolling=True, make_request=(lambda **kwargs: kwargs))
|
||||||
Client._register('register', make_request=_mk_events)
|
Client._register('register', make_request=_mk_events)
|
||||||
Client._register('get_profile', method='GET', url='users/me')
|
Client._register('get_profile', method='GET', url='users/me')
|
||||||
Client._register('get_public_streams', method='GET', url='streams')
|
Client._register('get_streams', method='GET', url='streams', make_request=_kwargs_to_dict)
|
||||||
Client._register('get_members', method='GET', url='users')
|
Client._register('get_members', method='GET', url='users')
|
||||||
Client._register('list_subscriptions', method='GET', url='users/me/subscriptions')
|
Client._register('list_subscriptions', method='GET', url='users/me/subscriptions')
|
||||||
Client._register('add_subscriptions', url='users/me/subscriptions', make_request=_mk_subs)
|
Client._register('add_subscriptions', url='users/me/subscriptions', make_request=_mk_subs)
|
||||||
|
|
Loading…
Reference in a new issue