Documentation
¶
Overview ¶
Package api provides REST API server with 27 verified endpoints.
Implements HTTP REST API using Gin framework with standard response format, CORS support, and comprehensive endpoint coverage for all system operations.
Index ¶
- func BadRequestError(c *gin.Context, message string)
- func CreatedResponse(c *gin.Context, message string, data interface{})
- func ErrorResponse(c *gin.Context, code int, message string)
- func InternalError(c *gin.Context, message string)
- func NotFoundError(c *gin.Context, message string)
- func NotFoundErrorWithID(c *gin.Context, id string)
- func SuccessResponse(c *gin.Context, message string, data interface{})
- type AnalyzeRequest
- type AnalyzeResponse
- type CategoryResponse
- type CreateCategoryRequest
- type CreateDomainRequest
- type CreateMemoryRequest
- type CreateRelationshipRequest
- type DateRangeSearchRequest
- type DateRangeStats
- type DiscoverRelationshipsRequest
- type DomainResponse
- type DomainStatsResponse
- type GraphEdge
- type GraphNode
- type GraphNodeRelationship
- type GraphRequest
- type GraphResponse
- type HealthResponse
- type MemoryData
- type MemoryResponse
- type PaginationMetadata
- type RelationshipResponse
- type RelationshipSuggestion
- type Response
- type SearchInfo
- type SearchRequest
- type SearchResponse
- type SearchResultItem
- type Server
- type SessionResponse
- type StatsResponse
- type TagCount
- type TagSearchRequest
- type UpdateMemoryRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BadRequestError ¶
BadRequestError sends a 400 error
func CreatedResponse ¶
CreatedResponse sends a 201 created response
func ErrorResponse ¶
ErrorResponse sends an error response
func InternalError ¶
InternalError sends a 500 error
func NotFoundError ¶
NotFoundError sends a 404 error
func NotFoundErrorWithID ¶
NotFoundErrorWithID sends a 404 error matching local-memory format
func SuccessResponse ¶
SuccessResponse sends a success response
Types ¶
type AnalyzeRequest ¶
type AnalyzeRequest struct {
AnalysisType string `json:"analysis_type"` // question, summarize, analyze, temporal_patterns
Question string `json:"question"`
Query string `json:"query"`
Timeframe string `json:"timeframe"` // today, week, month, all
Concept string `json:"concept"`
TemporalAnalysisType string `json:"temporal_analysis_type"`
Limit int `json:"limit"`
SessionID string `json:"session_id"`
Domain string `json:"domain"`
ContextLimit int `json:"context_limit"`
ResponseFormat string `json:"response_format"`
}
AnalyzeRequest represents an analysis request
type AnalyzeResponse ¶
type AnalyzeResponse struct {
Analysis string `json:"analysis,omitempty"`
Query string `json:"query,omitempty"`
Insights []string `json:"insights,omitempty"`
Patterns []string `json:"patterns,omitempty"`
Recommendations []string `json:"recommendations,omitempty"`
}
AnalyzeResponse represents an analysis response - matches local-memory format
type CategoryResponse ¶
type CategoryResponse struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
ParentCategoryID *string `json:"parent_category_id"`
ConfidenceThreshold float64 `json:"confidence_threshold"`
AutoGenerated bool `json:"auto_generated"`
CreatedAt time.Time `json:"created_at"`
}
CategoryResponse represents a category in responses
type CreateCategoryRequest ¶
type CreateCategoryRequest struct {
Name string `json:"name" binding:"required"`
Description string `json:"description"`
ParentID string `json:"parent_id"`
}
CreateCategoryRequest represents a category creation request
type CreateDomainRequest ¶
type CreateDomainRequest struct {
Name string `json:"name" binding:"required"`
Description string `json:"description"`
}
CreateDomainRequest represents a domain creation request
type CreateMemoryRequest ¶
type CreateMemoryRequest struct {
Content string `json:"content" binding:"required"`
Importance int `json:"importance"`
Tags []string `json:"tags"`
Domain string `json:"domain"`
Source string `json:"source"`
}
CreateMemoryRequest represents a memory creation request
type CreateRelationshipRequest ¶
type CreateRelationshipRequest struct {
SourceMemoryID string `json:"source_memory_id" binding:"required"`
TargetMemoryID string `json:"target_memory_id" binding:"required"`
RelationshipType string `json:"relationship_type_enum" binding:"required"`
Strength float64 `json:"strength"`
Context string `json:"context"`
}
CreateRelationshipRequest represents a relationship creation request
type DateRangeSearchRequest ¶
type DateRangeSearchRequest struct {
StartDate string `json:"start_date"` // YYYY-MM-DD
EndDate string `json:"end_date"` // YYYY-MM-DD
Limit int `json:"limit"`
SessionID string `json:"session_id"`
Domain string `json:"domain"`
}
DateRangeSearchRequest represents a date range search request
type DateRangeStats ¶
type DateRangeStats struct {
Earliest time.Time `json:"earliest"`
Latest time.Time `json:"latest"`
}
DateRangeStats represents date range info
type DiscoverRelationshipsRequest ¶
type DiscoverRelationshipsRequest struct {
Limit int `json:"limit"`
MinStrength float64 `json:"min_strength"`
}
DiscoverRelationshipsRequest represents a discovery request
type DomainResponse ¶
type DomainResponse struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
DomainResponse represents a domain in responses
type DomainStatsResponse ¶
type DomainStatsResponse struct {
Domain string `json:"domain"`
MemoryCount int `json:"memory_count"`
AverageImportance float64 `json:"average_importance"`
}
DomainStatsResponse represents domain statistics
type GraphEdge ¶
type GraphEdge struct {
ID string `json:"id"`
SourceMemoryID string `json:"source_memory_id"`
TargetMemoryID string `json:"target_memory_id"`
RelationshipType string `json:"relationship_type"`
Strength float64 `json:"strength"`
Context *string `json:"context"`
AutoGenerated bool `json:"auto_generated"`
CreatedAt string `json:"created_at"`
}
GraphEdge represents an edge in the graph - matching local-memory format
type GraphNode ¶
type GraphNode struct {
Distance int `json:"distance"`
Memory *MemoryData `json:"memory"`
Relationships []GraphNodeRelationship `json:"relationships"`
}
GraphNode represents a node in the graph - matching local-memory format
type GraphNodeRelationship ¶
type GraphNodeRelationship struct {
ID string `json:"id"`
RelationshipType string `json:"relationship_type"`
SourceMemoryID string `json:"source_memory_id"`
TargetMemoryID string `json:"target_memory_id"`
Strength float64 `json:"strength"`
Context *string `json:"context"`
AutoGenerated bool `json:"auto_generated"`
CreatedAt string `json:"created_at"`
}
GraphNodeRelationship represents a relationship on a graph node
type GraphRequest ¶
type GraphRequest struct {
Depth int `json:"depth"`
IncludeTypes []string `json:"include_types"`
MinStrength float64 `json:"min_strength"`
IncludeStrength bool `json:"include_strength"`
}
GraphRequest represents a graph mapping request
type GraphResponse ¶
type GraphResponse struct {
CentralMemory *MemoryData `json:"central_memory"`
Depth int `json:"depth"`
Edges []GraphEdge `json:"edges"`
Nodes []GraphNode `json:"nodes"`
TotalNodes int `json:"total_nodes"`
}
GraphResponse represents a graph mapping response matching local-memory format
type HealthResponse ¶
type HealthResponse struct {
Status string `json:"status"`
Session string `json:"session"`
Timestamp string `json:"timestamp"`
}
HealthResponse represents health check response
type MemoryData ¶
type MemoryData struct {
ID string `json:"id"`
Content string `json:"content"`
Source *string `json:"source"`
Slug *string `json:"slug"`
Importance int `json:"importance"`
Tags []string `json:"tags"`
SessionID string `json:"session_id"`
Domain *string `json:"domain"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
MemoryData represents memory data in responses
type MemoryResponse ¶
type MemoryResponse struct {
Memory *MemoryData `json:"memory"`
RelevanceScore float64 `json:"relevance_score"`
SimilarityScore *float64 `json:"similarity_score"`
}
MemoryResponse matches local-memory format exactly
type PaginationMetadata ¶
type PaginationMetadata struct {
HasNextPage bool `json:"has_next_page"`
HasPreviousPage bool `json:"has_previous_page"`
TotalCount int `json:"total_count"`
PageSize int `json:"page_size"`
CurrentPage int `json:"current_page"`
}
PaginationMetadata matches local-memory's pagination format
type RelationshipResponse ¶
type RelationshipResponse struct {
ID string `json:"id"`
SourceMemoryID string `json:"source_memory_id"`
TargetMemoryID string `json:"target_memory_id"`
RelationshipType string `json:"relationship_type"`
Strength float64 `json:"strength"`
Context string `json:"context,omitempty"`
AutoGenerated bool `json:"auto_generated"`
CreatedAt string `json:"created_at"`
}
RelationshipResponse represents a relationship in responses
type RelationshipSuggestion ¶
type RelationshipSuggestion struct {
SourceID string `json:"source_id"`
TargetID string `json:"target_id"`
Type string `json:"type"`
Confidence float64 `json:"confidence"`
Reasoning string `json:"reasoning"`
}
RelationshipSuggestion represents a suggested relationship
type Response ¶
type Response struct {
Success bool `json:"success"`
Message string `json:"message"`
Data interface{} `json:"data,omitempty"`
}
Response represents a standard API response VERIFIED: Matches local-memory response format exactly
type SearchInfo ¶
type SearchInfo struct {
Query string `json:"query"`
SearchType string `json:"search_type"`
TotalResults int `json:"total_results"`
ProcessingTimeMs int `json:"processing_time_ms"`
HasMoreResults bool `json:"has_more_results"`
}
SearchInfo matches local-memory's search info format
type SearchRequest ¶
type SearchRequest struct {
Query string `json:"query"`
SearchType string `json:"search_type"`
UseAI bool `json:"use_ai"`
Limit int `json:"limit"`
Tags []string `json:"tags"`
Domain string `json:"domain"`
SessionID string `json:"session_id"`
SessionFilterMode string `json:"session_filter_mode"`
ResponseFormat string `json:"response_format"`
}
SearchRequest represents a search request
type SearchResponse ¶
type SearchResponse struct {
Data []SearchResultItem `json:"data"`
PaginationMetadata PaginationMetadata `json:"pagination_metadata"`
QueryHash string `json:"query_hash"`
SearchInfo SearchInfo `json:"search_info"`
}
SearchResponse matches local-memory's complete search response
type SearchResultItem ¶
type SearchResultItem struct {
ID string `json:"id"`
Summary string `json:"summary"`
RelevanceScore float64 `json:"relevance_score"`
Tags []string `json:"tags,omitempty"`
Importance int `json:"importance"`
CreatedAt string `json:"created_at"`
}
SearchResultItem matches local-memory's search result format
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents the REST API server
type SessionResponse ¶
type SessionResponse struct {
SessionID string `json:"session_id"`
AgentType string `json:"agent_type"`
CreatedAt time.Time `json:"created_at"`
LastAccessed time.Time `json:"last_accessed"`
IsActive bool `json:"is_active"`
}
SessionResponse represents a session in responses
type StatsResponse ¶
type StatsResponse struct {
TotalMemories int `json:"total_memories"`
AverageImportance float64 `json:"average_importance"`
UniqueTags []string `json:"unique_tags"`
MostCommonTags []TagCount `json:"most_common_tags"`
DateRange DateRangeStats `json:"date_range"`
SessionID string `json:"session_id"`
}
StatsResponse represents system statistics
type TagSearchRequest ¶
type TagSearchRequest struct {
Tags []string `json:"tags" binding:"required"`
TagOperator string `json:"tag_operator"` // "AND" or "OR"
Limit int `json:"limit"`
SessionID string `json:"session_id"`
Domain string `json:"domain"`
}
TagSearchRequest represents a tag search request