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 Handler
- func (h *Handler) CreateCard(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DeleteCard(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) StaticHandler() http.Handler
- func (h *Handler) UpdateCard(w http.ResponseWriter, r *http.Request)
- type MoveCardRequest
- type Server
- type UpdateCardRequest
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 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) DeleteCard ¶
func (h *Handler) DeleteCard(w http.ResponseWriter, r *http.Request)
DeleteCard deletes a card.
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) 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.
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 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.