Documentation
¶
Overview ¶
Package api implements the local HTTP REST surface of bacio. It shares the same SQLite store, validators, audit log, and JSON-input schemas as the CLI; nothing in this package is allowed to import internal/cli or to open the store itself — the cobra command owns that lifecycle.
Package api transport-only composite types. The CLI keeps its own equivalents (in internal/cli/output.go and the *_preview structs in the relevant cli/*.go files) for text rendering; both surfaces emit the same JSON shape so consumers don't need a per-surface parser.
Index ¶
- func ActorFromContext(ctx context.Context) string
- type BriefDoc
- type CascadeCount
- type ClaimResult
- type DocView
- type DocumentCascadeCount
- type DocumentDeletePreview
- type DocumentUnlinkPreview
- type FeatureDeletePreview
- type FeatureView
- type IssueBrief
- type IssueDeletePreview
- type IssueView
- type Options
- type PRDetachPreview
- type PlanEntry
- type PlanView
- type RelationDeletePreview
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActorFromContext ¶
ActorFromContext retrieves the resolved actor stamped onto the request context by actorMiddleware. Returns the default if missing so callers don't have to nil-check.
Types ¶
type BriefDoc ¶
type BriefDoc struct {
Filename string `json:"filename"`
Type model.DocumentType `json:"type"`
Description string `json:"description,omitempty"`
SourcePath string `json:"source_path,omitempty"`
LinkedVia []string `json:"linked_via"`
Content string `json:"content"`
}
BriefDoc mirrors internal/cli/issue.go:briefDoc — one linked document with its full content inlined and an attribution path captured in LinkedVia.
type CascadeCount ¶
type ClaimResult ¶
ClaimResult mirrors internal/cli/issue.go:claimResult. Issue is nil when no work is currently claimable so JSON consumers see {"issue": null}.
type DocView ¶
type DocView struct {
Document *model.Document `json:"document"`
Links []*model.DocumentLink `json:"links"`
}
DocView mirrors internal/cli/output.go:docView so JSON consumers see the same shape from `bacio doc show -o json` and `GET /documents/{filename}`.
type DocumentCascadeCount ¶
type DocumentCascadeCount struct {
IssueLinks int `json:"issue_links"`
FeatureLinks int `json:"feature_links"`
}
DocumentCascadeCount counts the link rows that would be removed alongside a document delete. Issue and feature link rows live in the same table — kept separate here to match the cascade preview rendered for issue deletes (CascadeCount) so consumers can pick out either kind.
type DocumentDeletePreview ¶
type DocumentDeletePreview struct {
Document *model.Document `json:"document"`
Cascade DocumentCascadeCount `json:"cascade"`
WouldDelete bool `json:"would_delete"`
}
DocumentDeletePreview is the dry-run payload for DELETE /documents/{filename}.
type DocumentUnlinkPreview ¶
type DocumentUnlinkPreview struct {
Filename string `json:"filename"`
Target string `json:"target"`
WouldRemove int `json:"would_remove"`
}
DocumentUnlinkPreview is the dry-run payload for DELETE /documents/{filename}/links.
type FeatureDeletePreview ¶
type FeatureDeletePreview struct {
Feature *model.Feature `json:"feature"`
WouldDelete bool `json:"would_delete"`
IssuesUnlinked int `json:"issues_unlinked"`
DocumentLinks int `json:"document_links"`
}
FeatureDeletePreview mirrors internal/cli/feature.go:featureDeletePreview. IssuesUnlinked counts issues that would have feature_id set to NULL (the schema cascades via SET NULL); DocumentLinks counts document_links rows that would actually be removed.
type FeatureView ¶
type FeatureView struct {
Feature *model.Feature `json:"feature"`
Issues []*model.Issue `json:"issues"`
Documents []*model.DocumentLink `json:"documents"`
}
FeatureView mirrors internal/cli/output.go:featureView so JSON consumers see the same shape from `bacio feature show -o json` and the API.
type IssueBrief ¶
type IssueBrief struct {
Issue *model.Issue `json:"issue"`
Feature *model.Feature `json:"feature,omitempty"`
Relations *store.IssueRelations `json:"relations"`
PullRequests []*model.PullRequest `json:"pull_requests"`
Documents []*BriefDoc `json:"documents"`
Comments []*model.Comment `json:"comments"`
Warnings []string `json:"warnings"`
}
IssueBrief mirrors internal/cli/issue.go:issueBrief — bulk-context JSON payload for an issue (issue + feature + linked docs + comments + relations + PRs) collapsed into one structured response.
type IssueDeletePreview ¶
type IssueDeletePreview struct {
Issue *model.Issue `json:"issue"`
Cascade CascadeCount `json:"cascade"`
WouldDelete bool `json:"would_delete"`
}
type IssueView ¶
type IssueView struct {
Issue *model.Issue `json:"issue"`
Comments []*model.Comment `json:"comments"`
Relations *store.IssueRelations `json:"relations"`
PullRequests []*model.PullRequest `json:"pull_requests"`
Documents []*model.DocumentLink `json:"documents"`
}
type Options ¶
Options is the bind/auth configuration for an API server. Token is the shared bearer secret; an empty string disables auth (and logs nothing on /healthz, which is unauthenticated regardless).
type PRDetachPreview ¶
type PlanEntry ¶
type PlanEntry struct {
Key string `json:"key"`
Title string `json:"title"`
State model.State `json:"state"`
Assignee string `json:"assignee,omitempty"`
BlockedBy []string `json:"blocked_by,omitempty"`
}
PlanEntry mirrors internal/cli/plan.go:planEntry.
type RelationDeletePreview ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the wired-up HTTP server. The caller (cmd/bacio) owns the store and is responsible for Open/Close; New does not take ownership.
Source Files
¶
- audit.go
- dryrun.go
- errors.go
- handlers_brief.go
- handlers_claim.go
- handlers_comments.go
- handlers_documents.go
- handlers_feature.go
- handlers_health.go
- handlers_history.go
- handlers_issue.go
- handlers_plan.go
- handlers_prs.go
- handlers_relations.go
- handlers_repo.go
- handlers_schema.go
- handlers_tags.go
- middleware.go
- resolve.go
- router.go
- server.go
- views.go