# 回收站
# 回收站文件列表
功能:查询回收站内的文件列表,包含文件夹。
路径:fs/bs/recycleBin
。
请求方法:GET
。
请求参数:
参数 | 必须 | 类型 | 备注 |
---|---|---|---|
appUserId | 是 | string | 业务用户 ID |
请求示例:
点击查看
export async function GET(
appUserId: string
): Promise<ResponseBody<(IflydocsBinFile & IflydocsFileSize)[]>> {
const method = 'GET'
const path = '/fs/bs/recycleBin'
const { nonce, timestamp } = genNonce()
const signature = sign(method, path, nonce, timestamp)
const Authorization = authorization(signature)
const headers = {
Authorization,
nonce,
timestamp,
}
const params = {
appUserId,
}
const resp = await axios.get(path, {
params,
paramsSerializer: (params) => qs.stringify(params),
headers,
})
return resp.data
}
响应示例:
点击查看
{
"code": 0,
"message": "success",
"data": []
}
# 恢复文件
功能:恢复回收站中被删除的文件、文件夹,放回原处。
路径:fs/bs/recycleBin/revert
。
请求方法:PUT
。
请求参数:
参数 | 必须 | 类型 | 备注 |
---|---|---|---|
fidList | 是 | string[] | 待恢复的文件 ID 列表 |
appUserId | 是 | string | 业务用户 ID |
parentExist | 否 | boolean | 上级文件夹是否必须存在 |
请求示例:
点击查看
export async function PUT(
fidList: string[],
appUserId: string,
parentExist?: boolean
): Promise<ResponseBody<null>> {
const method = 'PUT'
const path = '/fs/bs/recycleBin/revert'
const { nonce, timestamp } = genNonce()
const signature = sign(method, path, nonce, timestamp)
const Authorization = authorization(signature)
const headers = {
Authorization,
nonce,
timestamp,
}
const data = {
fidList,
appUserId,
parentExist,
}
if (typeof parentExist === 'undefined') {
delete data.parentExist
}
const resp = await axios.put(path, data, {
headers,
})
return resp.data
}
响应示例:
点击查看
{
"code": 0,
"message": "已恢复至\"我的空间\"",
"data": null
}
# 彻底删除文件
功能:清除回收站中被删除的文件、文件夹,无法恢复。
路径:fs/bs/recycleBin/delete
。
请求方法:DELETE
。
请求参数:
参数 | 必须 | 类型 | 备注 |
---|---|---|---|
fidList | 是 | string[] | 待彻底删除的文件 ID 列表 |
appUserId | 是 | string | 业务用户 ID |
请求示例:
点击查看
export async function DELETE(
fidList: string[],
appUserId: string
): Promise<ResponseBody<null>> {
const method = 'DELETE'
const path = '/fs/bs/recycleBin/delete'
const { nonce, timestamp } = genNonce()
const signature = sign(method, path, nonce, timestamp)
const Authorization = authorization(signature)
const headers = {
Authorization,
nonce,
timestamp,
}
const data = {
fidList,
appUserId,
}
const resp = await axios.delete(path, {
data,
headers,
})
return resp.data
}
响应示例:
点击查看
{
"code": 0,
"message": "success",
"data": null
}
# 回收站空间大小
功能:获取用户回收站空间占用大小
路径:fs/bs/recycleBin/size
。
请求方法:GET
。
请求参数:
参数 | 必须 | 类型 | 备注 |
---|---|---|---|
appUserIdList | 是 | string[] | 业务用户 ID 列表 |
请求示例:
点击查看
/**
* 获取用户回收站空间占用大小,单位字节。
* @param appUserIdList 业务用户 ID 列表
*/
export async function GET(
appUserIdList: string[]
): Promise<ResponseBody<{ appUserId: string; size: number }[]>> {
const method = 'GET'
const path = '/fs/bs/recycleBin/size'
const { nonce, timestamp } = genNonce()
const signature = sign(method, path, nonce, timestamp)
const Authorization = authorization(signature)
const headers = {
Authorization,
nonce,
timestamp,
}
const params = {
appUserIdList,
}
const resp = await axios.get(path, {
headers,
params,
paramsSerializer: (params) => qs.stringify(params),
})
return resp.data
}
响应示例:
点击查看
{
"code": 0,
"message": "success",
"data": [
{
"appUserId": "dev-docs-001",
"size": 0
}
]
}