Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

openapi: Move stray register-queue description into OpenAPI.

Suyash Vardhan Mathurd0e44eaaae21
diff --git a/templates/zerver/api/register-queue.md b/templates/zerver/api/register-queue.md
index 366a170e42f..9b4a7a3c4f2 100644
--- a/templates/zerver/api/register-queue.md
+++ b/templates/zerver/api/register-queue.md
@@ -1,49 +1,6 @@
-# Register an event queue
-
-`POST {{ api_url }}/v1/register`
-
-This powerful endpoint can be used to register a Zulip "event queue"
-(subscribed to certain types of "events", or updates to the messages
-and other Zulip data the current user has access to), as well as to
-fetch the current state of that data.
-
-(`register` also powers the `call_on_each_event` Python API, and is
-intended primarily for complex applications for which the more convenient
-`call_on_each_event` API is insufficient).
-
-This endpoint returns a `queue_id` and a `last_event_id`; these can be
-used in subsequent calls to the
-["events" endpoint](/api/get-events) to request events from
-the Zulip server using long-polling.
-
-The server will queue events for up to 10 minutes of inactivity.
-After 10 minutes, your event queue will be garbage-collected. The
-server will send `heartbeat` events every minute, which makes it easy
-to implement a robust client that does not miss events unless the
-client loses network connectivity with the Zulip server for 10 minutes
-or longer.
-
-Once the server garbage-collects your event queue, the server will
-[return an error](/api/get-events#bad_event_queue_id-errors)
-with a code of `BAD_EVENT_QUEUE_ID` if you try to fetch events from
-the event queue. Your software will need to handle that error
-condition by re-initializing itself (e.g. this is what triggers your
-browser reloading the Zulip web app when your laptop comes back online
-after being offline for more than 10 minutes).
-
-When prototyping with this API, we recommend first calling `register`
-with no `event_types` parameter to see all the available data from all
-supported event types. Before using your client in production, you
-should set appropriate `event_types` and `fetch_event_types` filters
-so that your client only requests the data it needs. A few minutes
-doing this often saves 90% of the total bandwidth and other resources
-consumed by a client using this API.
-
-See the
-[events system developer documentation](https://zulip.readthedocs.io/en/latest/subsystems/events-system.html)
-if you need deeper details about how the Zulip event queue system
-works, avoids clients needing to worry about large classes of
-potentially messy races, etc.
+{generate_api_title(/register:post)}
+
+{generate_api_description(API_ENDPOINT_NAME)}
## Usage examples
@@ -64,10 +21,16 @@ potentially messy races, etc.
{generate_api_arguments_table|zulip.yaml|/register:post}
+{generate_parameter_description(API_ENDPOINT_NAME)}
+
## Response
{generate_return_values_table|zulip.yaml|/register:post}
+{generate_response_description(API_ENDPOINT_NAME)}
+
#### Example response
{generate_code_example|/register:post|fixture(200)}
+
+{generate_code_example|API_ENDPOINT_NAME|fixture(400)}
diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml
index 3814f3462cf..90df3edbdc2 100644
--- a/zerver/openapi/zulip.yaml
+++ b/zerver/openapi/zulip.yaml
@@ -7578,10 +7578,50 @@ paths:
summary: Register an event queue
tags: ["real_time_events"]
description: |
+ `POST {{ api_url }}/v1/register`
+
This powerful endpoint can be used to register a Zulip "event queue"
- (subscribed to certain types of "events", or updates to the messages and
- other Zulip data the current user has access to), as well as to fetch
- the current state of that data.
+ (subscribed to certain types of "events", or updates to the messages
+ and other Zulip data the current user has access to), as well as to
+ fetch the current state of that data.
+
+ (`register` also powers the `call_on_each_event` Python API, and is
+ intended primarily for complex applications for which the more convenient
+ `call_on_each_event` API is insufficient).
+
+ This endpoint returns a `queue_id` and a `last_event_id`; these can be
+ used in subsequent calls to the
+ ["events" endpoint](/api/get-events) to request events from
+ the Zulip server using long-polling.
+
+ The server will queue events for up to 10 minutes of inactivity.
+ After 10 minutes, your event queue will be garbage-collected. The
+ server will send `heartbeat` events every minute, which makes it easy
+ to implement a robust client that does not miss events unless the
+ client loses network connectivity with the Zulip server for 10 minutes
+ or longer.
+
+ Once the server garbage-collects your event queue, the server will
+ [return an error](/api/get-events#bad_event_queue_id-errors)
+ with a code of `BAD_EVENT_QUEUE_ID` if you try to fetch events from
+ the event queue. Your software will need to handle that error
+ condition by re-initializing itself (e.g. this is what triggers your
+ browser reloading the Zulip web app when your laptop comes back online
+ after being offline for more than 10 minutes).
+
+ When prototyping with this API, we recommend first calling `register`
+ with no `event_types` parameter to see all the available data from all
+ supported event types. Before using your client in production, you
+ should set appropriate `event_types` and `fetch_event_types` filters
+ so that your client only requests the data it needs. A few minutes
+ doing this often saves 90% of the total bandwidth and other resources
+ consumed by a client using this API.
+
+ See the
+ [events system developer documentation](https://zulip.readthedocs.io/en/latest/subsystems/events-system.html)
+ if you need deeper details about how the Zulip event queue system
+ works, avoids clients needing to worry about large classes of
+ potentially messy races, etc.
x-curl-examples-parameters:
oneOf:
- type: include