Feature request: endpoints for retrieving note comments and reactions

未关闭
#48 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
45/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
typescript
领域
api

调研方向

未指定文件或测试。首先查看现有的 @hackmd/api 客户端方法以及相关 issue #428 和 #207;当提议的评论和反应端点、客户端方法及响应类型都已定义并得到支持时,工作即告完成。

由索引模型根据 Issue 内容生成。

描述

Summary

The @hackmd/api client currently has no methods for retrieving comment or reaction data from notes. The only comment-related field exposed is commentPermission (controlling who can comment), but the actual comment content, threads, and reactions are completely inaccessible via the API.

Request

Add API endpoints and corresponding client methods for retrieving comments and reactions:

Proposed endpoints
GET /v1/notes/:noteId/comments
GET /v1/notes/:noteId/reactions
Proposed client methods
// Get all comments on a note (including replies and reactions per comment)
async getComments(noteId: string): Promise<Comment[]>

// Get all reactions on a note
async getReactions(noteId: string): Promise<Reaction[]>
Suggested response types
interface Comment {
  id: string
  author: {
    id: string
    name: string
  }
  body: string
  createdAt: string  // ISO 8601
  updatedAt: string  // ISO 8601
  resolved: boolean
  range?: {
    startLine: number
    endLine: number
  }
  replies: Reply[]
  reactions: ReactionGroup[]
}

interface Reply {
  id: string
  author: {
    id: string
    name: string
  }
  body: string
  createdAt: string
}

interface ReactionGroup {
  emoji: string
  users: string[]  // user IDs
}

interface Reaction {
  noteId: string
  emoji: string
  user: {
    id: string
    name: string
  }
  createdAt: string
}

Motivation

HackMD's commenting and reaction features are valuable for collaboration, but teams that use the API or CLI to sync notes to external systems (e.g., GitHub repositories) lose all of this context. Exposing comment and reaction data via the API would enable:

  • Backing up discussion context alongside note content
  • Building integrations that preserve collaboration history
  • Automating workflows that depend on comment/reaction data

Related

主要语言
TypeScript
星标
20
派生
8
平均合并
47 分钟
30 天内合并 PR
5

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

hackmdio/api-client 的其他 Issue

查看 hackmdio/api-client 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。