service

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrServiceUnavailable = errors.New("marketplace service unavailable")
	ErrInvalidCategory    = errors.New("invalid category")
	ErrAgentNotFound      = errors.New("agent not found")
	ErrRateLimited        = errors.New("rate limited")
)

Functions

This section is empty.

Types

type AgentExtractor

type AgentExtractor interface {
	Extract(ctx context.Context, browser browser.Controller, category string) ([]types.Agent, error)
}

AgentExtractor extracts agent data

type CategoryExtractor

type CategoryExtractor interface {
	Extract(ctx context.Context, browser browser.Controller) ([]types.Category, error)
}

CategoryExtractor extracts category data

type Config

type Config struct {
	BaseURL        string
	CacheEnabled   bool
	CacheTTL       time.Duration
	RequestTimeout time.Duration
	UserAgent      string
}

Config holds service configuration

type ContentExtractor

type ContentExtractor interface {
	Extract(ctx context.Context, browser browser.Controller, url string) (string, error)
}

ContentExtractor extracts agent content/definition

type ExtractorSet

type ExtractorSet struct {
	Categories CategoryExtractor
	Agents     AgentExtractor
	Content    ContentExtractor
}

ExtractorSet holds all data extractors

type MarketplaceService

type MarketplaceService interface {
	// Categories
	GetCategories(ctx context.Context) ([]types.Category, error)

	// Agents
	GetAgents(ctx context.Context, category string) ([]types.Agent, error)
	GetAgent(ctx context.Context, agentID string) (*types.Agent, error)

	// Content
	GetAgentContent(ctx context.Context, agentID string) (string, error)

	// Cache management
	RefreshCache(ctx context.Context) error
	ClearCache() error
	GetCacheStats() interface{} // Returns cache.CacheStats

	// Health
	HealthCheck(ctx context.Context) error
}

MarketplaceService defines the interface for marketplace operations

func NewMarketplaceService

func NewMarketplaceService(
	browser browser.Controller,
	cache cache.Manager,
	extractors ExtractorSet,
	config Config,
) MarketplaceService

NewMarketplaceService creates a new marketplace service

type SearchQuery

type SearchQuery struct {
	Query     string
	Category  string
	Limit     int
	MinRating float32
	SortBy    string // name, rating, downloads, date
	SortOrder string // asc, desc
}

SearchQuery defines search parameters

Jump to

Keyboard shortcuts

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