Documentation
¶
Index ¶
- Variables
- func BuildQueryString(v any) string
- func Create(path, summary string) *opBuilder
- func CustomAction(action Action, path, summary string) *opBuilder
- func GetRes(path, summary string) *resBuilder
- func ListRes(path, summary string) *resBuilder
- func Remove(path, summary string) *opBuilder
- func SetOp(path, summary string) *opBuilder
- func SubstitutePath(path string, params map[string]string) string
- func Update(path, summary string) *opBuilder
- func ValidateActorType(t ActorType) error
- func ValidateDependencyType(d DependencyType) error
- func ValidatePriority(p Priority) error
- func ValidateRefType(r RefType) error
- func ValidateRole(r Role) error
- func ValidateSlug(s string) error
- type Action
- type ActivityStats
- type Actor
- type ActorActivity
- type ActorStats
- type ActorType
- type ArchivedError
- type Attachment
- type AuditAction
- type AuditEntry
- type Board
- type BoardDetail
- type BoardOverview
- type BoardStats
- type Comment
- type ConflictError
- type CreateActorParams
- type CreateAttachmentParams
- type CreateBoardParams
- type CreateCommentParams
- type CreateDependencyParams
- type CreateTaskParams
- type CreateWebhookParams
- type Dependency
- type DependencyType
- type ListBoardsParams
- type NotFoundError
- type Operation
- type Optional
- type PathParam
- type Priority
- type QueryParam
- type ReassignRequest
- type ReassignResponse
- type RefType
- type Resource
- type Role
- type SystemStats
- type TagCount
- type Task
- type TaskDetail
- type TaskFilter
- type TaskSort
- type TaskStatsSummary
- type TransitionTaskParams
- type UpdateActorParams
- type UpdateBoardParams
- type UpdateCommentParams
- type UpdateTaskParams
- type UpdateWebhookParams
- type ValidationError
- type Webhook
- type WebhookDelivery
- type Workflow
- type WorkflowFromAll
- type WorkflowHealthIssue
- type WorkflowToAll
- type WorkflowTransition
Constants ¶
This section is empty.
Variables ¶
var ( ResActorList = mustRes("actor_list") ResActorGet = mustRes("actor_get") ResBoardList = mustRes("board_list") ResBoardGet = mustRes("board_get") ResWorkflowGet = mustRes("workflow_get") ResTaskList = mustRes("task_list") ResTaskGet = mustRes("task_get") ResTaskDetail = mustRes("task_detail") ResTagList = mustRes("tag_list") ResCommentList = mustRes("comment_list") ResDepList = mustRes("dependency_list") ResAttachList = mustRes("attachment_list") ResTaskSearch = mustRes("task_search") ResBoardDetail = mustRes("board_detail") ResBoardOver = mustRes("board_overview") ResAdminStats = mustRes("admin_stats") ResWebhookList = mustRes("webhook_list") ResWebhookGet = mustRes("webhook_get") ResDeliveries = mustRes("delivery_list") )
Named resources — exported for direct use by httpclient consumers.
var ( OpActorCreate = mustOp("actor_create") OpActorRotateKey = mustOp("actor_rotate_key") OpActorUpdate = mustOp("actor_update") OpBoardCreate = mustOp("board_create") OpBoardUpdate = mustOp("board_update") OpBoardDelete = mustOp("board_delete") OpBoardReassign = mustOp("board_reassign") OpWorkflowSet = mustOp("workflow_set") OpWorkflowHealth = mustOp("workflow_health") OpTaskCreate = mustOp("task_create") OpTaskUpdate = mustOp("task_update") OpTaskTransition = mustOp("task_transition") OpTaskDelete = mustOp("task_delete") OpTaskAudit = mustOp("task_audit") OpBoardAudit = mustOp("board_audit") OpCommentCreate = mustOp("comment_create") OpCommentUpdate = mustOp("comment_update") OpDepCreate = mustOp("dependency_create") OpDepDelete = mustOp("dependency_delete") OpAttachCreate = mustOp("attachment_create") OpAttachDelete = mustOp("attachment_delete") OpWebhookCreate = mustOp("webhook_create") OpWebhookUpdate = mustOp("webhook_update") OpWebhookDelete = mustOp("webhook_delete") )
Named operations — exported for direct use by httpclient consumers.
var AllowPrivateWebhookURLs = false
AllowPrivateWebhookURLs controls whether webhook URLs can point to private/loopback addresses. Defaults to false (production). Set to true for development and testing.
Functions ¶
func BuildQueryString ¶
BuildQueryString builds a URL query string (without leading "?") from v. v can be:
- a struct with `query` tags (non-zero fields are included)
- a map[string]string (all entries are included)
- nil (returns "")
func CustomAction ¶
func SubstitutePath ¶
SubstitutePath replaces {param} placeholders in a path template with values from params. For example, SubstitutePath("/boards/{slug}/tasks/{num}", {"slug": "platform", "num": "1"}) returns "/boards/platform/tasks/1".
func ValidateActorType ¶
func ValidateDependencyType ¶
func ValidateDependencyType(d DependencyType) error
func ValidatePriority ¶
func ValidateRefType ¶
func ValidateRole ¶
func ValidateSlug ¶
Types ¶
type ActivityStats ¶
type ActivityStats struct {
TotalEvents int `json:"total_events"`
Last7d int `json:"last_7d"`
ByActor []ActorActivity `json:"by_actor"`
}
ActivityStats summarises audit event activity.
type ActorActivity ¶
ActorActivity is a per-actor event count.
type ActorStats ¶
type ActorStats struct {
Total int `json:"total"`
Active int `json:"active"`
ByRole map[string]int `json:"by_role"`
}
ActorStats summarises actor counts.
type ArchivedError ¶
type ArchivedError struct {
BoardSlug string
}
ArchivedError indicates an operation was attempted on an archived (soft-deleted) board. Comments are still allowed on archived boards; mutations are not.
func (*ArchivedError) Error ¶
func (e *ArchivedError) Error() string
type Attachment ¶
type Attachment struct {
ID int `json:"id"`
BoardSlug string `json:"board_slug"`
TaskNum int `json:"task_num"`
RefType RefType `json:"ref_type"`
Reference string `json:"reference"`
Label string `json:"label"`
CreatedBy string `json:"created_by"`
CreatedAt time.Time `json:"created_at"`
}
Attachment links a task to an external reference (URL, file, git branch, etc.).
type AuditAction ¶
type AuditAction string
const ( AuditActionCreated AuditAction = "created" AuditActionTransitioned AuditAction = "transitioned" AuditActionUpdated AuditAction = "updated" AuditActionCommented AuditAction = "commented" AuditActionCommentEdited AuditAction = "comment_edited" AuditActionAssigned AuditAction = "assigned" AuditActionDeleted AuditAction = "deleted" AuditActionDependencyAdded AuditAction = "dependency_added" AuditActionDependencyRemoved AuditAction = "dependency_removed" AuditActionFileUploaded AuditAction = "file_uploaded" AuditActionFileDeleted AuditAction = "file_deleted" AuditActionAttachmentAdded AuditAction = "attachment_added" AuditActionAttachmentRemoved AuditAction = "attachment_removed" AuditActionWorkflowChanged AuditAction = "workflow_changed" AuditActionBoardDeleted AuditAction = "board_deleted" AuditActionTasksReassigned AuditAction = "tasks_reassigned" )
type AuditEntry ¶
type AuditEntry struct {
ID int `json:"id"`
BoardSlug string `json:"board_slug"`
TaskNum *int `json:"task_num"` // Nil for board-level events.
Actor string `json:"actor"` // The actor who performed the action.
Action AuditAction `json:"action"`
Detail json.RawMessage `json:"detail"` // Action-specific payload; shape varies by Action.
CreatedAt time.Time `json:"created_at"`
}
type Board ¶
type Board struct {
Slug string `json:"slug"`
Name string `json:"name"`
Description string `json:"description"`
Workflow json.RawMessage `json:"workflow"` // JSON workflow definition; see Workflow struct for schema.
NextTaskNum int `json:"next_task_num"` // Auto-increment counter for task numbering on this board.
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Deleted bool `json:"deleted"`
}
type BoardDetail ¶
type BoardDetail struct {
Board Board `json:"board"`
Workflow any `json:"workflow"`
Tasks []TaskDetail `json:"tasks"`
Audit []AuditEntry `json:"audit"`
}
BoardDetail is a complete board snapshot with all nested data.
type BoardOverview ¶
type BoardOverview struct {
Board
TaskCounts map[string]int `json:"task_counts"`
TotalTasks int `json:"total_tasks"`
}
BoardOverview is a lightweight board summary with task counts by state.
type BoardStats ¶
BoardStats summarises board counts.
type Comment ¶
type Comment struct {
ID int `json:"id"`
BoardSlug string `json:"board_slug"`
TaskNum int `json:"task_num"`
Actor string `json:"actor"` // The actor who wrote the comment (not necessarily the task creator).
Body string `json:"body"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt *time.Time `json:"updated_at"`
}
type ConflictError ¶
ConflictError indicates a uniqueness or referential integrity violation.
func (*ConflictError) Error ¶
func (e *ConflictError) Error() string
type CreateActorParams ¶
type CreateActorParams struct {
Name string `json:"name"`
DisplayName string `json:"display_name,omitempty"`
Type ActorType `json:"type"`
Role Role `json:"role"`
APIKeyHash string `json:"-"`
}
func (CreateActorParams) Validate ¶
func (p CreateActorParams) Validate() error
type CreateAttachmentParams ¶
type CreateAttachmentParams struct {
BoardSlug string `json:"-"`
TaskNum int `json:"-"`
RefType RefType `json:"ref_type"`
Reference string `json:"reference"`
Label string `json:"label"`
CreatedBy string `json:"-"`
}
func (CreateAttachmentParams) Validate ¶
func (p CreateAttachmentParams) Validate() error
type CreateBoardParams ¶
type CreateBoardParams struct {
Slug string `json:"slug"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Workflow json.RawMessage `json:"workflow,omitempty"`
}
func (CreateBoardParams) Validate ¶
func (p CreateBoardParams) Validate() error
type CreateCommentParams ¶
type CreateCommentParams struct {
BoardSlug string `json:"-"`
TaskNum int `json:"-"`
Actor string `json:"-"`
Body string `json:"body"`
}
func (CreateCommentParams) Validate ¶
func (p CreateCommentParams) Validate() error
type CreateDependencyParams ¶
type CreateDependencyParams struct {
BoardSlug string `json:"-"`
TaskNum int `json:"-"`
DependsOnBoard string `json:"depends_on_board"`
DependsOnNum int `json:"depends_on_num"`
DependencyType DependencyType `json:"dep_type"`
CreatedBy string `json:"-"`
}
func (CreateDependencyParams) Validate ¶
func (p CreateDependencyParams) Validate() error
type CreateTaskParams ¶
type CreateTaskParams struct {
BoardSlug string `json:"-"`
Title string `json:"title"`
Description string `json:"description,omitempty"`
Priority Priority `json:"priority,omitempty"`
Tags []string `json:"tags,omitempty"`
Assignee *string `json:"assignee"`
DueDate *time.Time `json:"due_date"`
CreatedBy string `json:"-"`
}
func (CreateTaskParams) Validate ¶
func (p CreateTaskParams) Validate() error
type CreateWebhookParams ¶
type CreateWebhookParams struct {
URL string `json:"url"`
Events []string `json:"events"`
BoardSlug *string `json:"board_slug"`
Secret string `json:"secret"`
CreatedBy string `json:"-"`
}
func (CreateWebhookParams) Validate ¶
func (p CreateWebhookParams) Validate() error
type Dependency ¶
type Dependency struct {
ID int `json:"id"`
BoardSlug string `json:"board_slug"` // Board of the task that has the dependency.
TaskNum int `json:"task_num"`
DependsOnBoard string `json:"depends_on_board"` // Board of the depended-on task (may differ for cross-board deps).
DependsOnNum int `json:"depends_on_num"`
DependencyType DependencyType `json:"dep_type"`
CreatedBy string `json:"created_by"`
CreatedAt time.Time `json:"created_at"`
}
type DependencyType ¶
type DependencyType string
const ( DependencyTypeDependsOn DependencyType = "depends_on" DependencyTypeRelatesTo DependencyType = "relates_to" )
type ListBoardsParams ¶
type ListBoardsParams struct {
IncludeDeleted bool `query:"include_deleted,Include soft-deleted boards"`
}
ListBoardsParams describes query parameters for filtering board lists.
type NotFoundError ¶
NotFoundError indicates a resource was not found.
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
type Operation ¶
type Operation struct {
Name string // canonical identifier, e.g. "task_create"
Action Action // the kind of mutation
Path string // resource address pattern: /boards/{slug}/tasks/{num}
Summary string // short description (OpenAPI, CLI)
Description string // longer description with usage guidance (MCP tools)
MinRole Role // minimum role required
Input any // nil, or zero-value of request type (for schema generation)
Output any // nil, or zero-value of response type (for schema generation)
}
Operation describes a domain mutation as runtime metadata. Operations change state (create, update, delete, transition, etc).
func LookupOperation ¶
LookupOperation returns the Operation with the given name, or false if not found.
func Operations ¶
func Operations() []Operation
Operations returns the canonical list of all domain mutations.
func (Operation) PathParams ¶
PathParams returns the path parameters inferred from the Path pattern.
type Optional ¶
Optional represents a value that may or may not have been provided. Unlike a pointer, it cleanly distinguishes three states:
- Not provided: Optional[T]{Set: false}
- Provided nil: Optional[*string]{Set: true, Value: nil} (clear the field)
- Provided value: Optional[string]{Set: true, Value: "foo"}
Implements json.Unmarshaler: when a JSON field is present, Set becomes true. When a JSON field is absent, UnmarshalJSON is never called, so Set stays false.
func (Optional[T]) MarshalJSON ¶
func (*Optional[T]) UnmarshalJSON ¶
type PathParam ¶
PathParam describes a path parameter inferred from an operation's Path.
func InferPathParams ¶
type QueryParam ¶
QueryParam describes a query string parameter derived from a filter or sort struct.
func QueryParamsFrom ¶
func QueryParamsFrom(v any) []QueryParam
QueryParamsFrom derives query parameters from a struct's `query` tags. Tag format: `query:"name,description"`. Fields without a query tag are skipped. Returns nil if v is nil.
type ReassignRequest ¶
type ReassignRequest struct {
TargetBoard string `json:"target_board"`
States []string `json:"states,omitempty"`
}
ReassignRequest is the input for the reassign operation.
type ReassignResponse ¶
type ReassignResponse struct {
Count int `json:"count"`
}
ReassignResponse is the output of the reassign operation.
type Resource ¶
type Resource struct {
Name string // canonical identifier, e.g. "board_list"
Path string // resource address pattern: /boards/{slug}
Summary string // short description (OpenAPI, CLI)
Description string // longer description with usage guidance (MCP tools)
MinRole Role // minimum role required (defaults to RoleReadOnly)
Output any // zero-value of response type (for schema generation)
Filter any // nil, or zero-value of filter struct (query params derived from `query` tags)
Sort any // nil, or zero-value of sort struct (query params derived from `query` tags)
}
Resource describes a read-only domain resource as runtime metadata. Resources are always served via GET and return 200.
func LookupResource ¶
LookupResource returns the Resource with the given name, or false if not found.
func Resources ¶
func Resources() []Resource
Resources returns the canonical list of all read-only domain resources.
func (Resource) PathParams ¶
PathParams returns the path parameters inferred from the Path pattern.
func (Resource) QueryParams ¶
func (r Resource) QueryParams() []QueryParam
QueryParams returns query parameters derived from the Filter and Sort structs.
type SystemStats ¶
type SystemStats struct {
Actors ActorStats `json:"actors"`
Boards BoardStats `json:"boards"`
Tasks TaskStatsSummary `json:"tasks"`
Activity ActivityStats `json:"activity"`
}
SystemStats contains system-wide statistics.
type Task ¶
type Task struct {
BoardSlug string `json:"board_slug"`
Num int `json:"num"` // Board-scoped sequential identifier (e.g., my-board/42).
Title string `json:"title"`
Description string `json:"description"`
State string `json:"state"` // Workflow-defined state; valid values depend on the board's workflow.
Priority Priority `json:"priority"`
Tags []string `json:"tags"`
Assignee *string `json:"assignee"`
DueDate *time.Time `json:"due_date"`
CreatedBy string `json:"created_by"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Deleted bool `json:"deleted"`
}
type TaskDetail ¶
type TaskDetail struct {
Task
Comments []Comment `json:"comments"`
Attachments []Attachment `json:"attachments"`
Dependencies []Dependency `json:"dependencies"`
Audit []AuditEntry `json:"audit"`
}
TaskDetail is a task with its comments, attachments, dependencies, and audit.
type TaskFilter ¶
type TaskFilter struct {
BoardSlug string // path param, not a query param
State *string `query:"state,Filter by workflow state"`
Assignee *string `query:"assignee,Filter by assignee name"`
Priority *Priority `query:"priority,Filter by priority (critical/high/medium/low/none)"`
Tag *string `query:"tag,Filter by tag"`
Query *string `query:"q,Full-text search query"`
IncludeClosed bool `query:"include_closed,Include tasks in terminal states"`
IncludeDeleted bool `query:"include_deleted,Include soft-deleted tasks"`
}
TaskFilter describes query parameters for filtering task lists. Fields with a `query` tag are exposed as query parameters on list endpoints.
type TaskSort ¶
type TaskSort struct {
Field string `query:"sort,Sort field (created_at/updated_at/priority/due_date)"`
Desc bool `query:"order,string,Sort order (asc/desc)"`
}
TaskSort describes query parameters for sorting task lists.
type TaskStatsSummary ¶
type TaskStatsSummary struct {
Total int `json:"total"`
ByState map[string]int `json:"by_state"`
CreatedLast7d int `json:"created_last_7d"`
CompletedLast7d int `json:"completed_last_7d"`
}
TaskStatsSummary summarises task counts across the system.
type TransitionTaskParams ¶
type TransitionTaskParams struct {
BoardSlug string `json:"-"`
Num int `json:"-"`
TransitionName string `json:"transition"`
Comment string `json:"comment,omitempty"`
Actor string `json:"-"`
}
TransitionTaskParams describes a task state transition.
type UpdateActorParams ¶
type UpdateBoardParams ¶
type UpdateCommentParams ¶
UpdateCommentParams always requires a new body — there is no partial update for comments, so Body is a plain value rather than Optional.
type UpdateTaskParams ¶
type UpdateTaskParams struct {
BoardSlug string `json:"-"`
Num int `json:"-"`
Title Optional[string] `json:"title"`
Description Optional[string] `json:"description"`
State Optional[string] `json:"state"`
Priority Optional[Priority] `json:"priority"`
Tags Optional[[]string] `json:"tags"`
Assignee Optional[*string] `json:"assignee"` // Set with nil value clears the assignee.
DueDate Optional[*time.Time] `json:"due_date"` // Set with nil value clears the due date.
}
type UpdateWebhookParams ¶
type ValidationError ¶
ValidationError indicates invalid input for a specific field. Detail optionally carries structured context (e.g., available transitions).
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
type Webhook ¶
type Webhook struct {
ID int `json:"id"`
URL string `json:"url"`
Events []string `json:"events"` // Event types to subscribe to (e.g., "task.created", "task.transitioned").
BoardSlug *string `json:"board_slug"` // Nil means all boards.
Secret string `json:"-"` // Shared secret for HMAC-SHA256 webhook signatures.
Active bool `json:"active"`
CreatedBy string `json:"created_by"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type WebhookDelivery ¶
type WebhookDelivery struct {
ID int `json:"id"`
WebhookID int `json:"webhook_id"`
EventType string `json:"event_type"`
EventID string `json:"event_id"`
Attempt int `json:"attempt"`
StatusCode *int `json:"status_code"` // nil if request failed before response
Error *string `json:"error"` // nil on success
RequestBody string `json:"-"` // not exposed in API responses
DurationMs *int `json:"duration_ms"`
CreatedAt time.Time `json:"created_at"`
}
WebhookDelivery records a single delivery attempt.
type Workflow ¶
type Workflow struct {
States []string `json:"states"`
InitialState string `json:"initial_state"`
TerminalStates []string `json:"terminal_states"`
Transitions []WorkflowTransition `json:"transitions"`
FromAll []WorkflowFromAll `json:"from_all,omitempty"` // Transitions reachable from every non-terminal state.
ToAll []WorkflowToAll `json:"to_all,omitempty"` // Transitions from a specific state to every other state.
}
Workflow defines a state machine for task progression on a board. The workflow engine (Increment 2) will parse and validate this; for now it is stored and retrieved as a JSON blob on Board.Workflow.
type WorkflowFromAll ¶
WorkflowFromAll defines a transition that expands to: every non-terminal state → To.
type WorkflowHealthIssue ¶
type WorkflowHealthIssue struct {
State string `json:"state"`
Problem string `json:"problem"` // "orphaned" or "stuck"
Count int `json:"count"`
}
WorkflowHealthIssue describes a problem found during a workflow health check.
type WorkflowToAll ¶
WorkflowToAll defines a transition that expands to: From → every other state.