图片
图片帖的发布、查询和互动操作接口。
获取图片列表
POST
/api/trpc/image.list公开| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
limit | number | 是 | 每页数量 |
page | number | 是 | 页码 |
search | string | 否 | 搜索关键词 |
tagSlugs | string[] | 否 | 标签 slug 筛选 |
sortBy | string | 否 | 排序:latest / views |
获取图片详情
POST
/api/trpc/image.getById公开| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
id | string | 是 | 图片帖 ID |
创建图片帖
POST
/api/trpc/image.create需登录content:write| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
title | string | 是 | 标题(1-200 字符) |
images | string[] | 是 | 图片 URL 数组(至少一张) |
description | string | 否 | 描述(最长 5000 字符) |
tagNames | string[] | 否 | 标签名称数组 |
curl -X POST 'https://your-domain.com/api/trpc/image.create' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer sk-your-api-key' \
-d '{"json":{"title":"图片标题","images":["https://example.com/img1.jpg","https://example.com/img2.jpg"],"tagNames":["标签1"]}}'批量创建图片帖
POST
/api/trpc/image.batchCreate需登录content:write| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
posts | object[] | 是 | 图片帖数组,每项同单个创建的字段 |
更新图片帖
POST
/api/trpc/image.update需登录content:write| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
id | string | 是 | 图片帖 ID |
title | string | 否 | 新标题 |
description | string | 否 | 新描述 |
images | string[] | 否 | 新图片 URL 数组 |
tagNames | string[] | 否 | 新标签 |
图片互动
POST
/api/trpc/image.toggleReaction需登录content:write| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
imagePostId | string | 是 | 图片帖 ID |
type | string | 是 | like 或 dislike |
POST
/api/trpc/image.toggleFavorite需登录content:write| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
imagePostId | string | 是 | 图片帖 ID |