Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
openapi: Document get-subscribers endpoint.
Suyash Vardhan Mathurec6739ff2904
diff --git a/templates/zerver/help/include/rest-endpoints.md b/templates/zerver/help/include/rest-endpoints.mdindex 8f9943a2e57..355c8f8ca5a 100644--- a/templates/zerver/help/include/rest-endpoints.md+++ b/templates/zerver/help/include/rest-endpoints.md@@ -21,6 +21,7 @@* [Subscribe to a stream](/api/subscribe)* [Unsubscribe from a stream](/api/unsubscribe)* [Get subscription status](/api/get-subscription-status)+* [Get all subscribers](/api/get-subscribers)* [Update subscription settings](/api/update-subscription-settings)* [Get all streams](/api/get-streams)* [Get stream ID](/api/get-stream-id)diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yamlindex a9e58dc0ec8..8eadd1eae86 100644--- a/zerver/openapi/zulip.yaml+++ b/zerver/openapi/zulip.yaml@@ -10451,6 +10451,53 @@ paths:"msg": "","result": "success",}+ /streams/{stream_id}/members:+ get:+ operationId: get-subscribers+ summary: Get the subscribers of a stream+ tags: ["streams"]+ description: |+ Get all users subscribed to a stream.++ `Get {{ api_url }}/v1/streams/{stream_id}/members`+ parameters:+ - $ref: "#/components/parameters/StreamIdInPath"+ responses:+ "200":+ description: Success.+ content:+ application/json:+ schema:+ allOf:+ - $ref: "#/components/schemas/JsonSuccessBase"+ - $ref: "#/components/schemas/SuccessDescription"+ - additionalProperties: false+ properties:+ subscribers:+ type: array+ items:+ type: integer+ description: |+ A list containing the IDs of all active users who are subscribed+ to the stream.+ example:+ {"result": "success", "msg": "", "subscribers": [11, 26]}+ "400":+ description: Bad request.+ content:+ application/json:+ schema:+ allOf:+ - $ref: "#/components/schemas/JsonError"+ - example:+ {+ "code": "BAD_REQUEST",+ "msg": "Invalid stream id",+ "result": "error",+ }+ description: |+ An example JSON response for when the requested stream does not exist,+ or where the user does not have permission to access the target stream:/streams:get:operationId: get-streamsdiff --git a/zerver/tests/test_openapi.py b/zerver/tests/test_openapi.pyindex 254b06b8f4f..c06d2c20611 100644--- a/zerver/tests/test_openapi.py+++ b/zerver/tests/test_openapi.py@@ -208,6 +208,7 @@ class OpenAPIArgumentsTest(ZulipTestCase):#### TODO: These endpoints are a priority to document:"/realm/presence","/streams/{stream_id}/members",+ "/streams/{stream_id}/delete_topic","/users/me/presence","/users/me/alert_words","/users/me/status",diff --git a/zerver/views/streams.py b/zerver/views/streams.pyindex fcfe9abdf65..1cf5732071d 100644--- a/zerver/views/streams.py+++ b/zerver/views/streams.py@@ -670,7 +670,7 @@ def send_messages_for_new_subscribers(def get_subscribers_backend(request: HttpRequest,user_profile: UserProfile,- stream_id: int = REQ("stream", converter=to_non_negative_int),+ stream_id: int = REQ("stream", converter=to_non_negative_int, path_only=True),) -> HttpResponse:(stream, sub) = access_stream_by_id(user_profile,