Documentation
¶
Overview ¶
Package rest provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.1 DO NOT EDIT.
Package rest exposes memini's HTTP/JSON API. The surface is API-first: the routes, parameters, and request/response models are generated from api/openapi.yaml (see gen.go / api.gen.go); this file implements the generated ServerInterface on top of the service layer. The MCP surface (internal/api/mcp) shares the same service.
Index ¶
- Constants
- func Handler(si ServerInterface) http.Handler
- func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler
- func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler
- func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler
- type AnswerQuestionJSONRequestBody
- type AnswerQuestionParams
- type AnswerRequest
- type AnswerResponse
- type AuthConfig
- type ChiServerOptions
- type Error
- type ForgetMemoryParams
- type FsckReport
- type GetMemoryParams
- type GetStatsParams
- type InvalidParamFormatError
- type ListMemoriesParams
- type ListResponse
- type Memory
- type MiddlewareFunc
- type Namespace
- type NamespacesResponse
- type RememberMemoryJSONRequestBody
- type RememberMemoryParams
- type RememberRequest
- type RequiredHeaderError
- type RequiredParamError
- type RunFsckParams
- type ScoredMemory
- type SearchMemoriesJSONRequestBody
- type SearchMemoriesParams
- type SearchRequest
- type SearchResponse
- type Server
- func (h *Server) AnswerQuestion(w http.ResponseWriter, r *http.Request, _ AnswerQuestionParams)
- func (h *Server) ForgetMemory(w http.ResponseWriter, r *http.Request, boundID string, _ ForgetMemoryParams)
- func (h *Server) GetMemory(w http.ResponseWriter, r *http.Request, boundID string, _ GetMemoryParams)
- func (h *Server) GetStats(w http.ResponseWriter, r *http.Request, _ GetStatsParams)
- func (h *Server) ListMemories(w http.ResponseWriter, r *http.Request, params ListMemoriesParams)
- func (h *Server) ListNamespaces(w http.ResponseWriter, r *http.Request)
- func (h *Server) Mount(r chi.Router)
- func (h *Server) RememberMemory(w http.ResponseWriter, r *http.Request, _ RememberMemoryParams)
- func (h *Server) RunFsck(w http.ResponseWriter, r *http.Request, _ RunFsckParams)
- func (h *Server) SearchMemories(w http.ResponseWriter, r *http.Request, _ SearchMemoriesParams)
- type ServerInterface
- type ServerInterfaceWrapper
- func (siw *ServerInterfaceWrapper) AnswerQuestion(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) ForgetMemory(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetMemory(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetStats(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) ListMemories(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) ListNamespaces(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) RememberMemory(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) RunFsck(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) SearchMemories(w http.ResponseWriter, r *http.Request)
- type Stats
- type Tier
- type TooManyValuesForParamError
- type UnescapedCookieParamError
- type Unimplemented
- func (_ Unimplemented) AnswerQuestion(w http.ResponseWriter, r *http.Request, params AnswerQuestionParams)
- func (_ Unimplemented) ForgetMemory(w http.ResponseWriter, r *http.Request, id string, params ForgetMemoryParams)
- func (_ Unimplemented) GetMemory(w http.ResponseWriter, r *http.Request, id string, params GetMemoryParams)
- func (_ Unimplemented) GetStats(w http.ResponseWriter, r *http.Request, params GetStatsParams)
- func (_ Unimplemented) ListMemories(w http.ResponseWriter, r *http.Request, params ListMemoriesParams)
- func (_ Unimplemented) ListNamespaces(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) RememberMemory(w http.ResponseWriter, r *http.Request, params RememberMemoryParams)
- func (_ Unimplemented) RunFsck(w http.ResponseWriter, r *http.Request, params RunFsckParams)
- func (_ Unimplemented) SearchMemories(w http.ResponseWriter, r *http.Request, params SearchMemoriesParams)
- type UnmarshalingParamError
Constants ¶
const (
BearerAuthScopes bearerAuthContextKey = "bearerAuth.Scopes"
)
Variables ¶
This section is empty.
Functions ¶
func Handler ¶
func Handler(si ServerInterface) http.Handler
Handler creates http.Handler with routing matching OpenAPI spec.
func HandlerFromMux ¶ added in v0.0.6
func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler
HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.
func HandlerFromMuxWithBaseURL ¶ added in v0.0.6
func HandlerWithOptions ¶ added in v0.0.6
func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler
HandlerWithOptions creates http.Handler with additional options
Types ¶
type AnswerQuestionJSONRequestBody ¶ added in v0.0.6
type AnswerQuestionJSONRequestBody = AnswerRequest
AnswerQuestionJSONRequestBody defines body for AnswerQuestion for application/json ContentType.
type AnswerQuestionParams ¶ added in v0.0.6
type AnswerQuestionParams struct {
// XMeminiNamespace Tenant/agent namespace; falls back to the server default.
XMeminiNamespace *Namespace `json:"X-Memini-Namespace,omitempty"`
}
AnswerQuestionParams defines parameters for AnswerQuestion.
type AnswerRequest ¶ added in v0.0.6
type AnswerRequest struct {
// Limit Caps how many recalled memories ground the answer.
Limit *int `json:"limit,omitempty"`
Query string `json:"query"`
Tiers *[]Tier `json:"tiers,omitempty"`
}
AnswerRequest defines model for AnswerRequest.
type AnswerResponse ¶ added in v0.0.6
type AnswerResponse struct {
Answer string `json:"answer"`
Sources []ScoredMemory `json:"sources"`
}
AnswerResponse defines model for AnswerResponse.
type AuthConfig ¶
type AuthConfig struct {
// APIKey, when non-empty, is required as "Authorization: Bearer <key>".
APIKey string
// NamespaceHeader names the request header carrying the tenant namespace.
NamespaceHeader string
// DefaultNamespace is used when the header is absent.
DefaultNamespace string
}
AuthConfig configures the optional bearer-token auth and namespace resolution.
type ChiServerOptions ¶ added in v0.0.6
type ChiServerOptions struct {
BaseURL string
BaseRouter chi.Router
Middlewares []MiddlewareFunc
ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}
type Error ¶ added in v0.0.6
type Error struct {
Error *string `json:"error,omitempty"`
}
Error defines model for Error.
type ForgetMemoryParams ¶ added in v0.0.6
type ForgetMemoryParams struct {
// XMeminiNamespace Tenant/agent namespace; falls back to the server default.
XMeminiNamespace *Namespace `json:"X-Memini-Namespace,omitempty"`
}
ForgetMemoryParams defines parameters for ForgetMemory.
type FsckReport ¶ added in v0.0.6
type FsckReport struct {
DuplicateGroups *[][]string `json:"duplicate_groups,omitempty"`
ExpiredPurged int `json:"expired_purged"`
Namespaces int `json:"namespaces"`
ShortTermEvicted int `json:"short_term_evicted"`
}
FsckReport defines model for FsckReport.
type GetMemoryParams ¶ added in v0.0.6
type GetMemoryParams struct {
// XMeminiNamespace Tenant/agent namespace; falls back to the server default.
XMeminiNamespace *Namespace `json:"X-Memini-Namespace,omitempty"`
}
GetMemoryParams defines parameters for GetMemory.
type GetStatsParams ¶ added in v0.0.6
type GetStatsParams struct {
// XMeminiNamespace Tenant/agent namespace; falls back to the server default.
XMeminiNamespace *Namespace `json:"X-Memini-Namespace,omitempty"`
}
GetStatsParams defines parameters for GetStats.
type InvalidParamFormatError ¶ added in v0.0.6
func (*InvalidParamFormatError) Error ¶ added in v0.0.6
func (e *InvalidParamFormatError) Error() string
func (*InvalidParamFormatError) Unwrap ¶ added in v0.0.6
func (e *InvalidParamFormatError) Unwrap() error
type ListMemoriesParams ¶ added in v0.0.6
type ListMemoriesParams struct {
// Tier Repeatable and/or comma-separated tier filter; omitted means all tiers.
Tier *[]Tier `form:"tier,omitempty" json:"tier,omitempty"`
IncludeExpired *bool `form:"include_expired,omitempty" json:"include_expired,omitempty"`
IncludeSuperseded *bool `form:"include_superseded,omitempty" json:"include_superseded,omitempty"`
// Limit Caps the result count; 0 or absent returns all matches.
Limit *int `form:"limit,omitempty" json:"limit,omitempty"`
// XMeminiNamespace Tenant/agent namespace; falls back to the server default.
XMeminiNamespace *Namespace `json:"X-Memini-Namespace,omitempty"`
}
ListMemoriesParams defines parameters for ListMemories.
type ListResponse ¶ added in v0.0.6
type ListResponse struct {
Memories []Memory `json:"memories"`
}
ListResponse defines model for ListResponse.
type Memory ¶ added in v0.0.6
type Memory struct {
AccessCount int `json:"access_count"`
Content string `json:"content"`
CreatedAt time.Time `json:"created_at"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
Id string `json:"id"`
Importance float64 `json:"importance"`
LastAccessedAt time.Time `json:"last_accessed_at"`
Metadata *map[string]interface{} `json:"metadata,omitempty"`
Namespace string `json:"namespace"`
Summary *string `json:"summary,omitempty"`
SupersededBy *string `json:"superseded_by,omitempty"`
Tags *[]string `json:"tags,omitempty"`
Tier Tier `json:"tier"`
UpdatedAt time.Time `json:"updated_at"`
}
Memory defines model for Memory.
type NamespacesResponse ¶ added in v0.0.6
type NamespacesResponse struct {
Namespaces []string `json:"namespaces"`
}
NamespacesResponse defines model for NamespacesResponse.
type RememberMemoryJSONRequestBody ¶ added in v0.0.6
type RememberMemoryJSONRequestBody = RememberRequest
RememberMemoryJSONRequestBody defines body for RememberMemory for application/json ContentType.
type RememberMemoryParams ¶ added in v0.0.6
type RememberMemoryParams struct {
// XMeminiNamespace Tenant/agent namespace; falls back to the server default.
XMeminiNamespace *Namespace `json:"X-Memini-Namespace,omitempty"`
}
RememberMemoryParams defines parameters for RememberMemory.
type RememberRequest ¶ added in v0.0.6
type RememberRequest struct {
Content string `json:"content"`
// Id Upserts an existing memory when provided.
Id *string `json:"id,omitempty"`
Importance *float64 `json:"importance,omitempty"`
Metadata *map[string]interface{} `json:"metadata,omitempty"`
Summary *string `json:"summary,omitempty"`
Tags *[]string `json:"tags,omitempty"`
Tier *Tier `json:"tier,omitempty"`
// TtlSeconds Overrides the tier default TTL; negative means never expire.
TtlSeconds *int `json:"ttl_seconds,omitempty"`
}
RememberRequest defines model for RememberRequest.
type RequiredHeaderError ¶ added in v0.0.6
func (*RequiredHeaderError) Error ¶ added in v0.0.6
func (e *RequiredHeaderError) Error() string
func (*RequiredHeaderError) Unwrap ¶ added in v0.0.6
func (e *RequiredHeaderError) Unwrap() error
type RequiredParamError ¶ added in v0.0.6
type RequiredParamError struct {
ParamName string
}
func (*RequiredParamError) Error ¶ added in v0.0.6
func (e *RequiredParamError) Error() string
type RunFsckParams ¶ added in v0.0.6
type RunFsckParams struct {
// XMeminiNamespace Tenant/agent namespace; falls back to the server default.
XMeminiNamespace *Namespace `json:"X-Memini-Namespace,omitempty"`
}
RunFsckParams defines parameters for RunFsck.
type ScoredMemory ¶ added in v0.0.6
ScoredMemory defines model for ScoredMemory.
type SearchMemoriesJSONRequestBody ¶ added in v0.0.6
type SearchMemoriesJSONRequestBody = SearchRequest
SearchMemoriesJSONRequestBody defines body for SearchMemories for application/json ContentType.
type SearchMemoriesParams ¶ added in v0.0.6
type SearchMemoriesParams struct {
// XMeminiNamespace Tenant/agent namespace; falls back to the server default.
XMeminiNamespace *Namespace `json:"X-Memini-Namespace,omitempty"`
}
SearchMemoriesParams defines parameters for SearchMemories.
type SearchRequest ¶ added in v0.0.6
type SearchRequest struct {
IncludeExpired *bool `json:"include_expired,omitempty"`
IncludeSuperseded *bool `json:"include_superseded,omitempty"`
Limit *int `json:"limit,omitempty"`
Query string `json:"query"`
Tiers *[]Tier `json:"tiers,omitempty"`
}
SearchRequest defines model for SearchRequest.
type SearchResponse ¶ added in v0.0.6
type SearchResponse struct {
Results []ScoredMemory `json:"results"`
}
SearchResponse defines model for SearchResponse.
type Server ¶ added in v0.0.6
type Server struct {
// contains filtered or unexported fields
}
Server implements the spec-generated ServerInterface backed by a service.Service.
func (*Server) AnswerQuestion ¶ added in v0.0.6
func (h *Server) AnswerQuestion(w http.ResponseWriter, r *http.Request, _ AnswerQuestionParams)
AnswerQuestion implements POST /v1/answer.
func (*Server) ForgetMemory ¶ added in v0.0.6
func (h *Server) ForgetMemory(w http.ResponseWriter, r *http.Request, boundID string, _ ForgetMemoryParams)
ForgetMemory implements DELETE /v1/memories/{id}.
func (*Server) GetMemory ¶ added in v0.0.6
func (h *Server) GetMemory(w http.ResponseWriter, r *http.Request, boundID string, _ GetMemoryParams)
GetMemory implements GET /v1/memories/{id}.
func (*Server) GetStats ¶ added in v0.0.6
func (h *Server) GetStats(w http.ResponseWriter, r *http.Request, _ GetStatsParams)
GetStats implements GET /v1/stats.
func (*Server) ListMemories ¶ added in v0.0.6
func (h *Server) ListMemories(w http.ResponseWriter, r *http.Request, params ListMemoriesParams)
ListMemories implements GET /v1/memories.
func (*Server) ListNamespaces ¶ added in v0.0.6
func (h *Server) ListNamespaces(w http.ResponseWriter, r *http.Request)
ListNamespaces implements GET /v1/namespaces.
Unlike the other /v1 routes it is not namespace-scoped: it deliberately spans tenants. memini authenticates with a single MEMINI_API_KEY that already grants access to any namespace (the caller picks it via the namespace header), so enumerating namespaces confers no extra privilege. If memini ever grows per-tenant credentials, this endpoint must be gated behind an admin scope.
func (*Server) Mount ¶ added in v0.0.6
Mount attaches the spec-generated /v1 routes to r, wrapped in namespace + auth middleware. Binding failures on declared parameters (e.g. ?limit=abc) are rejected with 400 by the generated wrappers.
func (*Server) RememberMemory ¶ added in v0.0.6
func (h *Server) RememberMemory(w http.ResponseWriter, r *http.Request, _ RememberMemoryParams)
RememberMemory implements POST /v1/memories.
func (*Server) RunFsck ¶ added in v0.0.6
func (h *Server) RunFsck(w http.ResponseWriter, r *http.Request, _ RunFsckParams)
RunFsck implements POST /v1/fsck.
func (*Server) SearchMemories ¶ added in v0.0.6
func (h *Server) SearchMemories(w http.ResponseWriter, r *http.Request, _ SearchMemoriesParams)
SearchMemories implements POST /v1/search.
type ServerInterface ¶ added in v0.0.6
type ServerInterface interface {
// Recall memories and answer a question grounded on them (requires an LLM)
// (POST /v1/answer)
AnswerQuestion(w http.ResponseWriter, r *http.Request, params AnswerQuestionParams)
// Run a consistency sweep (purge expired, enforce short-term cap, audit duplicates)
// (POST /v1/fsck)
RunFsck(w http.ResponseWriter, r *http.Request, params RunFsckParams)
// List memories in a namespace (backs the admin UI browser)
// (GET /v1/memories)
ListMemories(w http.ResponseWriter, r *http.Request, params ListMemoriesParams)
// Remember (store) a memory
// (POST /v1/memories)
RememberMemory(w http.ResponseWriter, r *http.Request, params RememberMemoryParams)
// Forget (delete) a memory
// (DELETE /v1/memories/{id})
ForgetMemory(w http.ResponseWriter, r *http.Request, id string, params ForgetMemoryParams)
// Fetch a memory by ID
// (GET /v1/memories/{id})
GetMemory(w http.ResponseWriter, r *http.Request, id string, params GetMemoryParams)
// List the distinct namespaces holding memories
// (GET /v1/namespaces)
ListNamespaces(w http.ResponseWriter, r *http.Request)
// Recall memories via hybrid (vector + keyword) search
// (POST /v1/search)
SearchMemories(w http.ResponseWriter, r *http.Request, params SearchMemoriesParams)
// Per-namespace overview (counts by tier, accesses, importance)
// (GET /v1/stats)
GetStats(w http.ResponseWriter, r *http.Request, params GetStatsParams)
}
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶ added in v0.0.6
type ServerInterfaceWrapper struct {
Handler ServerInterface
HandlerMiddlewares []MiddlewareFunc
ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}
ServerInterfaceWrapper converts contexts to parameters.
func (*ServerInterfaceWrapper) AnswerQuestion ¶ added in v0.0.6
func (siw *ServerInterfaceWrapper) AnswerQuestion(w http.ResponseWriter, r *http.Request)
AnswerQuestion operation middleware
func (*ServerInterfaceWrapper) ForgetMemory ¶ added in v0.0.6
func (siw *ServerInterfaceWrapper) ForgetMemory(w http.ResponseWriter, r *http.Request)
ForgetMemory operation middleware
func (*ServerInterfaceWrapper) GetMemory ¶ added in v0.0.6
func (siw *ServerInterfaceWrapper) GetMemory(w http.ResponseWriter, r *http.Request)
GetMemory operation middleware
func (*ServerInterfaceWrapper) GetStats ¶ added in v0.0.6
func (siw *ServerInterfaceWrapper) GetStats(w http.ResponseWriter, r *http.Request)
GetStats operation middleware
func (*ServerInterfaceWrapper) ListMemories ¶ added in v0.0.6
func (siw *ServerInterfaceWrapper) ListMemories(w http.ResponseWriter, r *http.Request)
ListMemories operation middleware
func (*ServerInterfaceWrapper) ListNamespaces ¶ added in v0.0.6
func (siw *ServerInterfaceWrapper) ListNamespaces(w http.ResponseWriter, r *http.Request)
ListNamespaces operation middleware
func (*ServerInterfaceWrapper) RememberMemory ¶ added in v0.0.6
func (siw *ServerInterfaceWrapper) RememberMemory(w http.ResponseWriter, r *http.Request)
RememberMemory operation middleware
func (*ServerInterfaceWrapper) RunFsck ¶ added in v0.0.6
func (siw *ServerInterfaceWrapper) RunFsck(w http.ResponseWriter, r *http.Request)
RunFsck operation middleware
func (*ServerInterfaceWrapper) SearchMemories ¶ added in v0.0.6
func (siw *ServerInterfaceWrapper) SearchMemories(w http.ResponseWriter, r *http.Request)
SearchMemories operation middleware
type Stats ¶ added in v0.0.6
type Stats struct {
AvgImportance float64 `json:"avg_importance"`
ByTier map[string]int `json:"by_tier"`
Expired int `json:"expired"`
LastWriteAt *time.Time `json:"last_write_at,omitempty"`
Namespace string `json:"namespace"`
Superseded int `json:"superseded"`
// Total Live memories (excludes expired/superseded)
Total int `json:"total"`
TotalAccesses int `json:"total_accesses"`
}
Stats defines model for Stats.
type Tier ¶ added in v0.0.6
type Tier string
Tier defines model for Tier.
type TooManyValuesForParamError ¶ added in v0.0.6
func (*TooManyValuesForParamError) Error ¶ added in v0.0.6
func (e *TooManyValuesForParamError) Error() string
type UnescapedCookieParamError ¶ added in v0.0.6
func (*UnescapedCookieParamError) Error ¶ added in v0.0.6
func (e *UnescapedCookieParamError) Error() string
func (*UnescapedCookieParamError) Unwrap ¶ added in v0.0.6
func (e *UnescapedCookieParamError) Unwrap() error
type Unimplemented ¶ added in v0.0.6
type Unimplemented struct{}
func (Unimplemented) AnswerQuestion ¶ added in v0.0.6
func (_ Unimplemented) AnswerQuestion(w http.ResponseWriter, r *http.Request, params AnswerQuestionParams)
Recall memories and answer a question grounded on them (requires an LLM) (POST /v1/answer)
func (Unimplemented) ForgetMemory ¶ added in v0.0.6
func (_ Unimplemented) ForgetMemory(w http.ResponseWriter, r *http.Request, id string, params ForgetMemoryParams)
Forget (delete) a memory (DELETE /v1/memories/{id})
func (Unimplemented) GetMemory ¶ added in v0.0.6
func (_ Unimplemented) GetMemory(w http.ResponseWriter, r *http.Request, id string, params GetMemoryParams)
Fetch a memory by ID (GET /v1/memories/{id})
func (Unimplemented) GetStats ¶ added in v0.0.6
func (_ Unimplemented) GetStats(w http.ResponseWriter, r *http.Request, params GetStatsParams)
Per-namespace overview (counts by tier, accesses, importance) (GET /v1/stats)
func (Unimplemented) ListMemories ¶ added in v0.0.6
func (_ Unimplemented) ListMemories(w http.ResponseWriter, r *http.Request, params ListMemoriesParams)
List memories in a namespace (backs the admin UI browser) (GET /v1/memories)
func (Unimplemented) ListNamespaces ¶ added in v0.0.6
func (_ Unimplemented) ListNamespaces(w http.ResponseWriter, r *http.Request)
List the distinct namespaces holding memories (GET /v1/namespaces)
func (Unimplemented) RememberMemory ¶ added in v0.0.6
func (_ Unimplemented) RememberMemory(w http.ResponseWriter, r *http.Request, params RememberMemoryParams)
Remember (store) a memory (POST /v1/memories)
func (Unimplemented) RunFsck ¶ added in v0.0.6
func (_ Unimplemented) RunFsck(w http.ResponseWriter, r *http.Request, params RunFsckParams)
Run a consistency sweep (purge expired, enforce short-term cap, audit duplicates) (POST /v1/fsck)
func (Unimplemented) SearchMemories ¶ added in v0.0.6
func (_ Unimplemented) SearchMemories(w http.ResponseWriter, r *http.Request, params SearchMemoriesParams)
Recall memories via hybrid (vector + keyword) search (POST /v1/search)
type UnmarshalingParamError ¶ added in v0.0.6
func (*UnmarshalingParamError) Error ¶ added in v0.0.6
func (e *UnmarshalingParamError) Error() string
func (*UnmarshalingParamError) Unwrap ¶ added in v0.0.6
func (e *UnmarshalingParamError) Unwrap() error