api

package
v0.0.0-...-5700d3e Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2025 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Addr          string
	DBConfig      db.Config
	S3Config      storage.S3Config
	ScraperConfig scraper.Config
	CORSEnabled   bool
}

Config contains server configuration

type ExtractLinksRequest

type ExtractLinksRequest struct {
	URL string `json:"url"`
}

ExtractLinksRequest represents an extract links request

type ExtractLinksResponse

type ExtractLinksResponse struct {
	URL   string   `json:"url"`
	Links []string `json:"links"`
	Count int      `json:"count"`
}

ExtractLinksResponse represents an extract links response

type ImageSearchRequest

type ImageSearchRequest struct {
	Tags []string `json:"tags"`
}

ImageSearchRequest represents a search request for images by tags

type ImageSearchResponse

type ImageSearchResponse struct {
	Images []*models.ImageInfo `json:"images"`
	Count  int                 `json:"count"`
}

ImageSearchResponse represents the response for image search

type ProcessImageRequest

type ProcessImageRequest struct {
	ExtractedText string   `json:"extracted_text"` // OCR extracted text from image
	Title         string   `json:"title"`          // Auto-generated title
	ImageID       string   `json:"image_id"`       // Image UUID
	ImageURL      string   `json:"image_url"`      // Synthetic URL for uploaded image
	Summary       string   `json:"summary"`        // AI-generated summary
	Tags          []string `json:"tags"`           // AI-generated tags
}

ProcessImageRequest represents a request to process an uploaded image

type ScrapeRequest

type ScrapeRequest struct {
	URL   string `json:"url"`
	Force bool   `json:"force"` // Force re-scrape even if exists
}

ScrapeRequest represents a scrape request

type Server

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

Server represents the API server

func NewServer

func NewServer(config Config) (*Server, error)

NewServer creates a new API server

func (*Server) DB

func (s *Server) DB() *db.DB

DB returns the database instance for metrics collection

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 API server

func (*Server) UpdateImageMetrics

func (s *Server) UpdateImageMetrics()

UpdateImageMetrics updates Prometheus gauge metrics for image statistics

Jump to

Keyboard shortcuts

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