feat(bookstack-api-7qx): implement Comments CRUD

Add CommentsService with List, Get, Create, Update, Delete.
Support nested comments via parent_id. Register service on Client.
Add types and tests.
This commit is contained in:
Oliver Jakoubek 2026-01-30 09:55:44 +01:00
commit 0a1cd5ef38
6 changed files with 201 additions and 5 deletions

View file

@ -107,6 +107,30 @@ type AttachmentUpdateRequest struct {
Link string `json:"link,omitempty"`
}
// Comment represents a Bookstack comment on a page.
type Comment struct {
ID int `json:"id"`
PageID int `json:"page_id"`
ParentID int `json:"parent_id,omitempty"`
HTML string `json:"html"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CreatedBy int `json:"created_by"`
UpdatedBy int `json:"updated_by"`
}
// CommentCreateRequest contains fields for creating a comment.
type CommentCreateRequest struct {
PageID int `json:"page_id"`
ParentID int `json:"parent_id,omitempty"`
HTML string `json:"html"`
}
// CommentUpdateRequest contains fields for updating a comment.
type CommentUpdateRequest struct {
HTML string `json:"html"`
}
// SearchResult represents a search result from Bookstack.
type SearchResult struct {
Type string `json:"type"` // "page", "chapter", "book", or "shelf"