tss-rocks/api/schemas/paths/media.yaml
CDN 05ddc1f783
Some checks failed
Build Backend / Build Docker Image (push) Successful in 3m33s
Test Backend / test (push) Failing after 31s
[feature] migrate to monorepo
2025-02-21 00:49:20 +08:00

111 lines
3.1 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

media:
get:
tags:
- media
summary: 获取媒体文件列表
operationId: listMedia
parameters:
- $ref: '../components/parameters.yaml#/Page'
- $ref: '../components/parameters.yaml#/PerPage'
- $ref: '../components/parameters.yaml#/Sort'
- name: mime_type
in: query
schema:
type: string
description: 按 MIME 类型筛选
responses:
'200':
description: 成功获取媒体文件列表
content:
application/json:
schema:
allOf:
- $ref: '../components/schemas.yaml#/Response'
- type: object
properties:
data:
type: array
items:
$ref: '../components/schemas.yaml#/Media'
'401':
$ref: '../components/responses.yaml#/Unauthorized'
post:
tags:
- media
summary: 上传媒体文件
description: |
上传媒体文件。对于图片文件:
- 支持的输入格式JPEG、PNG、GIF
- 所有图片将自动转换为 WebP 格式
- 使用无损压缩以保持图片质量
- 保持原始图片尺寸
operationId: uploadMedia
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
required:
- file
properties:
file:
type: string
format: binary
description: |
要上传的文件。
对于图片文件,将自动转换为 WebP 格式。
支持的图片格式image/jpeg, image/png, image/gif
responses:
'201':
description: 媒体文件上传成功
content:
application/json:
schema:
type: object
properties:
data:
$ref: '../components/schemas.yaml#/Media'
'401':
$ref: '../components/responses.yaml#/Unauthorized'
'403':
$ref: '../components/responses.yaml#/Forbidden'
'422':
$ref: '../components/responses.yaml#/ValidationError'
media_id:
parameters:
- $ref: '../components/parameters.yaml#/Id'
get:
tags:
- media
summary: 获取媒体文件详情
operationId: getMedia
responses:
'200':
description: 成功获取媒体文件详情
content:
application/json:
schema:
type: object
properties:
data:
$ref: '../components/schemas.yaml#/Media'
'404':
$ref: '../components/responses.yaml#/NotFound'
delete:
tags:
- media
summary: 删除媒体文件
operationId: deleteMedia
parameters:
- $ref: '../components/parameters.yaml#/Id'
responses:
'204':
description: 媒体文件删除成功
'401':
$ref: '../components/responses.yaml#/Unauthorized'
'403':
$ref: '../components/responses.yaml#/Forbidden'
'404':
$ref: '../components/responses.yaml#/NotFound'