Skip to main content
Files

File 数据结构

Forward File API 复用的响应结构。

File 对象

上传、查询、列表接口都会返回该结构。
字段类型说明
idstringFile ID,前缀为 file_
typestring固定值 "file"
filenamestring存储后的文件名
size_bytesinteger文件大小,单位 byte
mime_typestring上传时提供或根据文件名检测的 MIME type
downloadableboolean是否可通过 /content 端点下载
scopeobject | null文件关联到其他资源时的 scope,例如 { "id": "sess_...", "type": "session" };未挂载时为 null
metadataobject上传时传入的自定义元数据对象;省略时为 {}created_by 为 Forward 保留字段,调用方不可传入
identity_idstring | nullForward 归属身份;PAT 创建时通常为 null
icon_urlstring | nullForward 关联的 icon URL
binding_infoBinding info绑定信息(Template 引用计数等)
created_atstring创建时间,RFC 3339 格式
updated_atstring最后更新时间,RFC 3339 格式

支持上传的文件类型

上传接口只接受文本类文件。
类别支持的值
MIME type任意 text/* MIME type,以及 application/jsonapplication/xmlapplication/javascriptapplication/x-yamlapplication/x-toml
文件扩展名.txt.md.csv.json.xml.yaml.yml.toml.ini.conf.cfg.env.log.html.htm.css.scss.less.js.jsx.ts.tsx.vue.svelte.py.go.rs.java.kt.scala.c.cpp.cc.h.hpp.rb.php.swift.r.lua.pl.sh.bash.zsh.fish.ps1.sql.graphql.gql.proto.dockerfile.makefile.gitignore.editorconfig.eslintrc.prettierrc.tex.rst.adoc.org.svg
无扩展名文件名dockerfilemakefilegemfilerakefileprocfilevagrantfilejustfilebrewfile

File 下载响应对象

下载 File 接口返回该结构,包含短期有效的预签名 URL。
字段类型说明
urlstring预签名下载 URL
expires_atstringURL 过期时间,RFC 3339 格式
filenamestring建议的下载文件名(用于浏览器 Content-Disposition

Binding info

Forward 在 File 响应中携带的引用聚合。
字段类型说明
agent_template_countinteger当前绑定该 File 的 Template 数量

列表分页字段

字段类型说明
dataFile 对象 数组当前页记录
has_moreboolean是否还有下一页
next_pagestring | null下一页向后游标(推荐使用);has_more=true 时等于当前页 last_id,否则为 null
first_idstring | null当前页第一条记录 ID
last_idstring | null当前页最后一条记录 ID
请求侧的三种游标参数 page / after_id / before_id 互斥,同时提供多个返回 400;推荐使用 page,语义等价于 after_id