Documentation
¶
Overview ¶
Package v1 implements the v1 HTTP API for the sandbox daemon.
All v1 routes are registered under PathPrefix ("/v1") via RegisterRoutes. The package owns its wire contract: handlers in this package are the only code allowed to decode request bodies or shape response bodies for v1.
Versioning rules (soft freeze, see pr-review.md):
- Behavioral changes to v1 wire bodies, status codes, or paths are forbidden once shipped. Add a new version package (pkg/api/v2) instead.
- Bug and security fixes that preserve wire compatibility are allowed.
The service layer (internal/service) stays version-agnostic. v1 handlers translate v1 DTOs ↔ models.* and call into the shared service.
Index ¶
Constants ¶
const PathPrefix = "/v1"
PathPrefix is the URL prefix every v1 route is registered under. Keep this in sync with the v1 SDK clients (each SDK pins the same prefix in its internal/api/v1 module).
Variables ¶
This section is empty.
Functions ¶
func RegisterRoutes ¶
RegisterRoutes mounts every v1 route onto mux. Paths are written with the PathPrefix already baked in so this file is the single grep target for "what does v1 expose?".
Types ¶
type Deps ¶
type Deps struct {
Service *service.Service
Logger *slog.Logger
// Auth wraps each handler with bearer-token auth. The middleware lives in
// pkg/api so all versions share one auth contract; the version package
// only decides which routes need it.
Auth func(http.Handler) http.Handler
}
Deps holds the shared dependencies a version package needs from the top-level pkg/api router. Keeping these explicit (rather than reaching into pkg/api globals) is what lets pkg/api/v2 coexist later without coupling.