201 lines
6.3 KiB
HTTP
201 lines
6.3 KiB
HTTP
### AttachmentController 接口测试
|
||
### 在 IDEA 中选择 dev 或 prod 环境后执行
|
||
|
||
@attachmentId =
|
||
@attachmentBizType = TEMP_FILE
|
||
@attachmentBizId = demo-biz-id
|
||
@attachmentAttachType = SOURCE
|
||
@attachmentName = demo.png
|
||
@attachmentFilePath = E:/Temp/demo.png
|
||
@attachmentTempFileId =
|
||
|
||
### 查询附件详情
|
||
### 前置条件:`id` 必须传有效附件 ID
|
||
### 请求参数:URL 参数 `id` 为附件 ID
|
||
### 返回参数:Attachment,详见 ./object/common.md
|
||
POST {{baseUrl}}/attach/detail?id={{attachmentId}}
|
||
Token: {{user_token}}
|
||
|
||
### 创建附件
|
||
### 前置条件:回填 `attachmentFilePath` 为本地文件绝对路径
|
||
### 请求参数:multipart/form-data
|
||
### 返回参数:Attachment,详见 ./object/common.md
|
||
POST {{baseUrl}}/attach/create
|
||
Content-Type: multipart/form-data; boundary=AttachmentCreateBoundary
|
||
Token: {{user_token}}
|
||
|
||
--AttachmentCreateBoundary
|
||
Content-Disposition: form-data; name="bizType"
|
||
|
||
{{attachmentBizType}}
|
||
--AttachmentCreateBoundary
|
||
Content-Disposition: form-data; name="bizId"
|
||
|
||
{{attachmentBizId}}
|
||
--AttachmentCreateBoundary
|
||
Content-Disposition: form-data; name="attachType"
|
||
|
||
{{attachmentAttachType}}
|
||
--AttachmentCreateBoundary
|
||
Content-Disposition: form-data; name="name"
|
||
|
||
{{attachmentName}}
|
||
--AttachmentCreateBoundary
|
||
Content-Disposition: form-data; name="file"; filename="demo.png"
|
||
Content-Type: application/octet-stream
|
||
|
||
< {{attachmentFilePath}}
|
||
--AttachmentCreateBoundary--
|
||
|
||
### 更新附件元数据
|
||
### 前置条件:`id` 必须传有效附件 ID
|
||
### 请求参数:multipart/form-data
|
||
### 返回参数:无
|
||
POST {{baseUrl}}/attach/update
|
||
Content-Type: multipart/form-data; boundary=AttachmentUpdateMetaBoundary
|
||
Token: {{user_token}}
|
||
|
||
--AttachmentUpdateMetaBoundary
|
||
Content-Disposition: form-data; name="id"
|
||
|
||
{{attachmentId}}
|
||
--AttachmentUpdateMetaBoundary
|
||
Content-Disposition: form-data; name="name"
|
||
|
||
{{attachmentName}}-updated
|
||
--AttachmentUpdateMetaBoundary
|
||
Content-Disposition: form-data; name="attachType"
|
||
|
||
{{attachmentAttachType}}
|
||
--AttachmentUpdateMetaBoundary--
|
||
|
||
### 更新附件文件
|
||
### 前置条件:`id` 必须传有效附件 ID,`attachmentFilePath` 必须传本地文件绝对路径
|
||
### 请求参数:multipart/form-data
|
||
### 返回参数:无
|
||
POST {{baseUrl}}/attach/update
|
||
Content-Type: multipart/form-data; boundary=AttachmentUpdateFileBoundary
|
||
Token: {{user_token}}
|
||
|
||
--AttachmentUpdateFileBoundary
|
||
Content-Disposition: form-data; name="id"
|
||
|
||
{{attachmentId}}
|
||
--AttachmentUpdateFileBoundary
|
||
Content-Disposition: form-data; name="name"
|
||
|
||
{{attachmentName}}-file-updated
|
||
--AttachmentUpdateFileBoundary
|
||
Content-Disposition: form-data; name="file"; filename="demo.png"
|
||
Content-Type: application/octet-stream
|
||
|
||
< {{attachmentFilePath}}
|
||
--AttachmentUpdateFileBoundary--
|
||
|
||
### 删除附件
|
||
### 前置条件:`id` 必须传有效附件 ID
|
||
### 请求参数:URL 参数 `id` 为附件 ID
|
||
### 返回参数:无
|
||
POST {{baseUrl}}/attach/delete?id={{attachmentId}}
|
||
Token: {{user_token}}
|
||
|
||
### 按业务查询单个附件
|
||
### 前置条件:`bizType` 和 `bizId` 必须传有效值
|
||
### 请求参数:URL 参数 `bizType`、`bizId`
|
||
### 返回参数:Attachment,详见 ./object/common.md
|
||
GET {{baseUrl}}/attach/detail/byBiz?bizType={{attachmentBizType}}&bizId={{attachmentBizId}}
|
||
Token: {{user_token}}
|
||
|
||
### 按业务和附件类型查询单个附件
|
||
### 前置条件:`bizType`、`bizId`、`attachType` 必须传有效值
|
||
### 请求参数:URL 参数 `bizType`、`bizId`、`attachType`
|
||
### 返回参数:Attachment,详见 ./object/common.md
|
||
GET {{baseUrl}}/attach/detail/byAttachType?bizType={{attachmentBizType}}&bizId={{attachmentBizId}}&attachType={{attachmentAttachType}}
|
||
Token: {{user_token}}
|
||
|
||
### 按业务查询附件列表
|
||
### 前置条件:`bizType` 和 `bizId` 必须传有效值
|
||
### 请求参数:URL 参数 `bizType`、`bizId`,可重复传 `attachTypeList`
|
||
### 返回参数:Attachment[]
|
||
GET {{baseUrl}}/attach/list/byBiz?bizType={{attachmentBizType}}&bizId={{attachmentBizId}}&attachTypeList={{attachmentAttachType}}
|
||
Token: {{user_token}}
|
||
|
||
### 按业务统计附件数量
|
||
### 前置条件:`bizType` 和 `bizId` 必须传有效值
|
||
### 请求参数:URL 参数 `bizType`、`bizId`,可重复传 `attachTypeList`
|
||
### 返回参数:number
|
||
GET {{baseUrl}}/attach/count/byBiz?bizType={{attachmentBizType}}&bizId={{attachmentBizId}}&attachTypeList={{attachmentAttachType}}
|
||
Token: {{user_token}}
|
||
|
||
### 按业务分页查询附件
|
||
### 前置条件:`bizType` 和 `bizId` 必须传有效值
|
||
### 请求参数:URL 参数 `bizType`、`bizId`,可重复传 `attachTypeList`,请求体为 Page
|
||
### 返回参数:PageResult<Attachment>
|
||
POST {{baseUrl}}/attach/page/byBiz?bizType={{attachmentBizType}}&bizId={{attachmentBizId}}&attachTypeList={{attachmentAttachType}}
|
||
Content-Type: application/json
|
||
Token: {{user_token}}
|
||
|
||
{
|
||
"index": 0,
|
||
"size": 10
|
||
}
|
||
|
||
### 按业务差分更新附件
|
||
### 前置条件:新增项需要传有效 `tempFileId`
|
||
### 请求参数:BizUpdateReq
|
||
### 返回参数:无
|
||
POST {{baseUrl}}/attach/update/byBiz
|
||
Content-Type: application/json
|
||
Token: {{user_token}}
|
||
|
||
{
|
||
"bizType": "{{attachmentBizType}}",
|
||
"bizId": "{{attachmentBizId}}",
|
||
"items": [
|
||
{
|
||
"id": "{{attachmentId}}",
|
||
"attachType": "{{attachmentAttachType}}",
|
||
"name": "{{attachmentName}}-biz-updated"
|
||
},
|
||
{
|
||
"tempFileId": "{{attachmentTempFileId}}",
|
||
"attachType": "{{attachmentAttachType}}",
|
||
"name": "{{attachmentName}}-from-temp"
|
||
}
|
||
]
|
||
}
|
||
|
||
### 按业务删除全部附件
|
||
### 前置条件:`bizType` 和 `bizId` 必须传有效值
|
||
### 请求参数:BizDeleteReq
|
||
### 返回参数:无
|
||
POST {{baseUrl}}/attach/delete/byBiz
|
||
Content-Type: application/json
|
||
Token: {{user_token}}
|
||
|
||
{
|
||
"bizType": "{{attachmentBizType}}",
|
||
"bizId": "{{attachmentBizId}}"
|
||
}
|
||
|
||
### 读取附件原图
|
||
### 前置条件:`attachmentId` 必须传有效附件 ID
|
||
### 请求参数:路径参数 `id`
|
||
### 返回参数:附件二进制流
|
||
GET {{baseUrl}}/attach/read/{{attachmentId}}
|
||
Token: {{user_token}}
|
||
|
||
### 读取附件缩略图
|
||
### 前置条件:`attachmentId` 必须传有效图片或视频附件 ID
|
||
### 请求参数:路径参数 `id`,URL 参数 `thumbWidth`、`thumbHeight`
|
||
### 返回参数:附件二进制流
|
||
GET {{baseUrl}}/attach/read/{{attachmentId}}?thumbWidth=200&thumbHeight=200
|
||
Token: {{user_token}}
|
||
|
||
### 下载附件
|
||
### 前置条件:`attachmentId` 必须传有效附件 ID
|
||
### 请求参数:路径参数 `id`
|
||
### 返回参数:附件二进制流
|
||
GET {{baseUrl}}/attach/download/{{attachmentId}}
|
||
Token: {{user_token}}
|