Skip to content

feat(api): define Feed/Chatter API protocol endpoints#734

Merged
hotlong merged 2 commits intomainfrom
copilot/define-feed-chatter-api-endpoints
Feb 19, 2026
Merged

feat(api): define Feed/Chatter API protocol endpoints#734
hotlong merged 2 commits intomainfrom
copilot/define-feed-chatter-api-endpoints

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 19, 2026

Feed/Chatter data models and UI props landed in PR#732 but lack corresponding API endpoint contracts. This adds the HTTP interface specification for Feed CRUD, Reactions, and Subscription.

src/api/feed-api.zod.ts

8 endpoints following existing contract patterns (BaseResponseSchema.extend(), Zod-first, .describe() annotations):

  • Feed CRUDGET /feed (cursor pagination + type filter), POST /feed, PUT /feed/:feedId, DELETE /feed/:feedId
  • ReactionsPOST /feed/:feedId/reactions, DELETE /feed/:feedId/reactions/:emoji
  • SubscriptionPOST /subscribe, DELETE /subscribe

All under base path /api/data/:object/:recordId/.

Reuses existing data-layer schemas (FeedItemSchema, ReactionSchema, MentionSchema, RecordSubscriptionSchema) — no duplication.

Includes FeedApiErrorCode enum and FeedApiContracts registry for SDK/doc generation:

import { FeedApiContracts, GetFeedRequestSchema } from '@objectstack/spec';

// Contract registry maps method + path + input/output for all 8 endpoints
FeedApiContracts.listFeed.method   // 'GET'
FeedApiContracts.listFeed.path     // '/api/data/:object/:recordId/feed'
FeedApiContracts.addReaction.input // AddReactionRequestSchema

// Request validation with defaults
const req = GetFeedRequestSchema.parse({
  object: 'account',
  recordId: 'rec_123',
}); // → { type: 'all', limit: 20, cursor: undefined, ... }

Other changes

  • src/api/index.ts — export feed-api.zod
  • ROADMAP.md — API Protocol line updated
  • 45 tests covering all schemas, defaults, validation, error codes, and contract registry
Original prompt

This section details on the original issue you should resolve

<issue_title>定义 Feed/Chatter 协议 API 端点(Feed CRUD、Reactions、Subscription)</issue_title>
<issue_description>### 背景

[Feed/Chatter 协议相关数据模型、UI props 已完成](#731 & PR#732)。目前暂无配套的 API 协议,无法规范服务端和前端协作的接口约定。

目标

  • 定义统一的 Feed/Chatter 接口端点,包括 Feed CRUD、Reactions、Subscription
  • 明确请求/响应参数 schema,便于前后端约束和 mock
  • 对标 Airtable/Salesforce/Notion Timeline

推荐端点

  • GET /api/data/{object}/{recordId}/feed?type=all&limit=20&cursor=xxx — 拉取某条记录的活动时间线(混合评论、字段变更、task 等,支持翻页和类型筛选)

  • POST /api/data/{object}/{recordId}/feed { type: 'comment', body: '...'} — 新增评论/任务等 Feed 项

  • PUT /api/data/{object}/{recordId}/feed/{feedId} { body: '...'} — 编辑评论等

  • DELETE /api/data/{object}/{recordId}/feed/{feedId} — 删除 Feed 项(如评论)

  • POST /api/data/{object}/{recordId}/feed/{feedId}/reactions { emoji: '👍'} — 增加 emoji reaction

  • DELETE /api/data/{object}/{recordId}/feed/{feedId}/reactions/{emoji} — 移除 reaction

  • POST /api/data/{object}/{recordId}/subscribe { events: ['comment'...'field_change'...'all'], channels: ['in_app'...'email']}

  • DELETE /api/data/{object}/{recordId}/subscribe

期望

  • 每个端点均应有详细的请求/响应参数 JSON schema(建议 Zod/TSType/JSON Schema)
  • 补充接口错误说明,例如权限不足、非法操作
  • 示例:如何通过 API 拉取包含评论、字段变更、回复和 reaction 的 unified feed 时间线

参考


test


建议实现:可新建 src/api/feed-api.zod.ts 或在现有 API contract 体系扩展

完成后请运行 test,并更新 ROADMAP</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel
Copy link
Copy Markdown

vercel bot commented Feb 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
objectstack-play Ready Ready Preview, Comment Feb 19, 2026 8:31am
spec Ready Ready Preview, Comment Feb 19, 2026 8:31am

Request Review

…ription)

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Define Feed/Chatter API endpoints for CRUD, reactions, subscription feat(api): define Feed/Chatter API protocol endpoints Feb 19, 2026
Copilot AI requested a review from hotlong February 19, 2026 08:17
@hotlong hotlong marked this pull request as ready for review February 19, 2026 08:21
Copilot AI review requested due to automatic review settings February 19, 2026 08:21
@hotlong hotlong merged commit f99b2f3 into main Feb 19, 2026
3 of 5 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR completes the Feed/Chatter API protocol by defining 8 HTTP endpoint specifications to complement the data models introduced in PR#732. The API follows Airtable/Salesforce Chatter patterns for unified activity timelines.

Changes:

  • Adds complete Feed/Chatter API endpoint definitions with Zod-first schemas, cursor pagination, and comprehensive error codes
  • Introduces enhanced contract registry pattern that includes HTTP method and path alongside input/output schemas for improved SDK/documentation generation
  • Updates ROADMAP.md to reflect Feed API completion

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
packages/spec/src/api/feed-api.zod.ts Defines 8 Feed API endpoints (CRUD, Reactions, Subscription) with complete request/response schemas, path parameters, error codes, and enhanced contract registry following existing patterns
packages/spec/src/api/feed-api.test.ts Comprehensive test suite with 45 tests covering all schemas, validation rules, defaults, pagination, and edge cases
packages/spec/src/api/index.ts Exports feed-api module following existing export conventions
ROADMAP.md Updates API Protocol section to document Feed API (Feed CRUD, Reactions, Subscription) completion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

定义 Feed/Chatter 协议 API 端点(Feed CRUD、Reactions、Subscription)

3 participants