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 processes HTTP API requests for tag management operations. It provides REST endpoints for adding, deleting, and retrieving tags.
func NewHandler ¶
NewHandler creates a new API handler with the specified tag management channel.
Parameters:
- tagManagerChan: Channel for sending tag management commands
func (*Handler) DeleteTag ¶
DeleteTag handles HTTP DELETE requests to remove tags. It expects a JSON array of TagRecord objects in the request body. Returns 200 OK on success, 400 Bad Request for invalid JSON or validation errors, 404 Not Found if one or more tags do not exist, or 500 Internal Server Error for unexpected errors.
func (*Handler) GetTags ¶
GetTags handles HTTP GET requests to retrieve all tags. Returns 200 OK with a JSON array of all currently stored tags.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server provides an HTTP API server for tag management operations. It exposes REST endpoints for adding, deleting, and retrieving tags.
func NewServer ¶
NewServer creates and initializes a new API server.
Parameters:
- port: Port number to listen on
- tagManagerChan: Channel for tag management operations
func (*Server) Start ¶
Start starts the HTTP API server and begins listening for requests. It registers routes for POST /api/v1/tags, DELETE /api/v1/tags, and GET /api/v1/tags. The server runs until an error occurs or it is stopped.
Returns an error if the server cannot start or encounters a fatal error.