Refa: migrate document preview/download to RESTful API (#14633)

### What problem does this PR solve?

migrate document preview/download to RESTful API

### Type of change
- [x] Refactoring
This commit is contained in:
buua436
2026-05-08 13:26:13 +08:00
committed by GitHub
parent 412fae7ac2
commit f703169117
11 changed files with 155 additions and 96 deletions

View File

@@ -6879,14 +6879,18 @@ Failure:
##### Request example
```bash
```
curl --request GET \
--url 'http://{address}/api/v1/documents/{doc_id}/download?ext=pdf' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--output ./downloaded_attachment.pdf
```
##### Request parameters
- `doc_id`: (*Path parameter*), `string`, *Required*
The document ID whose attachment should be downloaded.
- `ext`: (*Query parameter*), `string`, *Optional*
A file extension hint specifying the response's Content-Type. Defaults to `"markdown"`. Available values:
A file extension hint specifying the response's Content-Type. Defaults to `"markdown"`. Available values:
- `"markdown"`
- `"html"`
- `"pdf"`
@@ -6896,15 +6900,15 @@ Downloads a runtime attachment previously uploaded via the [Upload document](#up
#### Response
Success:
Success:
Returns the file content as a binary stream with the relevant Content-Type header.
Failure:
```json
{
"code": 500,
{
"code": 500,
"message": "Internal server error"
}
```