api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package api provides an HTTP API server for hawk, consumable by SDKs.

Index

Constants

View Source
const Version = "0.4.0"

Version is the current hawk API version.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatRequest

type ChatRequest struct {
	Message string `json:"message"`
	Model   string `json:"model"`
}

ChatRequest is the request body for POST /chat.

type ChatResponse

type ChatResponse struct {
	Response string `json:"response"`
}

ChatResponse is the response body for POST /chat.

type HealthResponse

type HealthResponse struct {
	Status string `json:"status"`
}

HealthResponse is the response body for GET /health.

type Server

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

Server is the HTTP API server for hawk.

func New

func New(addr string) *Server

New creates a new API server listening on the given address.

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler returns the underlying http.Handler for testing purposes.

func (*Server) Start

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

Start starts the HTTP server. It blocks until the context is cancelled or an error occurs.

func (*Server) Stop

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

Stop gracefully shuts down the HTTP server.

type VersionResponse

type VersionResponse struct {
	Version string `json:"version"`
}

VersionResponse is the response body for GET /version.

Jump to

Keyboard shortcuts

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