Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
api_docs: Document POST /bots/{bot_id}/api_key/regenerate.
Agnish Bauri7e0a77834c3b
diff --git a/api_docs/include/rest-endpoints.md b/api_docs/include/rest-endpoints.mdindex 7946f10bbcd..6fad169dd39 100644--- a/api_docs/include/rest-endpoints.md+++ b/api_docs/include/rest-endpoints.md@@ -118,6 +118,7 @@* [Remove alert words](/api/remove-alert-words)* [Regenerate your API key](/api/regenerate-api-key)* [Get a bot's API key](/api/get-bot-api-key)+* [Regenerate a bot's API key](/api/regenerate-bot-api-key)#### Invitationsdiff --git a/zerver/openapi/curl_param_value_generators.py b/zerver/openapi/curl_param_value_generators.pyindex 0fe1c44744f..c2873a4e799 100644--- a/zerver/openapi/curl_param_value_generators.py+++ b/zerver/openapi/curl_param_value_generators.py@@ -447,3 +447,10 @@ def regenerate_api_key_test_user() -> dict[str, object]:# Change authentication line to allow test_client to regenerate its own key.AUTHENTICATION_LINE[0] = f"{test_user.email}:{test_user_api_key}"return {}+++@openapi_param_value_generator(["/bots/{bot_id}/api_key/regenerate:post"])+def regenerate_bot_api_key_test() -> dict[str, object]:+ bot = UserProfile.objects.filter(is_bot=True, realm=get_realm("zulip")).first()+ assert bot is not None+ return {"bot_id": bot.id}diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yamlindex 079517747c7..8f8e180273d 100644--- a/zerver/openapi/zulip.yaml+++ b/zerver/openapi/zulip.yaml@@ -25504,6 +25504,55 @@ paths:"api_key": "hkA04ZYcqXKalvYMA8OeXSfzUOLrtbZv",}+ "400":+ description: Bad request.+ content:+ application/json:+ schema:+ allOf:+ - $ref: "#/components/schemas/CodedError"+ - example:+ {+ "code": "BAD_REQUEST",+ "msg": "No such bot",+ "result": "error",+ }+ description: |+ An example JSON response when the bot ID is invalid:+ /bots/{bot_id}/api_key/regenerate:+ post:+ operationId: regenerate-bot-api-key+ summary: Regenerate a bot's API key+ tags: ["users"]+ description: |+ Generate a new API key for a bot user. Only the bot's owner and+ organization administrators have access to a bot's API key.+ parameters:+ - $ref: "#/components/parameters/BotId"+ responses:+ "200":+ description: Success.+ content:+ application/json:+ schema:+ allOf:+ - $ref: "#/components/schemas/JsonSuccessBase"+ - additionalProperties: false+ properties:+ result: {}+ msg: {}+ ignored_parameters_unsupported: {}+ api_key:+ type: string+ description: |+ The new API key for the bot.+ example:+ {+ "msg": "",+ "result": "success",+ "api_key": "hkA04ZYcqXKalvYMA8OeXSfzUOLrtbZv",+ }+"400":description: Bad request.content:diff --git a/zerver/tests/test_openapi.py b/zerver/tests/test_openapi.pyindex 54c82071232..1ec3040f447 100644--- a/zerver/tests/test_openapi.py+++ b/zerver/tests/test_openapi.py@@ -240,7 +240,6 @@ class OpenAPIArgumentsTest(ZulipTestCase):"/realm/domains/{domain}","/bots","/bots/{bot_id}",- "/bots/{bot_id}/api_key/regenerate",#### These "organization settings" endpoints have low value to document:"/realm/profile_fields/{field_id}","/realm/icon",