Documentation
¶
Index ¶
- func BadRequest(w http.ResponseWriter, message string)
- func Cors(next http.Handler) http.Handler
- func Error(w http.ResponseWriter, err error)
- func JSON(w http.ResponseWriter, status int, data any)
- func Logging(next http.Handler) http.Handler
- func NotFound(w http.ResponseWriter, resourceType, identifier string)
- type CardResponse
- type CreateCardRequest
- type CreateColumnRequest
- type DeleteColumnResponse
- type Handler
- func (h *Handler) CreateCard(w http.ResponseWriter, r *http.Request)
- func (h *Handler) CreateColumn(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DeleteCard(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DeleteColumn(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetBoard(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetCard(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ListBoards(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ListCards(w http.ResponseWriter, r *http.Request)
- func (h *Handler) MoveCard(w http.ResponseWriter, r *http.Request)
- func (h *Handler) RegisterRoutes(mux *http.ServeMux)
- func (h *Handler) ReorderColumns(w http.ResponseWriter, r *http.Request)
- func (h *Handler) StaticHandler() http.Handler
- func (h *Handler) UpdateCard(w http.ResponseWriter, r *http.Request)
- func (h *Handler) UpdateColumn(w http.ResponseWriter, r *http.Request)
- type MoveCardRequest
- type ReorderColumnsRequest
- type Server
- type UpdateCardRequest
- type UpdateColumnRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BadRequest ¶
func BadRequest(w http.ResponseWriter, message string)
BadRequest writes a 400 error with the given message.
func Error ¶
func Error(w http.ResponseWriter, err error)
Error writes an error response, mapping domain errors to HTTP status codes.
func JSON ¶
func JSON(w http.ResponseWriter, status int, data any)
JSON writes a JSON response with the given status code.
func NotFound ¶ added in v0.2.0
func NotFound(w http.ResponseWriter, resourceType, identifier string)
NotFound writes a 404 error for a missing resource.
Types ¶
type CardResponse ¶ added in v0.3.0
type CardResponse struct {
ID string `json:"id"`
Alias string `json:"alias"`
AliasExplicit bool `json:"alias_explicit"`
Title string `json:"title"`
Description string `json:"description,omitempty"`
Column string `json:"column"`
Parent string `json:"parent,omitempty"`
Creator string `json:"creator"`
CreatedAtMillis int64 `json:"created_at_millis"`
UpdatedAtMillis int64 `json:"updated_at_millis"`
Comments []model.Comment `json:"comments,omitempty"`
CustomFields map[string]any `json:"-"` // Flattened into top level by MarshalJSON
}
CardResponse wraps a Card for JSON API responses, including the Column field which is computed (from board config) and not persisted to card files. Custom fields are flattened into the top level to match the card JSON storage format.
func (CardResponse) MarshalJSON ¶ added in v0.3.0
func (c CardResponse) MarshalJSON() ([]byte, error)
MarshalJSON flattens custom fields into the top level of the JSON output.
type CreateCardRequest ¶
type CreateCardRequest struct {
Title string `json:"title"`
Description string `json:"description,omitempty"`
Column string `json:"column,omitempty"`
Parent string `json:"parent,omitempty"`
CustomFields map[string]string `json:"custom_fields,omitempty"`
}
CreateCardRequest is the JSON body for creating a card.
type CreateColumnRequest ¶ added in v0.5.0
type CreateColumnRequest struct {
Name string `json:"name"`
Color string `json:"color,omitempty"`
Position *int `json:"position,omitempty"` // Optional: insert position (-1 or omit for end)
}
CreateColumnRequest is the JSON body for creating a column.
type DeleteColumnResponse ¶ added in v0.5.0
type DeleteColumnResponse struct {
DeletedCards int `json:"deleted_cards"`
}
DeleteColumnResponse is returned when a column is deleted.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler contains all HTTP handlers for the API.
func NewHandler ¶
func NewHandler( cardService *service.CardService, boardService *service.BoardService, cardStore store.CardStore, boardStore store.BoardStore, creator string, ) *Handler
NewHandler creates a new handler with the given dependencies.
func (*Handler) CreateCard ¶
func (h *Handler) CreateCard(w http.ResponseWriter, r *http.Request)
CreateCard creates a new card.
func (*Handler) CreateColumn ¶ added in v0.5.0
func (h *Handler) CreateColumn(w http.ResponseWriter, r *http.Request)
CreateColumn creates a new column on a board.
func (*Handler) DeleteCard ¶
func (h *Handler) DeleteCard(w http.ResponseWriter, r *http.Request)
DeleteCard deletes a card.
func (*Handler) DeleteColumn ¶ added in v0.5.0
func (h *Handler) DeleteColumn(w http.ResponseWriter, r *http.Request)
DeleteColumn deletes a column and all its cards.
func (*Handler) GetBoard ¶
func (h *Handler) GetBoard(w http.ResponseWriter, r *http.Request)
GetBoard returns a board's configuration.
func (*Handler) GetCard ¶
func (h *Handler) GetCard(w http.ResponseWriter, r *http.Request)
GetCard returns a single card by ID.
func (*Handler) ListBoards ¶
func (h *Handler) ListBoards(w http.ResponseWriter, r *http.Request)
ListBoards returns all board names.
func (*Handler) ListCards ¶
func (h *Handler) ListCards(w http.ResponseWriter, r *http.Request)
ListCards returns all cards for a board, optionally filtered by column.
func (*Handler) MoveCard ¶
func (h *Handler) MoveCard(w http.ResponseWriter, r *http.Request)
MoveCard moves a card to a different column.
func (*Handler) RegisterRoutes ¶
RegisterRoutes sets up all API routes on the given mux.
func (*Handler) ReorderColumns ¶ added in v0.5.0
func (h *Handler) ReorderColumns(w http.ResponseWriter, r *http.Request)
ReorderColumns reorders all columns according to the provided order.
func (*Handler) StaticHandler ¶
StaticHandler returns a handler that serves the embedded frontend files.
func (*Handler) UpdateCard ¶
func (h *Handler) UpdateCard(w http.ResponseWriter, r *http.Request)
UpdateCard updates an existing card.
func (*Handler) UpdateColumn ¶ added in v0.5.0
func (h *Handler) UpdateColumn(w http.ResponseWriter, r *http.Request)
UpdateColumn updates a column's properties (rename, color).
type MoveCardRequest ¶
type MoveCardRequest struct {
Column string `json:"column"`
Position *int `json:"position,omitempty"` // Optional: position in target column (-1 or omit for end)
}
MoveCardRequest is the JSON body for moving a card.
type ReorderColumnsRequest ¶ added in v0.5.0
type ReorderColumnsRequest struct {
Columns []string `json:"columns"`
}
ReorderColumnsRequest is the JSON body for reordering columns.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server wraps the HTTP server for the web frontend.
type UpdateCardRequest ¶
type UpdateCardRequest struct {
Title *string `json:"title,omitempty"`
Description *string `json:"description,omitempty"`
Column *string `json:"column,omitempty"`
CustomFields map[string]string `json:"custom_fields,omitempty"`
}
UpdateCardRequest is the JSON body for updating a card.
type UpdateColumnRequest ¶ added in v0.5.0
type UpdateColumnRequest struct {
Name *string `json:"name,omitempty"` // New name (rename)
Color *string `json:"color,omitempty"` // New color
}
UpdateColumnRequest is the JSON body for updating a column.