mirror of
				https://github.com/zulip/zulip.git
				synced 2025-10-31 12:03:46 +00:00 
			
		
		
		
	api_docs: Update get-file-temporary-url endpoint and add to sidebar.
Co-authored-by: Lauryn Menard <lauryn@zulip.com>
This commit is contained in:
		| @@ -5,6 +5,7 @@ | ||||
| # based on Zulip's OpenAPI definitions, as well as test setup and | ||||
| # fetching of appropriate parameter values to use when running the | ||||
| # cURL examples as part of the tools/test-api test suite. | ||||
| import re | ||||
| from collections.abc import Callable | ||||
| from functools import wraps | ||||
| from typing import Any | ||||
| @@ -413,3 +414,16 @@ def add_channel_folders() -> dict[str, object]: | ||||
|     channel_folders = ChannelFolder.objects.filter(realm=realm) | ||||
|  | ||||
|     return {"order": [folder.id for folder in channel_folders]} | ||||
|  | ||||
|  | ||||
| @openapi_param_value_generator(["/user_uploads/{realm_id_str}/{filename}:get"]) | ||||
| def get_temporary_url_for_uploaded_file() -> dict[str, object]: | ||||
|     realm_id = "" | ||||
|     filename = "" | ||||
|     user_profile = helpers.example_user("iago") | ||||
|     url = upload_message_attachment("dummy.txt", "text/plain", b"zulip!", user_profile)[0] | ||||
|     upload_path_parts = re.match(r"/user_uploads/(\d+)/(.*)", url) | ||||
|     if upload_path_parts: | ||||
|         realm_id = upload_path_parts[1] | ||||
|         filename = upload_path_parts[2] | ||||
|     return {"realm_id_str": realm_id, "filename": filename} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user