hackmdio / hackmdio/api-client

Feature request: endpoints for retrieving note comments and reactions

Đang mở
#48 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
19
Fork
8
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

## 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

```typescript
// Get all comments on a note (including replies and reactions per comment)
async getComments(noteId: string): Promise

// Get all reactions on a note
async getReactions(noteId: string): Promise
```

### Suggested response types

```typescript
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

- Broader feature request: https://github.com/hackmdio/hackmd-io-issues/issues/428
- Original request from 2020: https://github.com/hackmdio/hackmd-io-issues/issues/207

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Không có tệp hoặc bài kiểm thử nào được nêu. Hãy bắt đầu bằng việc xem xét các phương thức client hiện có của @hackmd/api và các issue liên quan #428 và #207; công việc hoàn tất khi các endpoint, phương thức client và kiểu phản hồi được đề xuất cho comment và reaction đã được định nghĩa và hỗ trợ.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
typescript
Lĩnh vực
api
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.