From 23b991a80106a1d673e387fc7ec11e44b8a8d748 Mon Sep 17 00:00:00 2001 From: Suyash Vardhan Mathur Date: Sun, 23 May 2021 16:57:41 +0530 Subject: [PATCH] api docs: Replace most markdown files with a common template. This PR adds a basic .md template that is followed by lot of /api pages. Since we have recently done the migration work to ensure that our REST API documentation pages for individual endpoints are almost all identical files following a common pattern, we can now get the payoff of deleting them all in favor of a shared template. This removes 2000 lines of somewhat finicky configuration from the codebase, and thus should save significant effort when documenting new API endpoints in the future. The markdown files for endpoints or other pages which deviate from the standard template remain, and the docs are instead generated from those files using the existing system. --- templates/zerver/api/add-code-playground.md | 35 ----------------- templates/zerver/api/add-linkifier.md | 35 ----------------- templates/zerver/api/add-reaction.md | 34 ----------------- templates/zerver/api/api-doc-template.md | 35 +++++++++++++++++ templates/zerver/api/archive-stream.md | 33 ---------------- .../zerver/api/check-messages-match-narrow.md | 35 ----------------- .../zerver/api/create-custom-profile-field.md | 35 ----------------- templates/zerver/api/create-user-group.md | 33 ---------------- templates/zerver/api/create-user.md | 35 ----------------- templates/zerver/api/deactivate-own-user.md | 33 ---------------- templates/zerver/api/deactivate-user.md | 33 ---------------- templates/zerver/api/delete-message.md | 33 ---------------- templates/zerver/api/delete-queue.md | 33 ---------------- templates/zerver/api/dev-fetch-api-key.md | 30 --------------- templates/zerver/api/fetch-api-key.md | 26 ------------- templates/zerver/api/get-attachments.md | 35 ----------------- templates/zerver/api/get-custom-emoji.md | 36 ------------------ .../zerver/api/get-custom-profile-fields.md | 36 ------------------ templates/zerver/api/get-linkifiers.md | 35 ----------------- templates/zerver/api/get-message-history.md | 35 ----------------- templates/zerver/api/get-messages.md | 35 ----------------- templates/zerver/api/get-own-user.md | 35 ----------------- templates/zerver/api/get-raw-message.md | 35 ----------------- templates/zerver/api/get-server-settings.md | 35 ----------------- templates/zerver/api/get-stream-id.md | 35 ----------------- templates/zerver/api/get-stream-topics.md | 35 ----------------- templates/zerver/api/get-streams.md | 35 ----------------- .../zerver/api/get-subscription-status.md | 33 ---------------- templates/zerver/api/get-subscriptions.md | 35 ----------------- templates/zerver/api/get-user-by-email.md | 35 ----------------- templates/zerver/api/get-user-groups.md | 35 ----------------- templates/zerver/api/get-user-presence.md | 35 ----------------- templates/zerver/api/get-user.md | 35 ----------------- templates/zerver/api/get-users.md | 35 ----------------- templates/zerver/api/mute-topic.md | 33 ---------------- templates/zerver/api/mute-user.md | 33 ---------------- templates/zerver/api/reactivate-user.md | 33 ---------------- templates/zerver/api/register-queue.md | 35 ----------------- .../zerver/api/remove-code-playground.md | 33 ---------------- templates/zerver/api/remove-linkifier.md | 33 ---------------- templates/zerver/api/remove-reaction.md | 35 ----------------- templates/zerver/api/remove-user-group.md | 33 ---------------- templates/zerver/api/render-message.md | 35 ----------------- .../api/reorder-custom-profile-fields.md | 36 ------------------ templates/zerver/api/set-typing-status.md | 33 ---------------- templates/zerver/api/subscribe.md | 35 ----------------- templates/zerver/api/unmute-user.md | 33 ---------------- templates/zerver/api/unsubscribe.md | 31 --------------- .../zerver/api/update-display-settings.md | 33 ---------------- templates/zerver/api/update-linkifier.md | 35 ----------------- templates/zerver/api/update-message-flags.md | 35 ----------------- templates/zerver/api/update-message.md | 33 ---------------- .../api/update-notification-settings.md | 33 ---------------- templates/zerver/api/update-stream.md | 33 ---------------- .../api/update-subscription-settings.md | 35 ----------------- .../zerver/api/update-user-group-members.md | 33 ---------------- templates/zerver/api/update-user-group.md | 33 ---------------- templates/zerver/api/update-user.md | 33 ---------------- templates/zerver/api/upload-custom-emoji.md | 35 ----------------- templates/zerver/api/upload-file.md | 34 ----------------- zerver/lib/templates.py | 3 +- zerver/views/documentation.py | 38 ++++++++++++++++--- 62 files changed, 70 insertions(+), 2010 deletions(-) delete mode 100644 templates/zerver/api/add-code-playground.md delete mode 100644 templates/zerver/api/add-linkifier.md delete mode 100644 templates/zerver/api/add-reaction.md create mode 100644 templates/zerver/api/api-doc-template.md delete mode 100644 templates/zerver/api/archive-stream.md delete mode 100644 templates/zerver/api/check-messages-match-narrow.md delete mode 100644 templates/zerver/api/create-custom-profile-field.md delete mode 100644 templates/zerver/api/create-user-group.md delete mode 100644 templates/zerver/api/create-user.md delete mode 100644 templates/zerver/api/deactivate-own-user.md delete mode 100644 templates/zerver/api/deactivate-user.md delete mode 100644 templates/zerver/api/delete-message.md delete mode 100644 templates/zerver/api/delete-queue.md delete mode 100644 templates/zerver/api/dev-fetch-api-key.md delete mode 100644 templates/zerver/api/fetch-api-key.md delete mode 100644 templates/zerver/api/get-attachments.md delete mode 100644 templates/zerver/api/get-custom-emoji.md delete mode 100644 templates/zerver/api/get-custom-profile-fields.md delete mode 100644 templates/zerver/api/get-linkifiers.md delete mode 100644 templates/zerver/api/get-message-history.md delete mode 100644 templates/zerver/api/get-messages.md delete mode 100644 templates/zerver/api/get-own-user.md delete mode 100644 templates/zerver/api/get-raw-message.md delete mode 100644 templates/zerver/api/get-server-settings.md delete mode 100644 templates/zerver/api/get-stream-id.md delete mode 100644 templates/zerver/api/get-stream-topics.md delete mode 100644 templates/zerver/api/get-streams.md delete mode 100644 templates/zerver/api/get-subscription-status.md delete mode 100644 templates/zerver/api/get-subscriptions.md delete mode 100644 templates/zerver/api/get-user-by-email.md delete mode 100644 templates/zerver/api/get-user-groups.md delete mode 100644 templates/zerver/api/get-user-presence.md delete mode 100644 templates/zerver/api/get-user.md delete mode 100644 templates/zerver/api/get-users.md delete mode 100644 templates/zerver/api/mute-topic.md delete mode 100644 templates/zerver/api/mute-user.md delete mode 100644 templates/zerver/api/reactivate-user.md delete mode 100644 templates/zerver/api/register-queue.md delete mode 100644 templates/zerver/api/remove-code-playground.md delete mode 100644 templates/zerver/api/remove-linkifier.md delete mode 100644 templates/zerver/api/remove-reaction.md delete mode 100644 templates/zerver/api/remove-user-group.md delete mode 100644 templates/zerver/api/render-message.md delete mode 100644 templates/zerver/api/reorder-custom-profile-fields.md delete mode 100644 templates/zerver/api/set-typing-status.md delete mode 100644 templates/zerver/api/subscribe.md delete mode 100644 templates/zerver/api/unmute-user.md delete mode 100644 templates/zerver/api/unsubscribe.md delete mode 100644 templates/zerver/api/update-display-settings.md delete mode 100644 templates/zerver/api/update-linkifier.md delete mode 100644 templates/zerver/api/update-message-flags.md delete mode 100644 templates/zerver/api/update-message.md delete mode 100644 templates/zerver/api/update-notification-settings.md delete mode 100644 templates/zerver/api/update-stream.md delete mode 100644 templates/zerver/api/update-subscription-settings.md delete mode 100644 templates/zerver/api/update-user-group-members.md delete mode 100644 templates/zerver/api/update-user-group.md delete mode 100644 templates/zerver/api/update-user.md delete mode 100644 templates/zerver/api/upload-custom-emoji.md delete mode 100644 templates/zerver/api/upload-file.md diff --git a/templates/zerver/api/add-code-playground.md b/templates/zerver/api/add-code-playground.md deleted file mode 100644 index 20a28f46e1..0000000000 --- a/templates/zerver/api/add-code-playground.md +++ /dev/null @@ -1,35 +0,0 @@ -{generate_api_title(/realm/playgrounds:post)} - -{generate_api_description(/realm/playgrounds:post)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/realm/playgrounds:post|example} - -{generate_code_example(javascript)|/realm/playgrounds:post|example} - -{tab|curl} - -{generate_code_example(curl)|/realm/playgrounds:post|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/realm/playgrounds:post} - -{generate_parameter_description(/realm/playgrounds:post)} - -## Response - -{generate_return_values_table|zulip.yaml|/realm/playgrounds:post} - -{generate_response_description(/realm/playgrounds:post)} - -#### Example response - -{generate_code_example|/realm/playgrounds:post|fixture(200)} - -{generate_code_example|/realm/playgrounds:post|fixture(400)} diff --git a/templates/zerver/api/add-linkifier.md b/templates/zerver/api/add-linkifier.md deleted file mode 100644 index be6026198f..0000000000 --- a/templates/zerver/api/add-linkifier.md +++ /dev/null @@ -1,35 +0,0 @@ -{generate_api_title(/realm/filters:post)} - -{generate_api_description(/realm/filters:post)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/realm/filters:post|example} - -{generate_code_example(javascript)|/realm/filters:post|example} - -{tab|curl} - -{generate_code_example(curl)|/realm/filters:post|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/realm/filters:post} - -{generate_parameter_description(/realm/filters:post)} - -## Response - -{generate_return_values_table|zulip.yaml|/realm/filters:post} - -{generate_response_description(/realm/filters:post)} - -#### Example response - -{generate_code_example|/realm/filters:post|fixture(200)} - -{generate_code_example|/realm/filters:post|fixture(400)} diff --git a/templates/zerver/api/add-reaction.md b/templates/zerver/api/add-reaction.md deleted file mode 100644 index 10a598fdf0..0000000000 --- a/templates/zerver/api/add-reaction.md +++ /dev/null @@ -1,34 +0,0 @@ -{generate_api_title(/messages/{message_id}/reactions:post)} - -{generate_api_description(/messages/{message_id}/reactions:post)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/messages/{message_id}/reactions:post|example} - -{generate_code_example(javascript)|/messages/{message_id}/reactions:post|example} - -{tab|curl} - -{generate_code_example(curl)|/messages/{message_id}/reactions:post|example} - -{end_tabs} - -## Parameters - - -{generate_api_arguments_table|zulip.yaml|/messages/{message_id}/reactions:post} - -{generate_parameter_description(/messages/{message_id}/reactions:post)} - -## Response - -{generate_response_description(/messages/{message_id}/reactions:post)} - -#### Example response - -{generate_code_example|/messages/{message_id}/reactions:post|fixture(200)} - -{generate_code_example|/messages/{message_id}/reactions:post|fixture(400)} diff --git a/templates/zerver/api/api-doc-template.md b/templates/zerver/api/api-doc-template.md new file mode 100644 index 0000000000..38daf38b61 --- /dev/null +++ b/templates/zerver/api/api-doc-template.md @@ -0,0 +1,35 @@ +{generate_api_title(API_ENDPOINT_NAME)} + +{generate_api_description(API_ENDPOINT_NAME)} + +## Usage examples + +{start_tabs} + +{generate_code_example(python)|API_ENDPOINT_NAME|example} + +{generate_code_example(javascript)|API_ENDPOINT_NAME|example} + +{tab|curl} + +{generate_code_example(curl)|API_ENDPOINT_NAME|example} + +{end_tabs} + +## Parameters + +{generate_api_arguments_table|zulip.yaml|API_ENDPOINT_NAME} + +{generate_parameter_description(API_ENDPOINT_NAME)} + +## Response + +{generate_return_values_table|zulip.yaml|API_ENDPOINT_NAME} + +{generate_response_description(API_ENDPOINT_NAME)} + +#### Example response + +{generate_code_example|API_ENDPOINT_NAME|fixture(200)} + +{generate_code_example|API_ENDPOINT_NAME|fixture(400)} diff --git a/templates/zerver/api/archive-stream.md b/templates/zerver/api/archive-stream.md deleted file mode 100644 index 3d4e2c4a6f..0000000000 --- a/templates/zerver/api/archive-stream.md +++ /dev/null @@ -1,33 +0,0 @@ -{generate_api_title(/streams/{stream_id}:delete)} - -{generate_api_description(/streams/{stream_id}:delete)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/streams/{stream_id}:delete|example} - -{generate_code_example(javascript)|/streams/{stream_id}:delete|example} - -{tab|curl} - -{generate_code_example(curl)|/streams/{stream_id}:delete|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/streams/{stream_id}:delete} - -{generate_parameter_description(/streams/{stream_id}:delete)} - -## Response - -{generate_response_description(/streams/{stream_id}:delete)} - -#### Example response - -{generate_code_example|/streams/{stream_id}:delete|fixture(200)} - -{generate_code_example|/streams/{stream_id}:delete|fixture(400)} diff --git a/templates/zerver/api/check-messages-match-narrow.md b/templates/zerver/api/check-messages-match-narrow.md deleted file mode 100644 index 7e0f891341..0000000000 --- a/templates/zerver/api/check-messages-match-narrow.md +++ /dev/null @@ -1,35 +0,0 @@ -{generate_api_title(/messages/matches_narrow:get)} - -{generate_api_description(/messages/matches_narrow:get)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/messages/matches_narrow:get|example} - -{generate_code_example(javascript)|/messages/matches_narrow:get|example} - -{tab|curl} - -{generate_code_example(curl)|/messages/matches_narrow:get|example} - -{end_tabs} - -## Arguments - -{generate_api_arguments_table|zulip.yaml|/messages/matches_narrow:get} - -{generate_parameter_description(/messages/matches_narrow:get)} - -## Response - -{generate_return_values_table|zulip.yaml|/messages/matches_narrow:get} - -{generate_response_description(/messages/matches_narrow:get)} - -#### Example response - -{generate_code_example|/messages/matches_narrow:get|fixture(200)} - -{generate_code_example|/messages/matches_narrow:get|fixture(400)} diff --git a/templates/zerver/api/create-custom-profile-field.md b/templates/zerver/api/create-custom-profile-field.md deleted file mode 100644 index 8066907ddd..0000000000 --- a/templates/zerver/api/create-custom-profile-field.md +++ /dev/null @@ -1,35 +0,0 @@ -{generate_api_title(/realm/profile_fields:post)} - -{generate_api_description(/realm/profile_fields:post)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/realm/profile_fields:post|example} - -{generate_code_example(javascript)|/realm/profile_fields:post|example} - -{tab|curl} - -{generate_code_example(curl)|/realm/profile_fields:post|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/realm/profile_fields:post} - -{generate_parameter_description(/realm/profile_fields:post)} - -## Response - -{generate_return_values_table|zulip.yaml|/realm/profile_fields:post} - -{generate_response_description(/realm/profile_fields:post)} - -#### Example response - -{generate_code_example|/realm/profile_fields:post|fixture(200)} - -{generate_code_example|/realm/profile_fields:post|fixture(400)} diff --git a/templates/zerver/api/create-user-group.md b/templates/zerver/api/create-user-group.md deleted file mode 100644 index 0fabfd9435..0000000000 --- a/templates/zerver/api/create-user-group.md +++ /dev/null @@ -1,33 +0,0 @@ -{generate_api_title(/user_groups/create:post)} - -{generate_api_description(/user_groups/create:post)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/user_groups/create:post|example} - -{generate_code_example(javascript)|/user_groups/create:post|example} - -{tab|curl} - -{generate_code_example(curl)|/user_groups/create:post|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/user_groups/create:post} - -{generate_parameter_description(/user_groups/create:post)} - -## Response - -{generate_response_description(/user_groups/create:post)} - -#### Example response - -{generate_code_example|/user_groups/create:post|fixture(200)} - -{generate_code_example|/user_groups/create:post|fixture(400)} diff --git a/templates/zerver/api/create-user.md b/templates/zerver/api/create-user.md deleted file mode 100644 index 54913f8764..0000000000 --- a/templates/zerver/api/create-user.md +++ /dev/null @@ -1,35 +0,0 @@ -{generate_api_title(/users:post)} - -{generate_api_description(/users:post)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/users:post|example} - -{generate_code_example(javascript)|/users:post|example} - -{tab|curl} - -{generate_code_example(curl)|/users:post|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/users:post} - -{generate_parameter_description(/users:post)} - -## Response - -{generate_return_values_table|zulip.yaml|/users:post} - -{generate_response_description(/users:post)} - -#### Example response - -{generate_code_example|/users:post|fixture(200)} - -{generate_code_example|/users:post|fixture(400)} diff --git a/templates/zerver/api/deactivate-own-user.md b/templates/zerver/api/deactivate-own-user.md deleted file mode 100644 index 6ebfbd85ca..0000000000 --- a/templates/zerver/api/deactivate-own-user.md +++ /dev/null @@ -1,33 +0,0 @@ -{generate_api_title(/users/me:delete)} - -{generate_api_description(/users/me:delete)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/users/me:delete|example} - -{generate_code_example(javascript)|/users/me:delete|example} - -{tab|curl} - -{generate_code_example(curl)|/users/me:delete|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/users/me:delete} - -{generate_parameter_description(/users/me:delete)} - -## Response - -{generate_response_description(/users/me:delete)} - -#### Example response - -{generate_code_example|/users/me:delete|fixture(200)} - -{generate_code_example|/users/me:delete|fixture(400)} diff --git a/templates/zerver/api/deactivate-user.md b/templates/zerver/api/deactivate-user.md deleted file mode 100644 index 68682a7346..0000000000 --- a/templates/zerver/api/deactivate-user.md +++ /dev/null @@ -1,33 +0,0 @@ -{generate_api_title(/users/{user_id}:delete)} - -{generate_api_description(/users/{user_id}:delete)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/users/{user_id}:delete|example} - -{generate_code_example(javascript)|/users/{user_id}:delete|example} - -{tab|curl} - -{generate_code_example(curl)|/users/{user_id}:delete|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/users/{user_id}:delete} - -{generate_parameter_description(/users/{user_id}:delete)} - -## Response - -{generate_response_description(/users/{user_id}:delete)} - -#### Example response - -{generate_code_example|/users/{user_id}:delete|fixture(200)} - -{generate_code_example|/users/{user_id}:delete|fixture(400)} diff --git a/templates/zerver/api/delete-message.md b/templates/zerver/api/delete-message.md deleted file mode 100644 index fd69cb60e7..0000000000 --- a/templates/zerver/api/delete-message.md +++ /dev/null @@ -1,33 +0,0 @@ -{generate_api_title(/messages/{message_id}:delete)} - -{generate_api_description(/messages/{message_id}:delete)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/messages/{message_id}:delete|example} - -{generate_code_example(javascript)|/messages/{message_id}:delete|example} - -{tab|curl} - -{generate_code_example(curl)|/messages/{message_id}:delete|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/messages/{message_id}:delete} - -{generate_parameter_description(/messages/{message_id}:delete)} - -## Response - -{generate_response_description(/messages/{message_id}:delete)} - -#### Example response - -{generate_code_example|/messages/{message_id}:delete|fixture(200)} - -{generate_code_example|/messages/{message_id}:delete|fixture(400)} diff --git a/templates/zerver/api/delete-queue.md b/templates/zerver/api/delete-queue.md deleted file mode 100644 index 499f48c040..0000000000 --- a/templates/zerver/api/delete-queue.md +++ /dev/null @@ -1,33 +0,0 @@ -{generate_api_title(/events:delete)} - -{generate_api_description(/events:delete)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/events:delete|example} - -{generate_code_example(javascript)|/events:delete|example} - -{tab|curl} - -{generate_code_example(curl)|/events:delete|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/events:delete} - -{generate_parameter_description(/events:delete)} - -## Response - -{generate_response_description(/events:delete)} - -#### Example response - -{generate_code_example|/events:delete|fixture(200)} - -{generate_code_example|/events:delete|fixture(400)} diff --git a/templates/zerver/api/dev-fetch-api-key.md b/templates/zerver/api/dev-fetch-api-key.md deleted file mode 100644 index 691585528a..0000000000 --- a/templates/zerver/api/dev-fetch-api-key.md +++ /dev/null @@ -1,30 +0,0 @@ -{generate_api_title(/dev_fetch_api_key:post)} - -{generate_api_description(/dev_fetch_api_key:post)} - -## Usage examples - -{start_tabs} -{tab|curl} - -{generate_code_example(curl)|/dev_fetch_api_key:post|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/dev_fetch_api_key:post} - -{generate_parameter_description(/dev_fetch_api_key:post)} - -## Response - -{generate_return_values_table|zulip.yaml|/dev_fetch_api_key:post} - -{generate_response_description(/dev_fetch_api_key:post)} - -#### Example response - -{generate_code_example|/dev_fetch_api_key:post|fixture(200)} - -{generate_code_example|/dev_fetch_api_key:post|fixture(400)} diff --git a/templates/zerver/api/fetch-api-key.md b/templates/zerver/api/fetch-api-key.md deleted file mode 100644 index 04bbef5d5a..0000000000 --- a/templates/zerver/api/fetch-api-key.md +++ /dev/null @@ -1,26 +0,0 @@ -{generate_api_title(/fetch_api_key:post)} - -{generate_api_description(/fetch_api_key:post)} - -## Usage examples - -{start_tabs} -{tab|curl} - -{generate_code_example(curl)|/fetch_api_key:post|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/fetch_api_key:post} - -{generate_parameter_description(/fetch_api_key:post)} - -## Response - -{generate_return_values_table|zulip.yaml|/fetch_api_key:post} - -### Example response - -{generate_code_example|/fetch_api_key:post|fixture(200)} diff --git a/templates/zerver/api/get-attachments.md b/templates/zerver/api/get-attachments.md deleted file mode 100644 index 6ae8ae8bf2..0000000000 --- a/templates/zerver/api/get-attachments.md +++ /dev/null @@ -1,35 +0,0 @@ -{generate_api_title(/attachments:get)} - -{generate_api_description(/attachments:get)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/attachments:get|example} - -{generate_code_example(javascript)|/attachments:get|example} - -{tab|curl} - -{generate_code_example(curl)|/attachments:get|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/attachments:get} - -{generate_parameter_description(/attachments:get)} - -## Response - -{generate_return_values_table|zulip.yaml|/attachments:get} - -{generate_response_description(/attachments:get)} - -#### Example response - -{generate_code_example|/attachments:get|fixture(200)} - -{generate_code_example|/attachments:get|fixture(400)} diff --git a/templates/zerver/api/get-custom-emoji.md b/templates/zerver/api/get-custom-emoji.md deleted file mode 100644 index 5b9b55f1e1..0000000000 --- a/templates/zerver/api/get-custom-emoji.md +++ /dev/null @@ -1,36 +0,0 @@ -{generate_api_title(/realm/emoji:get)} - -{generate_api_description(/realm/emoji:get)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/realm/emoji:get|example} - -{generate_code_example(javascript)|/realm/emoji:get|example} - -{tab|curl} - -{generate_code_example(curl)|/realm/emoji:get|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/realm/emoji:get} - -{generate_parameter_description(/realm/emoji:get)} - -## Response - -{generate_return_values_table|zulip.yaml|/realm/emoji:get} - - -{generate_response_description(/realm/emoji:get)} - -#### Example response - -{generate_code_example|/realm/emoji:get|fixture(200)} - -{generate_code_example|/realm/emoji:get|fixture(400)} diff --git a/templates/zerver/api/get-custom-profile-fields.md b/templates/zerver/api/get-custom-profile-fields.md deleted file mode 100644 index af8ccfe7c5..0000000000 --- a/templates/zerver/api/get-custom-profile-fields.md +++ /dev/null @@ -1,36 +0,0 @@ -{generate_api_title(/realm/profile_fields:get)} - -{generate_api_description(/realm/profile_fields:get)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/realm/profile_fields:get|example} - -{generate_code_example(javascript)|/realm/profile_fields:get|example} - -{tab|curl} - -{generate_code_example(curl)|/realm/profile_fields:get|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/realm/profile_fields:get} - -{generate_parameter_description(/realm/profile_fields:get)} - -## Response - -{generate_return_values_table|zulip.yaml|/realm/profile_fields:get} - - -{generate_response_description(/realm/profile_fields:get)} - -#### Example response - -{generate_code_example|/realm/profile_fields:get|fixture(200)} - -{generate_code_example|/realm/profile_fields:get|fixture(400)} diff --git a/templates/zerver/api/get-linkifiers.md b/templates/zerver/api/get-linkifiers.md deleted file mode 100644 index 1703e0926c..0000000000 --- a/templates/zerver/api/get-linkifiers.md +++ /dev/null @@ -1,35 +0,0 @@ -{generate_api_title(/realm/linkifiers:get)} - -{generate_api_description(/realm/linkifiers:get)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/realm/linkifiers:get|example} - -{generate_code_example(javascript)|/realm/linkifiers:get|example} - -{tab|curl} - -{generate_code_example(curl)|/realm/linkifiers:get|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/realm/linkifiers:get} - -{generate_parameter_description(/realm/linkifiers:get)} - -## Response - -{generate_return_values_table|zulip.yaml|/realm/linkifiers:get} - -{generate_response_description(/realm/linkifiers:get)} - -#### Example response - -{generate_code_example|/realm/linkifiers:get|fixture(200)} - -{generate_code_example|/realm/linkifiers:get|fixture(400)} diff --git a/templates/zerver/api/get-message-history.md b/templates/zerver/api/get-message-history.md deleted file mode 100644 index 8579dc8fa7..0000000000 --- a/templates/zerver/api/get-message-history.md +++ /dev/null @@ -1,35 +0,0 @@ -{generate_api_title(/messages/{message_id}/history:get)} - -{generate_api_description(/messages/{message_id}/history:get)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/messages/{message_id}/history:get|example} - -{generate_code_example(javascript)|/messages/{message_id}/history:get|example} - -{tab|curl} - -{generate_code_example(curl)|/messages/{message_id}/history:get|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/messages/{message_id}/history:get} - -{generate_parameter_description(/messages/{message_id}/history:get)} - -## Response - -{generate_return_values_table|zulip.yaml|/messages/{message_id}/history:get} - -{generate_response_description(/messages/{message_id}/history:get)} - -#### Example response - -{generate_code_example|/messages/{message_id}/history:get|fixture(200)} - -{generate_code_example|/messages/{message_id}/history:get|fixture(400)} diff --git a/templates/zerver/api/get-messages.md b/templates/zerver/api/get-messages.md deleted file mode 100644 index 9fa9079dc8..0000000000 --- a/templates/zerver/api/get-messages.md +++ /dev/null @@ -1,35 +0,0 @@ -{generate_api_title(/messages:get)} - -{generate_api_description(/messages:get)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/messages:get|example} - -{generate_code_example(javascript)|/messages:get|example} - -{tab|curl} - -{generate_code_example(curl)|/messages:get|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/messages:get} - -{generate_parameter_description(/messages:get)} - -## Response - -{generate_return_values_table|zulip.yaml|/messages:get} - -{generate_response_description(/messages:get)} - -#### Example response - -{generate_code_example|/messages:get|fixture(200)} - -{generate_code_example|/messages:get|fixture(400)} diff --git a/templates/zerver/api/get-own-user.md b/templates/zerver/api/get-own-user.md deleted file mode 100644 index 1131890a71..0000000000 --- a/templates/zerver/api/get-own-user.md +++ /dev/null @@ -1,35 +0,0 @@ -{generate_api_title(/users/me:get)} - -{generate_api_description(/users/me:get)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/users/me:get|example} - -{generate_code_example(javascript)|/users/me:get|example} - -{tab|curl} - -{generate_code_example(curl)|/users/me:get|example} - -{end_tabs} - -## Parameters - -This endpoint does not accept any parameters. - -{generate_parameter_description(/users/me:get)} - -## Response - -{generate_return_values_table|zulip.yaml|/users/me:get} - -{generate_response_description(/users/me:get)} - -#### Example response - -{generate_code_example|/users/me:get|fixture(200)} - -{generate_code_example|/users/me:get|fixture(400)} diff --git a/templates/zerver/api/get-raw-message.md b/templates/zerver/api/get-raw-message.md deleted file mode 100644 index 9c633794f6..0000000000 --- a/templates/zerver/api/get-raw-message.md +++ /dev/null @@ -1,35 +0,0 @@ -{generate_api_title(/messages/{message_id}:get)} - -{generate_api_description(/messages/{message_id}:get)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/messages/{message_id}:get|example} - -{generate_code_example(javascript)|/messages/{message_id}:get|example} - -{tab|curl} - -{generate_code_example(curl)|/messages/{message_id}:get|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/messages/{message_id}:get} - -{generate_parameter_description(/messages/{message_id}:get)} - -## Response - -{generate_return_values_table|zulip.yaml|/messages/{message_id}:get} - -{generate_response_description(/messages/{message_id}:get)} - -#### Example response - -{generate_code_example|/messages/{message_id}:get|fixture(200)} - -{generate_code_example|/messages/{message_id}:get|fixture(400)} diff --git a/templates/zerver/api/get-server-settings.md b/templates/zerver/api/get-server-settings.md deleted file mode 100644 index 2db32ccaf4..0000000000 --- a/templates/zerver/api/get-server-settings.md +++ /dev/null @@ -1,35 +0,0 @@ -{generate_api_title(/server_settings:get)} - -{generate_api_description(/server_settings:get)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/server_settings:get|example} - -{generate_code_example(javascript)|/server_settings:get|example} - -{tab|curl} - -{generate_code_example(curl)|/server_settings:get|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/server_settings:get} - -{generate_parameter_description(/server_settings:get)} - -## Response - -{generate_return_values_table|zulip.yaml|/server_settings:get} - -{generate_response_description(/server_settings:get)} - -#### Example response - -{generate_code_example|/server_settings:get|fixture(200)} - -{generate_code_example|/server_settings:get|fixture(400)} diff --git a/templates/zerver/api/get-stream-id.md b/templates/zerver/api/get-stream-id.md deleted file mode 100644 index 186da02502..0000000000 --- a/templates/zerver/api/get-stream-id.md +++ /dev/null @@ -1,35 +0,0 @@ -{generate_api_title(/get_stream_id:get)} - -{generate_api_description(/get_stream_id:get)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/get_stream_id:get|example} - -{generate_code_example(javascript)|/get_stream_id:get|example} - -{tab|curl} - -{generate_code_example(curl)|/get_stream_id:get|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/get_stream_id:get} - -{generate_parameter_description(/get_stream_id:get)} - -## Response - -{generate_return_values_table|zulip.yaml|/get_stream_id:get} - -{generate_response_description(/get_stream_id:get)} - -#### Example response - -{generate_code_example|/get_stream_id:get|fixture(200)} - -{generate_code_example|/get_stream_id:get|fixture(400)} diff --git a/templates/zerver/api/get-stream-topics.md b/templates/zerver/api/get-stream-topics.md deleted file mode 100644 index bdf3d0797a..0000000000 --- a/templates/zerver/api/get-stream-topics.md +++ /dev/null @@ -1,35 +0,0 @@ -{generate_api_title(/users/me/{stream_id}/topics:get)} - -{generate_api_description(/users/me/{stream_id}/topics:get)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/users/me/{stream_id}/topics:get|example} - -{generate_code_example(javascript)|/users/me/{stream_id}/topics:get|example} - -{tab|curl} - -{generate_code_example(curl)|/users/me/{stream_id}/topics:get|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/users/me/{stream_id}/topics:get} - -{generate_parameter_description(/users/me/{stream_id}/topics:get)} - -## Response - -{generate_return_values_table|zulip.yaml|/users/me/{stream_id}/topics:get} - -{generate_response_description(/users/me/{stream_id}/topics:get)} - -#### Example response - -{generate_code_example|/users/me/{stream_id}/topics:get|fixture(200)} - -{generate_code_example|/users/me/{stream_id}/topics:get|fixture(400)} diff --git a/templates/zerver/api/get-streams.md b/templates/zerver/api/get-streams.md deleted file mode 100644 index d70d698a52..0000000000 --- a/templates/zerver/api/get-streams.md +++ /dev/null @@ -1,35 +0,0 @@ -{generate_api_title(/streams:get)} - -{generate_api_description(/streams:get)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/streams:get|example} - -{generate_code_example(javascript)|/streams:get|example} - -{tab|curl} - -{generate_code_example(curl)|/streams:get|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/streams:get} - -{generate_parameter_description(/streams:get)} - -## Response - -{generate_return_values_table|zulip.yaml|/streams:get} - -{generate_response_description(/streams:get)} - -#### Example response - -{generate_code_example|/streams:get|fixture(200)} - -{generate_code_example|/streams:get|fixture(400)} diff --git a/templates/zerver/api/get-subscription-status.md b/templates/zerver/api/get-subscription-status.md deleted file mode 100644 index c602570529..0000000000 --- a/templates/zerver/api/get-subscription-status.md +++ /dev/null @@ -1,33 +0,0 @@ -{generate_api_title(/users/{user_id}/subscriptions/{stream_id}:get)} - -{generate_api_description(/users/{user_id}/subscriptions/{stream_id}:get)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/users/{user_id}/subscriptions/{stream_id}:get|example} - -{generate_code_example(javascript)|/users/{user_id}/subscriptions/{stream_id}:get|example} - -{tab|curl} - -{generate_code_example(curl)|/users/{user_id}/subscriptions/{stream_id}:get|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/users/{user_id}/subscriptions/{stream_id}:get} - -{generate_parameter_description(/users/{user_id}/subscriptions/{stream_id}:get)} - -## Response - -{generate_response_description(/users/{user_id}/subscriptions/{stream_id}:get)} - -#### Example response - -{generate_code_example|/users/{user_id}/subscriptions/{stream_id}:get|fixture(200)} - -{generate_code_example|/users/{user_id}/subscriptions/{stream_id}:get|fixture(400)} diff --git a/templates/zerver/api/get-subscriptions.md b/templates/zerver/api/get-subscriptions.md deleted file mode 100644 index 174565af36..0000000000 --- a/templates/zerver/api/get-subscriptions.md +++ /dev/null @@ -1,35 +0,0 @@ -{generate_api_title(/users/me/subscriptions:get)} - -{generate_api_description(/users/me/subscriptions:get)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/users/me/subscriptions:get|example} - -{generate_code_example(javascript)|/users/me/subscriptions:get|example} - -{tab|curl} - -{generate_code_example(curl)|/users/me/subscriptions:get|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/users/me/subscriptions:get} - -{generate_parameter_description(/users/me/subscriptions:get)} - -## Response - -{generate_return_values_table|zulip.yaml|/users/me/subscriptions:get} - -{generate_response_description(/users/me/subscriptions:get)} - -#### Example response - -{generate_code_example|/users/me/subscriptions:get|fixture(200)} - -{generate_code_example|/users/me/subscriptions:get|fixture(400)} diff --git a/templates/zerver/api/get-user-by-email.md b/templates/zerver/api/get-user-by-email.md deleted file mode 100644 index 114d0c5835..0000000000 --- a/templates/zerver/api/get-user-by-email.md +++ /dev/null @@ -1,35 +0,0 @@ -{generate_api_title(/users/{email}:get)} - -{generate_api_description(/users/{email}:get)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/users/{email}:get|example} - -{generate_code_example(javascript)|/users/{email}:get|example} - -{tab|curl} - -{generate_code_example(curl)|/users/{email}:get|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/users/{email}:get} - -{generate_parameter_description(/users/{email}:get)} - -## Response - -{generate_return_values_table|zulip.yaml}|/users/{email}:get} - -{generate_response_description(/users/{email}:get)} - -#### Example response - -{generate_code_example|/users/{email}:get|fixture(200)} - -{generate_code_example|/users/{email}:get|fixture(400)} diff --git a/templates/zerver/api/get-user-groups.md b/templates/zerver/api/get-user-groups.md deleted file mode 100644 index 2501e048a3..0000000000 --- a/templates/zerver/api/get-user-groups.md +++ /dev/null @@ -1,35 +0,0 @@ -{generate_api_title(/user_groups:get)} - -{generate_api_description(/user_groups:get)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/user_groups:get|example} - -{generate_code_example(javascript)|/user_groups:get|example} - -{tab|curl} - -{generate_code_example(curl)|/user_groups:get|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/user_groups:get} - -{generate_parameter_description(/user_groups:get)} - -## Response - -{generate_return_values_table|zulip.yaml|/user_groups:get} - -{generate_response_description(/user_groups:get)} - -#### Example response - -{generate_code_example|/user_groups:get|fixture(200)} - -{generate_code_example|/user_groups:get|fixture(400)} diff --git a/templates/zerver/api/get-user-presence.md b/templates/zerver/api/get-user-presence.md deleted file mode 100644 index ea34d628b1..0000000000 --- a/templates/zerver/api/get-user-presence.md +++ /dev/null @@ -1,35 +0,0 @@ -{generate_api_title(/users/{user_id_or_email}/presence:get)} - -{generate_api_description(/users/{user_id_or_email}/presence:get)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/users/{user_id_or_email}/presence:get|example} - -{generate_code_example(javascript)|/users/{user_id_or_email}/presence:get|example} - -{tab|curl} - -{generate_code_example(curl)|/users/{user_id_or_email}/presence:get|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/users/{user_id_or_email}/presence:get} - -{generate_parameter_description(/users/{user_id_or_email}/presence:get)} - -## Response - -{generate_return_values_table|zulip.yaml|/users/{user_id_or_email}/presence:get} - -{generate_response_description(/users/{user_id_or_email}/presence:get)} - -#### Example response - -{generate_code_example|/users/{user_id_or_email}/presence:get|fixture(200)} - -{generate_code_example|/users/{user_id_or_email}/presence:get|fixture(400)} diff --git a/templates/zerver/api/get-user.md b/templates/zerver/api/get-user.md deleted file mode 100644 index 947335a6fa..0000000000 --- a/templates/zerver/api/get-user.md +++ /dev/null @@ -1,35 +0,0 @@ -{generate_api_title(/users/{user_id}:get)} - -{generate_api_description(/users/{user_id}:get)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/users/{user_id}:get|example} - -{generate_code_example(javascript)|/users/{user_id}:get|example} - -{tab|curl} - -{generate_code_example(curl)|/users/{user_id}:get|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/users/{user_id}:get} - -{generate_parameter_description(/users/{user_id}:get)} - -## Response - -{generate_return_values_table|zulip.yaml}|/users/{user_id}:get} - -{generate_response_description(/users/{user_id}:get)} - -#### Example response - -{generate_code_example|/users/{user_id}:get|fixture(200)} - -{generate_code_example|/users/{user_id}:get|fixture(400)} diff --git a/templates/zerver/api/get-users.md b/templates/zerver/api/get-users.md deleted file mode 100644 index af8a148532..0000000000 --- a/templates/zerver/api/get-users.md +++ /dev/null @@ -1,35 +0,0 @@ -{generate_api_title(/users:get)} - -{generate_api_description(/users:get)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/users:get|example} - -{generate_code_example(javascript)|/users:get|example} - -{tab|curl} - -{generate_code_example(curl)|/users:get|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/users:get} - -{generate_parameter_description(/users:get)} - -## Response - -{generate_return_values_table|zulip.yaml|/users:get} - -{generate_response_description(/users:get)} - -#### Example response - -{generate_code_example|/users:get|fixture(200)} - -{generate_code_example|/users:get|fixture(400)} diff --git a/templates/zerver/api/mute-topic.md b/templates/zerver/api/mute-topic.md deleted file mode 100644 index 8469d37fa8..0000000000 --- a/templates/zerver/api/mute-topic.md +++ /dev/null @@ -1,33 +0,0 @@ -{generate_api_title(/users/me/subscriptions/muted_topics:patch)} - -{generate_api_description(/users/me/subscriptions/muted_topics:patch)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/users/me/subscriptions/muted_topics:patch|example} - -{generate_code_example(javascript)|/users/me/subscriptions/muted_topics:patch|example} - -{tab|curl} - -{generate_code_example(curl)|/users/me/subscriptions/muted_topics:patch|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/users/me/subscriptions/muted_topics:patch} - -{generate_parameter_description(/users/me/subscriptions/muted_topics:patch)} - -## Response - -{generate_response_description(/users/me/subscriptions/muted_topics:patch)} - -#### Example response - -{generate_code_example|/users/me/subscriptions/muted_topics:patch|fixture(200)} - -{generate_code_example|/users/me/subscriptions/muted_topics:patch|fixture(400)} diff --git a/templates/zerver/api/mute-user.md b/templates/zerver/api/mute-user.md deleted file mode 100644 index e5dbb66bdc..0000000000 --- a/templates/zerver/api/mute-user.md +++ /dev/null @@ -1,33 +0,0 @@ -{generate_api_title(/users/me/muted_users/{muted_user_id}:post)} - -{generate_api_description(/users/me/muted_users/{muted_user_id}:post)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/users/me/muted_users/{muted_user_id}:post|example} - -{generate_code_example(javascript)|/users/me/muted_users/{muted_user_id}:post|example} - -{tab|curl} - -{generate_code_example(curl)|/users/me/muted_users/{muted_user_id}:post|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/users/me/muted_users/{muted_user_id}:post} - -{generate_parameter_description(/users/me/muted_users/{muted_user_id}:post)} - -## Response - -{generate_response_description(/users/me/muted_users/{muted_user_id}:post)} - -#### Example response - -{generate_code_example|/users/me/muted_users/{muted_user_id}:post|fixture(200)} - -{generate_code_example|/users/me/muted_users/{muted_user_id}:post|fixture(400)} diff --git a/templates/zerver/api/reactivate-user.md b/templates/zerver/api/reactivate-user.md deleted file mode 100644 index 81cc60a1ae..0000000000 --- a/templates/zerver/api/reactivate-user.md +++ /dev/null @@ -1,33 +0,0 @@ -{generate_api_title(/users/{user_id}/reactivate:post)} - -{generate_api_description(/users/{user_id}/reactivate:post)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/users/{user_id}/reactivate:post|example} - -{generate_code_example(javascript)|/users/{user_id}/reactivate:post|example} - -{tab|curl} - -{generate_code_example(curl)|/users/{user_id}/reactivate:post|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/users/{user_id}/reactivate:post} - -{generate_parameter_description(/users/{user_id}/reactivate:post)} - -## Response - -{generate_response_description(/users/{user_id}/reactivate:post)} - -#### Example response - -{generate_code_example|/users/{user_id}/reactivate:post|fixture(200)} - -{generate_code_example|/users/{user_id}/reactivate:post|fixture(400)} diff --git a/templates/zerver/api/register-queue.md b/templates/zerver/api/register-queue.md deleted file mode 100644 index 398fef86e3..0000000000 --- a/templates/zerver/api/register-queue.md +++ /dev/null @@ -1,35 +0,0 @@ -{generate_api_title(/register:post)} - -{generate_api_description(/register:post)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/register:post|example} - -{generate_code_example(javascript)|/register:post|example} - -{tab|curl} - -{generate_code_example(curl)|/register:post|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/register:post} - -{generate_parameter_description(/register:post)} - -## Response - -{generate_return_values_table|zulip.yaml|/register:post} - -{generate_response_description(/register:post)} - -#### Example response - -{generate_code_example|/register:post|fixture(200)} - -{generate_code_example|/register:post|fixture(400)} diff --git a/templates/zerver/api/remove-code-playground.md b/templates/zerver/api/remove-code-playground.md deleted file mode 100644 index 628b1f8398..0000000000 --- a/templates/zerver/api/remove-code-playground.md +++ /dev/null @@ -1,33 +0,0 @@ -{generate_api_title(/realm/playgrounds/{playground_id}:delete)} - -{generate_api_description(/realm/playgrounds/{playground_id}:delete)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/realm/playgrounds/{playground_id}:delete|example} - -{generate_code_example(javascript)|/realm/playgrounds/{playground_id}:delete|example} - -{tab|curl} - -{generate_code_example(curl)|/realm/playgrounds/{playground_id}:delete|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/realm/playgrounds/{playground_id}:delete} - -{generate_parameter_description(/realm/playgrounds/{playground_id}:delete)} - -## Response - -{generate_response_description(/realm/playgrounds/{playground_id}:delete)} - -#### Example response - -{generate_code_example|/realm/playgrounds/{playground_id}:delete|fixture(200)} - -{generate_code_example|/realm/playgrounds/{playground_id}:delete|fixture(400)} diff --git a/templates/zerver/api/remove-linkifier.md b/templates/zerver/api/remove-linkifier.md deleted file mode 100644 index e1db42c8c7..0000000000 --- a/templates/zerver/api/remove-linkifier.md +++ /dev/null @@ -1,33 +0,0 @@ -{generate_api_title(/realm/filters/{filter_id}:delete)} - -{generate_api_description(/realm/filters/{filter_id}:delete)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/realm/filters/{filter_id}:delete|example} - -{generate_code_example(javascript)|/realm/filters/{filter_id}:delete|example} - -{tab|curl} - -{generate_code_example(curl)|/realm/filters/{filter_id}:delete|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/realm/filters/{filter_id}:delete} - -{generate_parameter_description(/realm/filters/{filter_id}:delete)} - -## Response - -{generate_response_description(/realm/filters/{filter_id}:delete)} - -#### Example response - -{generate_code_example|/realm/filters/{filter_id}:delete|fixture(200)} - -{generate_code_example|/realm/filters/{filter_id}:delete|fixture(400)} diff --git a/templates/zerver/api/remove-reaction.md b/templates/zerver/api/remove-reaction.md deleted file mode 100644 index b05c88d2b0..0000000000 --- a/templates/zerver/api/remove-reaction.md +++ /dev/null @@ -1,35 +0,0 @@ -{generate_api_title(/messages/{message_id}/reactions:delete)} - -{generate_api_description(/messages/{message_id}/reactions:delete)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/messages/{message_id}/reactions:delete|example} - -{generate_code_example(javascript)|/messages/{message_id}/reactions:delete|example} - -{tab|curl} - -{generate_code_example(curl)|/messages/{message_id}/reactions:delete|example} - - -{end_tabs} - -## Parameters - - -{generate_api_arguments_table|zulip.yaml|/messages/{message_id}/reactions:delete} - -{generate_parameter_description(/messages/{message_id}/reactions:delete)} - -## Response - -{generate_response_description(/messages/{message_id}/reactions:delete)} - -#### Example response - -{generate_code_example|/messages/{message_id}/reactions:delete|fixture(200)} - -{generate_code_example|/messages/{message_id}/reactions:delete|fixture(400)} diff --git a/templates/zerver/api/remove-user-group.md b/templates/zerver/api/remove-user-group.md deleted file mode 100644 index 5897e1585f..0000000000 --- a/templates/zerver/api/remove-user-group.md +++ /dev/null @@ -1,33 +0,0 @@ -{generate_api_title(/user_groups/{user_group_id}:delete)} - -{generate_api_description(/user_groups/{user_group_id}:delete)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/user_groups/{user_group_id}:delete|example} - -{generate_code_example(javascript)|/user_groups/{user_group_id}:delete|example} - -{tab|curl} - -{generate_code_example(curl)|/user_groups/{user_group_id}:delete|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/user_groups/{user_group_id}:delete} - -{generate_parameter_description(/user_groups/{user_group_id}:delete)} - -## Response - -{generate_response_description(/user_groups/{user_group_id}:delete)} - -#### Example response - -{generate_code_example|/user_groups/{user_group_id}:delete|fixture(200)} - -{generate_code_example|/user_groups/{user_group_id}:delete|fixture(400)} diff --git a/templates/zerver/api/render-message.md b/templates/zerver/api/render-message.md deleted file mode 100644 index 2edd3b4a82..0000000000 --- a/templates/zerver/api/render-message.md +++ /dev/null @@ -1,35 +0,0 @@ -{generate_api_title(/messages/render:post)} - -{generate_api_description(/messages/render:post)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/messages/render:post|example} - -{generate_code_example(javascript)|/messages/render:post|example} - -{tab|curl} - -{generate_code_example(curl)|/messages/render:post|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/messages/render:post} - -{generate_parameter_description(/messages/render:post)} - -## Response - -{generate_return_values_table|zulip.yaml|/messages/render:post} - -{generate_response_description(/messages/render:post)} - -#### Example response - -{generate_code_example|/messages/render:post|fixture(200)} - -{generate_code_example|/messages/render:post|fixture(400)} diff --git a/templates/zerver/api/reorder-custom-profile-fields.md b/templates/zerver/api/reorder-custom-profile-fields.md deleted file mode 100644 index 7e95836637..0000000000 --- a/templates/zerver/api/reorder-custom-profile-fields.md +++ /dev/null @@ -1,36 +0,0 @@ -{generate_api_title(/realm/profile_fields:patch)} - -{generate_api_description(/realm/profile_fields:patch)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/realm/profile_fields:patch|example} - -{generate_code_example(javascript)|/realm/profile_fields:patch|example} - -{tab|curl} - -{generate_code_example(curl)|/realm/profile_fields:patch|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/realm/profile_fields:patch} - -{generate_parameter_description(/realm/profile_fields:patch)} - -## Response - -{generate_return_values_table|zulip.yaml|/realm/profile_fields:patch} - - -{generate_response_description(/realm/profile_fields:patch)} - -#### Example response - -{generate_code_example|/realm/profile_fields:patch|fixture(200)} - -{generate_code_example|/realm/profile_fields:patch|fixture(400)} diff --git a/templates/zerver/api/set-typing-status.md b/templates/zerver/api/set-typing-status.md deleted file mode 100644 index 29086a4c0a..0000000000 --- a/templates/zerver/api/set-typing-status.md +++ /dev/null @@ -1,33 +0,0 @@ -{generate_api_title(/typing:post)} - -{generate_api_description(/typing:post)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/typing:post|example} - -{generate_code_example(javascript)|/typing:post|example} - -{tab|curl} - -{generate_code_example(curl)|/typing:post|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/typing:post} - -{generate_parameter_description(/typing:post)} - -## Response - -{generate_response_description(/typing:post)} - -#### Example response - -{generate_code_example|/typing:post|fixture(200)} - -{generate_code_example|/typing:post|fixture(400)} diff --git a/templates/zerver/api/subscribe.md b/templates/zerver/api/subscribe.md deleted file mode 100644 index 8f1acaed57..0000000000 --- a/templates/zerver/api/subscribe.md +++ /dev/null @@ -1,35 +0,0 @@ -{generate_api_title(/users/me/subscriptions:post)} - -{generate_api_description(/users/me/subscriptions:post)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/users/me/subscriptions:post|example} - -{generate_code_example(javascript)|/users/me/subscriptions:post|example} - -{tab|curl} - -{generate_code_example(curl)|/users/me/subscriptions:post|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/users/me/subscriptions:post} - -{generate_parameter_description(/users/me/subscriptions:post)} - -## Response - -{generate_return_values_table|zulip.yaml|/users/me/subscriptions:post} - -{generate_response_description(/users/me/subscriptions:post)} - -#### Example response - -{generate_code_example|/users/me/subscriptions:post|fixture(200)} - -{generate_code_example|/users/me/subscriptions:post|fixture(400)} diff --git a/templates/zerver/api/unmute-user.md b/templates/zerver/api/unmute-user.md deleted file mode 100644 index bde17180f1..0000000000 --- a/templates/zerver/api/unmute-user.md +++ /dev/null @@ -1,33 +0,0 @@ -{generate_api_title(/users/me/muted_users/{muted_user_id}:delete)} - -{generate_api_description(/users/me/muted_users/{muted_user_id}:delete)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/users/me/muted_users/{muted_user_id}:delete|example} - -{generate_code_example(javascript)|/users/me/muted_users/{muted_user_id}:delete|example} - -{tab|curl} - -{generate_code_example(curl)|/users/me/muted_users/{muted_user_id}:delete|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/users/me/muted_users/{muted_user_id}:delete} - -{generate_parameter_description(/users/me/muted_users/{muted_user_id}:delete)} - -## Response - -{generate_response_description(/users/me/muted_users/{muted_user_id}:delete)} - -#### Example response - -{generate_code_example|/users/me/muted_users/{muted_user_id}:delete|fixture(200)} - -{generate_code_example|/users/me/muted_users/{muted_user_id}:delete|fixture(400)} diff --git a/templates/zerver/api/unsubscribe.md b/templates/zerver/api/unsubscribe.md deleted file mode 100644 index 59d4c69125..0000000000 --- a/templates/zerver/api/unsubscribe.md +++ /dev/null @@ -1,31 +0,0 @@ -{generate_api_title(/users/me/subscriptions:delete)} - -{generate_api_description(/users/me/subscriptions:delete)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/users/me/subscriptions:delete|example} - -{generate_code_example(javascript)|/users/me/subscriptions:delete|example} - -{tab|curl} - -{generate_code_example(curl)|/users/me/subscriptions:delete|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/users/me/subscriptions:delete} - -{generate_return_values_table|zulip.yaml|/users/me/subscriptions:delete} - -{generate_response_description(/users/me/subscriptions:delete)} - -#### Example response - -{generate_code_example|/users/me/subscriptions:delete|fixture(200)} - -{generate_code_example|/users/me/subscriptions:delete|fixture(400)} diff --git a/templates/zerver/api/update-display-settings.md b/templates/zerver/api/update-display-settings.md deleted file mode 100644 index 85d35e1a3a..0000000000 --- a/templates/zerver/api/update-display-settings.md +++ /dev/null @@ -1,33 +0,0 @@ -{generate_api_title(/settings/display:patch)} - -{generate_api_description(/settings/display:patch)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/settings/display:patch|example} - -{generate_code_example(javascript)|/settings/display:patch|example} - -{tab|curl} - -{generate_code_example(curl)|/settings/display:patch|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/settings/display:patch} - -{generate_parameter_description(/settings/display:patch)} - -## Response - -{generate_response_description(/settings/display:patch)} - -#### Example response - -{generate_code_example|/settings/display:patch|fixture(200)} - -{generate_code_example|/settings/display:patch|fixture(400)} diff --git a/templates/zerver/api/update-linkifier.md b/templates/zerver/api/update-linkifier.md deleted file mode 100644 index c966cb3793..0000000000 --- a/templates/zerver/api/update-linkifier.md +++ /dev/null @@ -1,35 +0,0 @@ -{generate_api_title(/realm/filters/{filter_id}:patch)} - -{generate_api_description(/realm/filters/{filter_id}:patch)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/realm/filters/{filter_id}:patch|example} - -{generate_code_example(javascript)|/realm/filters/{filter_id}:patch|example} - -{tab|curl} - -{generate_code_example(curl)|/realm/filters/{filter_id}:patch|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/realm/filters/{filter_id}:patch} - -{generate_parameter_description(/realm/filters/{filter_id}:patch)} - -## Response - -{generate_return_values_table|zulip.yaml|/realm/filters/{filter_id}:patch} - -{generate_response_description(/realm/filters/{filter_id}:patch)} - -#### Example response - -{generate_code_example|/realm/filters/{filter_id}:patch|fixture(200)} - -{generate_code_example|/realm/filters/{filter_id}:patch|fixture(400)} diff --git a/templates/zerver/api/update-message-flags.md b/templates/zerver/api/update-message-flags.md deleted file mode 100644 index 2d0889f15f..0000000000 --- a/templates/zerver/api/update-message-flags.md +++ /dev/null @@ -1,35 +0,0 @@ -{generate_api_title(/messages/flags:post)} - -{generate_api_description(/messages/flags:post)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/messages/flags:post|example} - -{generate_code_example(javascript)|/messages/flags:post|example} - -{tab|curl} - -{generate_code_example(curl)|/messages/flags:post|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/messages/flags:post} - -{generate_parameter_description(/messages/flags:post)} - -## Response - -{generate_return_values_table|zulip.yaml|/messages/flags:post} - -{generate_response_description(/messages/flags:post)} - -#### Example response - -{generate_code_example|/messages/flags:post|fixture(200)} - -{generate_code_example|/messages/flags:post|fixture(400)} diff --git a/templates/zerver/api/update-message.md b/templates/zerver/api/update-message.md deleted file mode 100644 index bad0d96d3d..0000000000 --- a/templates/zerver/api/update-message.md +++ /dev/null @@ -1,33 +0,0 @@ -{generate_api_title(/messages/{message_id}:patch)} - -{generate_api_description(/messages/{message_id}:patch)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/messages/{message_id}:patch|example} - -{generate_code_example(javascript)|/messages/{message_id}:patch|example} - -{tab|curl} - -{generate_code_example(curl)|/messages/{message_id}:patch|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/messages/{message_id}:patch} - -{generate_parameter_description(/messages/{message_id}:patch)} - -## Response - -{generate_response_description(/messages/{message_id}:patch)} - -#### Example response - -{generate_code_example|/messages/{message_id}:patch|fixture(200)} - -{generate_code_example|/messages/{message_id}:patch|fixture(400)} diff --git a/templates/zerver/api/update-notification-settings.md b/templates/zerver/api/update-notification-settings.md deleted file mode 100644 index 83f638cbf2..0000000000 --- a/templates/zerver/api/update-notification-settings.md +++ /dev/null @@ -1,33 +0,0 @@ -{generate_api_title(/settings/notifications:patch)} - -{generate_api_description(/settings/notifications:patch)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/settings/notifications:patch|example} - -{generate_code_example(javascript)|/settings/notifications:patch|example} - -{tab|curl} - -{generate_code_example(curl)|/settings/notifications:patch|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/settings/notifications:patch} - -{generate_parameter_description(/settings/notifications:patch)} - -## Response - -{generate_response_description(/settings/notifications:patch)} - -#### Example response - -{generate_code_example|/settings/notifications:patch|fixture(200)} - -{generate_code_example|/settings/notifications:patch|fixture(400)} diff --git a/templates/zerver/api/update-stream.md b/templates/zerver/api/update-stream.md deleted file mode 100644 index 6011d9376e..0000000000 --- a/templates/zerver/api/update-stream.md +++ /dev/null @@ -1,33 +0,0 @@ -{generate_api_title(/streams/{stream_id}:patch)} - -{generate_api_description(/streams/{stream_id}:patch)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/streams/{stream_id}:patch|example} - -{generate_code_example(javascript)|/streams/{stream_id}:patch|example} - -{tab|curl} - -{generate_code_example(curl)|/streams/{stream_id}:patch|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/streams/{stream_id}:patch} - -{generate_parameter_description(/streams/{stream_id}:patch)} - -## Response - -{generate_response_description(/streams/{stream_id}:patch)} - -#### Example response - -{generate_code_example|/streams/{stream_id}:patch|fixture(200)} - -{generate_code_example|/streams/{stream_id}:patch|fixture(400)} diff --git a/templates/zerver/api/update-subscription-settings.md b/templates/zerver/api/update-subscription-settings.md deleted file mode 100644 index bcfac34b2a..0000000000 --- a/templates/zerver/api/update-subscription-settings.md +++ /dev/null @@ -1,35 +0,0 @@ -{generate_api_title(/users/me/subscriptions/properties:post)} - -{generate_api_description(/users/me/subscriptions/properties:post)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/users/me/subscriptions/properties:post|example} - -{generate_code_example(javascript)|/users/me/subscriptions/properties:post|example} - -{tab|curl} - -{generate_code_example(curl)|/users/me/subscriptions/properties:post|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/users/me/subscriptions/properties:post} - -{generate_parameter_description(/users/me/subscriptions/properties:post)} - -## Response - -{generate_return_values_table|zulip.yaml|/users/me/subscriptions/properties:post} - -{generate_response_description(/users/me/subscriptions/properties:post)} - -#### Example response - -{generate_code_example|/users/me/subscriptions/properties:post|fixture(200)} - -{generate_code_example|/users/me/subscriptions/properties:post|fixture(400)} diff --git a/templates/zerver/api/update-user-group-members.md b/templates/zerver/api/update-user-group-members.md deleted file mode 100644 index 03cae8c763..0000000000 --- a/templates/zerver/api/update-user-group-members.md +++ /dev/null @@ -1,33 +0,0 @@ -{generate_api_title(/user_groups/{user_group_id}/members:post)} - -{generate_api_description(/user_groups/{user_group_id}/members:post)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/user_groups/{user_group_id}/members:post|example} - -{generate_code_example(javascript)|/user_groups/{user_group_id}/members:post|example} - -{tab|curl} - -{generate_code_example(curl)|/user_groups/{user_group_id}/members:post|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/user_groups/{user_group_id}/members:post} - -{generate_parameter_description(/user_groups/{user_group_id}/members:post)} - -## Response - -{generate_response_description(/user_groups/{user_group_id}/members:post)} - -#### Example response - -{generate_code_example|/user_groups/{user_group_id}/members:post|fixture(200)} - -{generate_code_example|/user_groups/{user_group_id}/members:post|fixture(400)} diff --git a/templates/zerver/api/update-user-group.md b/templates/zerver/api/update-user-group.md deleted file mode 100644 index f2db9049ae..0000000000 --- a/templates/zerver/api/update-user-group.md +++ /dev/null @@ -1,33 +0,0 @@ -{generate_api_title(/user_groups/{user_group_id}:patch)} - -{generate_api_description(/user_groups/{user_group_id}:patch)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/user_groups/{user_group_id}:patch|example} - -{generate_code_example(javascript)|/user_groups/{user_group_id}:patch|example} - -{tab|curl} - -{generate_code_example(curl)|/user_groups/{user_group_id}:patch|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/user_groups/{user_group_id}:patch} - -{generate_parameter_description(/user_groups/{user_group_id}:patch)} - -## Response - -{generate_response_description(/user_groups/{user_group_id}:patch)} - -#### Example response - -{generate_code_example|/user_groups/{user_group_id}:patch|fixture(200)} - -{generate_code_example|/user_groups/{user_group_id}:patch|fixture(400)} diff --git a/templates/zerver/api/update-user.md b/templates/zerver/api/update-user.md deleted file mode 100644 index 629e65418f..0000000000 --- a/templates/zerver/api/update-user.md +++ /dev/null @@ -1,33 +0,0 @@ -{generate_api_title(/users/{user_id}:patch)} - -{generate_api_description(/users/{user_id}:patch)} - -## Usage examples - -{start_tabs} - -{generate_code_example(python)|/users/{user_id}:patch|example} - -{generate_code_example(javascript)|/users/{user_id}:patch|example} - -{tab|curl} - -{generate_code_example(curl)|/users/{user_id}:patch|example} - -{end_tabs} - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/users/{user_id}:patch} - -{generate_parameter_description(/users/{user_id}:patch)} - -## Response - -{generate_response_description(/users/{user_id}:patch)} - -#### Example response - -{generate_code_example|/users/{user_id}:patch|fixture(200)} - -{generate_code_example|/users/{user_id}:patch|fixture(400)} diff --git a/templates/zerver/api/upload-custom-emoji.md b/templates/zerver/api/upload-custom-emoji.md deleted file mode 100644 index 78268f6ad3..0000000000 --- a/templates/zerver/api/upload-custom-emoji.md +++ /dev/null @@ -1,35 +0,0 @@ -{generate_api_title(/realm/emoji/{emoji_name}:post)} - -{generate_api_description(/realm/emoji/{emoji_name}:post)} - -## Usage examples - -{start_tabs} - - -{generate_code_example(python)|/realm/emoji/{emoji_name}:post|example} - -{generate_code_example(javascript)|/realm/emoji/{emoji_name}:post|example} - -{tab|curl} - -{generate_code_example(curl)|/realm/emoji/{emoji_name}:post|example} - -{end_tabs} - - -## Parameters - -{generate_api_arguments_table|zulip.yaml|/realm/emoji/{emoji_name}:post} - -{generate_parameter_description(/realm/emoji/{emoji_name}:post)} - -## Response - -{generate_response_description(/realm/emoji/{emoji_name}:post)} - -#### Example response - -{generate_code_example|/realm/emoji/{emoji_name}:post|fixture(200)} - -{generate_code_example|/realm/emoji/{emoji_name}:post|fixture(400)} diff --git a/templates/zerver/api/upload-file.md b/templates/zerver/api/upload-file.md deleted file mode 100644 index ded8f6bc1d..0000000000 --- a/templates/zerver/api/upload-file.md +++ /dev/null @@ -1,34 +0,0 @@ -{generate_api_title(/user_uploads:post)} - -{generate_api_description(/user_uploads:post)} - -## Usage examples - -{start_tabs} - - -{generate_code_example(python)|/user_uploads:post|example} - -{generate_code_example(javascript)|/user_uploads:post|example} - -{tab|curl} - -{generate_code_example(curl)|/user_uploads:post|example} - -{end_tabs} - -## Parameters - -{generate_parameter_description(/user_uploads:post)} - -## Response - -{generate_return_values_table|zulip.yaml|/user_uploads:post} - -{generate_response_description(/user_uploads:post)} - -#### Example response - -{generate_code_example|/user_uploads:post|fixture(200)} - -{generate_code_example|/user_uploads:post|fixture(400)} diff --git a/zerver/lib/templates.py b/zerver/lib/templates.py index 736c09c059..6000886d9d 100644 --- a/zerver/lib/templates.py +++ b/zerver/lib/templates.py @@ -150,7 +150,6 @@ def render_markdown_path( md_engine.reset() jinja = engines["Jinja2"] - try: # By default, we do both Jinja2 templating and Markdown # processing on the file, to make it easy to use both Jinja2 @@ -169,6 +168,8 @@ def render_markdown_path( else: raise e + API_ENDPOINT_NAME = context.get("API_ENDPOINT_NAME", "") + markdown_string = markdown_string.replace("API_ENDPOINT_NAME", API_ENDPOINT_NAME) html = md_engine.convert(markdown_string) rendered_html = jinja.from_string(html).render(context) diff --git a/zerver/views/documentation.py b/zerver/views/documentation.py index 944686d692..4b4a36b28d 100644 --- a/zerver/views/documentation.py +++ b/zerver/views/documentation.py @@ -84,13 +84,32 @@ class MarkdownDirectoryView(ApiURLView): http_status = 404 path = self.path_template % (article,) + endpoint_name = None + endpoint_method = None + + # The following is a somewhat hacky approach to extract titles from articles. + # Hack: `context["article"] has a leading `/`, so we use + to add directories. + article_path = os.path.join(settings.DEPLOY_ROOT, "templates") + path + + if (not os.path.exists(article_path)) and self.path_template == "/zerver/api/%s.md": + endpoint_path = article.replace("-", "_") + try: + endpoint_name, endpoint_method = get_endpoint_from_operationid(endpoint_path) + path = "/zerver/api/api-doc-template.md" + except AssertionError: + return DocumentationArticle( + article_path=self.path_template % ("missing",), + article_http_status=404, + endpoint_path=None, + endpoint_method=None, + ) try: loader.get_template(path) return DocumentationArticle( article_path=path, article_http_status=http_status, - endpoint_path=None, - endpoint_method=None, + endpoint_path=endpoint_name, + endpoint_method=endpoint_method, ) except loader.TemplateDoesNotExist: return DocumentationArticle( @@ -129,12 +148,19 @@ class MarkdownDirectoryView(ApiURLView): with open(article_path) as article_file: first_line = article_file.readlines()[0] # Strip the header and then use the first line to get the article title - if self.path_template == "/zerver/api/%s.md" and "{generate_api_title(" in first_line: + if context["article"] == "/zerver/api/api-doc-template.md": + endpoint_name, endpoint_method = ( + documentation_article.endpoint_path, + documentation_article.endpoint_method, + ) + article_title = get_openapi_summary(endpoint_name, endpoint_method) + elif self.path_template == "/zerver/api/%s.md" and "{generate_api_title(" in first_line: api_operation = context["OPEN_GRAPH_URL"].split("/api/")[1].replace("-", "_") - endpoint_path, endpoint_method = get_endpoint_from_operationid(api_operation) - article_title = get_openapi_summary(endpoint_path, endpoint_method) + endpoint_name, endpoint_method = get_endpoint_from_operationid(api_operation) + article_title = get_openapi_summary(endpoint_name, endpoint_method) else: article_title = first_line.lstrip("#").strip() + endpoint_name = endpoint_method = None if context["not_index_page"]: context["OPEN_GRAPH_TITLE"] = f"{article_title} ({title_base})" else: @@ -150,6 +176,8 @@ class MarkdownDirectoryView(ApiURLView): add_api_uri_context(api_uri_context, self.request) api_uri_context["run_content_validators"] = True context["api_uri_context"] = api_uri_context + if endpoint_name and endpoint_method: + context["api_uri_context"]["API_ENDPOINT_NAME"] = endpoint_name + ":" + endpoint_method add_google_analytics_context(context) return context