http

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler handles HTTP API requests

func NewHandler

func NewHandler(memory *action.Memory) *Handler

NewHandler creates a new HTTP handler

func (*Handler) Add

func (h *Handler) Add(w http.ResponseWriter, r *http.Request)

Add handles POST /api/v1/memories/add

func (*Handler) Delete

func (h *Handler) Delete(w http.ResponseWriter, r *http.Request)

Delete handles DELETE /api/v1/memories/{id}

func (*Handler) Health

func (h *Handler) Health(w http.ResponseWriter, r *http.Request)

Health handles GET /health

func (*Handler) RegisterRoutes

func (h *Handler) RegisterRoutes(mux *http.ServeMux)

RegisterRoutes registers all HTTP routes

func (*Handler) Retrieve

func (h *Handler) Retrieve(w http.ResponseWriter, r *http.Request)

Retrieve handles POST/GET /api/v1/memories/retrieve

type Response

type Response struct {
	Success bool   `json:"success"`
	Data    any    `json:"data,omitempty"`
	Error   string `json:"error,omitempty"`
}

Response represents a standard API response

type Server

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

Server represents an HTTP server

func NewServer

func NewServer(memory *action.Memory, config ServerConfig) *Server

NewServer creates a new HTTP server

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown gracefully shuts down the server

func (*Server) Start

func (s *Server) Start() error

Start starts the HTTP server

type ServerConfig

type ServerConfig struct {
	Host         string
	Port         int
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
}

ServerConfig contains HTTP server configuration

func DefaultServerConfig

func DefaultServerConfig() ServerConfig

DefaultServerConfig returns default server configuration

Jump to

Keyboard shortcuts

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