Help us shape the future of Go! Take the 2026 Go Developer Survey

api

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClaimResponse

type ClaimResponse struct {
	TicketID        string        `json:"ticket_id"`
	Branch          string        `json:"branch"`
	Title           string        `json:"title"`
	RepoRemote      string        `json:"repo_remote"`
	Description     string        `json:"description"`
	CheckpointPhase *string       `json:"checkpoint_phase"`
	CheckpointSHA   *string       `json:"checkpoint_sha"`
	LogEntries      []db.LogEntry `json:"log_entries"`
}

ClaimResponse is returned by a successful ticket claim.

type Handlers

type Handlers struct {
	DB           *gorm.DB
	Hub          *ws.Hub
	Broker       *sse.Broker
	LogEntryHTML func(sse.LogEntryEvent) string // renders a log entry to HTML for SSE; nil = send JSON
}

Handlers holds the shared dependencies for all API handlers.

func NewHandlers

func NewHandlers(gdb *gorm.DB, hub *ws.Hub, broker *sse.Broker) *Handlers

NewHandlers creates a Handlers with the given dependencies.

func (*Handlers) ClaimTicket

func (h *Handlers) ClaimTicket(ticketID string, shemID uint) (*ClaimResponse, error)

ClaimTicket atomically claims a ticket for shemID. Exactly one concurrent caller wins; all others receive a non-nil error.

func (*Handlers) RegisterHumanRoutes

func (h *Handlers) RegisterHumanRoutes(mux *http.ServeMux)

RegisterHumanRoutes adds human-input management and ticket action routes to mux.

func (*Handlers) RegisterLogRoutes

func (h *Handlers) RegisterLogRoutes(mux *http.ServeMux)

RegisterLogRoutes adds log-ingestion and SSE streaming routes to mux.

func (*Handlers) RegisterShemRoutes

func (h *Handlers) RegisterShemRoutes(mux *http.ServeMux)

RegisterShemRoutes adds shem-facing routes to mux.

func (*Handlers) RegisterTicketRoutes

func (h *Handlers) RegisterTicketRoutes(mux *http.ServeMux)

RegisterTicketRoutes adds ticket-related routes to mux.

func (*Handlers) ReviseClaim

func (h *Handlers) ReviseClaim(ticketID string, shemID uint) (*ClaimResponse, error)

ReviseClaim resumes a ticket already assigned to shemID that is in the revising phase. Unlike ClaimTicket it does not change phase or assigned_shem — the ticket is already owned by this shem.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL