// Package model holds the Go types the GraphQL schema binds to.
//
// They are hand-written rather than generated so that the wire shape is
// reviewable in one file, and they are deliberately their own types rather than
// aliases of service/'s: a GraphQL type is a published contract, and binding it
// straight onto an internal struct means every field added below the API layer
// appears in the schema by accident.
//
// Fields gqlgen resolves with a call rather than a struct read — Space.approvedRev,
// Project.spaces — are absent here on purpose. Their absence is what makes gqlgen
// generate a resolver for them, so the repository is only opened, and the
// membership only listed, when a query actually asks.
package model
import "time"
// Space is one space: a bare git repository addressed ~owner/name.
type Space struct {
Owner string
Name string
Ref string
Created time.Time
}
// Document is one document at one revision.
//
// The optional frontmatter fields are plain strings, with the empty string
// meaning "the frontmatter does not carry this key". DocID is the exception and
// is a pointer, because there the distinction is load-bearing: a null DocID is
// exactly the case where ID fell back to the document's path, which is what an
// agent about to propose an edit has to know.
type Document struct {
Space string
ID string
DocID *string
Path string
Rev string
Blob string
Pinned bool
Title string
Status string
Section string
Summary string
Type string
Supersedes string
Tags []string
Owners []string
Markdown string
}
// Project is one project: a saved filter over the one global index.
type Project struct {
Owner string
Name string
Ref string
Meta bool
}
// SearchResults is one page of ranked hits.
type SearchResults struct {
Total int
Took string
Hits []*SearchHit
}
// SearchHit is one ranked document.
type SearchHit struct {
Space string
ID string
Rev string
Path string
Anchor string
Title string
Section string
Lang string
Score float64
Snippet string
}
// Proposal is one proposal as the read schema reports it.
type Proposal struct {
ID int
Space string
Title string
Rationale string
BaseRev string
Branch string
State ProposalState
Approval *Approval
MergedRev *string
Agent string
AgentSession string
Created time.Time
Resolved *time.Time
}