api

package
v0.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DateRange

type DateRange struct {
	Start string `json:"start"`
	End   string `json:"end"`
}

DateRange represents a date range

type ErrorResponse

type ErrorResponse struct {
	Error      string      `json:"error"`
	Message    string      `json:"message"`
	StatusCode int         `json:"status_code"`
	Details    interface{} `json:"details,omitempty"`
}

ErrorResponse represents an error response

type EventsResponse

type EventsResponse struct {
	Events     []models.EventOutput `json:"events"`
	Total      int                  `json:"total"`
	Page       int                  `json:"page"`
	PageSize   int                  `json:"page_size"`
	TotalPages int                  `json:"total_pages"`
}

EventsResponse represents the response for events endpoint

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server represents the API server

func NewServer

func NewServer(db *database.SQLiteDB, config *models.Config, port int) *Server

NewServer creates a new API server

func (*Server) HandleEvents

func (s *Server) HandleEvents(w http.ResponseWriter, r *http.Request)

func (*Server) HandleExport

func (s *Server) HandleExport(w http.ResponseWriter, r *http.Request)

func (*Server) HandleHealth

func (s *Server) HandleHealth(w http.ResponseWriter, r *http.Request)

func (*Server) HandleStats

func (s *Server) HandleStats(w http.ResponseWriter, r *http.Request)

func (*Server) HandleStatus

func (s *Server) HandleStatus(w http.ResponseWriter, r *http.Request)

func (*Server) Start

func (s *Server) Start() error

Start starts the API server

type StatsResponse

type StatsResponse struct {
	TotalEvents     int            `json:"total_events"`
	OperationCounts map[string]int `json:"operation_counts"`
	ProcessCounts   map[string]int `json:"process_counts"`
	DateRange       *DateRange     `json:"date_range,omitempty"`
}

StatsResponse represents the response for stats endpoint

type StatusResponse

type StatusResponse struct {
	Status         string   `json:"status"`
	DatabaseStatus string   `json:"database_status"`
	DatabaseError  string   `json:"database_error,omitempty"`
	CanSearch      bool     `json:"can_search"`
	Message        string   `json:"message"`
	Operations     []string `json:"operations"`
	Directory      string   `json:"directory"`
	Timestamp      string   `json:"timestamp"`
}

StatusResponse represents the system status

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL