Documentation
¶
Overview ¶
Package api provides the HTTP client and base request primitives for the Supermodel API. It handles authentication headers, idempotency keys, error parsing, and response decoding.
This is a shared kernel package. It must contain no business logic. Slice packages under internal/ may import it freely.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an authenticated Supermodel API client.
type Error ¶
type Error struct {
StatusCode int `json:"-"`
Status int `json:"status"`
Code string `json:"code"`
Message string `json:"message"`
}
Error represents a non-2xx response from the API.
type Graph ¶
type Graph struct {
Nodes []Node `json:"nodes"`
Edges []Relationship `json:"edges"`
Relationships []Relationship `json:"relationships"`
Metadata map[string]any `json:"metadata,omitempty"`
}
Graph is the unified response type for /v1/supermodel and /v1/repos/{id}/graph/display. The API serialises relationships as either "edges" or "relationships" depending on the endpoint; Rels() unifies both.
func (*Graph) NodesByLabel ¶
NodesByLabel returns all nodes that carry the given label.
func (*Graph) Rels ¶
func (g *Graph) Rels() []Relationship
Rels returns all relationships regardless of which JSON field they came from.