Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handler ¶
func Handler(db bun.IDB) http.HandlerFunc
Handler creates a fork of a note beside it: POST /api/notes/{id}/forks. TODO: the notes CLI and its MCP neither fork nor merge (the merge resolves its conflicts in the app), add them once an agent needs it. @Summary Fork a note @Tags notes @Accept json @Produce json @Param id path string true "uuid of the note forked" @Param body body Body true "body" @Success 201 {object} domain.Item @Failure 400 {object} respond.Failure @Failure 404 {object} respond.Failure @Failure 413 {object} respond.Failure @Failure 500 {object} respond.Failure @Router /api/notes/{id}/forks [post]
func Merge ¶
func Merge(db bun.IDB) http.HandlerFunc
Merge saves a merge of the fork into its original: POST /api/notes/{id}/merge. The text replaced is kept in the original's history. 409 when the original is locked, changed since, or in the trash. @Summary Merge a fork into its original @Tags notes @Accept json @Produce json @Param id path string true "uuid of the fork" @Param body body MergeBody true "body" @Success 200 {object} readitem.Result @Failure 400 {object} respond.Failure @Failure 404 {object} respond.Failure @Failure 409 {object} respond.Failure @Failure 413 {object} respond.Failure @Failure 500 {object} respond.Failure @Router /api/notes/{id}/merge [post]
func Read ¶
func Read(db bun.IDB) http.HandlerFunc
Read answers what a merge of the fork starts from: GET /api/notes/{id}/fork, 404 for a note that is no fork. @Summary Read the origin of a fork @Tags notes @Produce json @Param id path string true "uuid of the fork" @Success 200 {object} readfork.Result @Failure 404 {object} respond.Failure @Failure 500 {object} respond.Failure @Router /api/notes/{id}/fork [get]
func Rebase ¶
func Rebase(db bun.IDB) http.HandlerFunc
Rebase saves into the fork what changed in its original: POST /api/notes/{id}/rebase. The text replaced is kept in the fork's history. 409 when the fork is locked or changed since. @Summary Rebase a fork on its original @Tags notes @Accept json @Produce json @Param id path string true "uuid of the fork" @Param body body RebaseBody true "body" @Success 200 {object} readitem.Result @Failure 400 {object} respond.Failure @Failure 404 {object} respond.Failure @Failure 409 {object} respond.Failure @Failure 413 {object} respond.Failure @Failure 500 {object} respond.Failure @Router /api/notes/{id}/rebase [post]
func Unmerge ¶
func Unmerge(db bun.IDB) http.HandlerFunc
Unmerge undoes the last merge of the fork: POST /api/notes/{id}/unmerge. The original gets back its text from before it, the text replaced kept in its history, and the fork its base, so the next merge offers again what it refused, the fork taken out of the trash if the merge put it there. 409 when there is no merge to undo, or the original is locked, changed since the merge, or in the trash. @Summary Undo the last merge of a fork @Tags notes @Produce json @Param id path string true "uuid of the fork" @Success 200 {object} readitem.Result @Failure 404 {object} respond.Failure @Failure 409 {object} respond.Failure @Failure 500 {object} respond.Failure @Router /api/notes/{id}/unmerge [post]
Types ¶
type MergeBody ¶
type MergeBody struct {
// Content is the merged text, saved into the original.
Content string `json:"content"`
// Base is the fork's text the merge started from, the base of the next merge.
Base string `json:"base"`
// UpdatedAt is updated_at of the original as read, or its created_at: a 409 if it changed since.
UpdatedAt *time.Time `json:"updated_at" binding:"optional"`
// Trash moves the fork to the trash with the merge.
Trash bool `json:"trash,omitempty" binding:"optional"`
}
MergeBody is a merge made by the app.
type RebaseBody ¶
type RebaseBody struct {
// Content is the rebased text, saved into the fork.
Content string `json:"content"`
// Base is the original's text the rebase started from, the base of the next merge.
Base string `json:"base"`
// UpdatedAt is updated_at of the fork as read, or its created_at: a 409 if it changed since.
UpdatedAt *time.Time `json:"updated_at" binding:"optional"`
}
RebaseBody is a rebase made by the app.