api

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2025 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadRequest = func(err error) Error { return newError(http.StatusBadRequest, err) }
	ErrNotFound   = func(err error) Error { return newError(http.StatusNotFound, err) }
	ErrInternal   = func(err error) Error { return newError(http.StatusInternalServerError, err) }
)

Functions

This section is empty.

Types

type API

type API interface {
	component.Component
	config.Watcher

	QueryAppConfigSchema(
		ctx context.Context,
		req *QueryAppConfigSchemaRequest,
	) (resp *QueryAppConfigSchemaResponse, err error)
	QueryAppConfig(ctx context.Context, req *QueryAppConfigRequest) (resp *QueryAppConfigResponse, err error)
	ApplyAppConfig(ctx context.Context, req *ApplyAppConfigRequest) (resp *ApplyAppConfigResponse, err error)

	QueryRSSHubCategories(
		ctx context.Context,
		req *QueryRSSHubCategoriesRequest,
	) (resp *QueryRSSHubCategoriesResponse, err error)
	QueryRSSHubWebsites(
		ctx context.Context,
		req *QueryRSSHubWebsitesRequest,
	) (resp *QueryRSSHubWebsitesResponse, err error)
	QueryRSSHubRoutes(ctx context.Context, req *QueryRSSHubRoutesRequest) (resp *QueryRSSHubRoutesResponse, err error)

	Write(ctx context.Context, req *WriteRequest) (resp *WriteResponse, err error) // WARN: beta!!!
	Query(ctx context.Context, req *QueryRequest) (resp *QueryResponse, err error)
}

--- Interface code block ---

type ApplyAppConfigRequest

type ApplyAppConfigRequest struct {
	config.App `yaml:",inline" json:",inline"`
}

type ApplyAppConfigResponse

type ApplyAppConfigResponse struct{}

type Config

type Config struct {
	RSSHubEndpoint string
	LLM            string
}

func (*Config) From

func (c *Config) From(app *config.App) *Config

func (*Config) Validate

func (c *Config) Validate() error

type Dependencies

type Dependencies struct {
	ConfigManager config.Manager
	FeedStorage   feed.Storage
	LLMFactory    llm.Factory
}

type Error added in v0.3.0

type Error struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

func (Error) Error added in v0.3.0

func (e Error) Error() string

type Factory

--- Factory code block ---

func NewFactory

func NewFactory(mockOn ...component.MockOption) Factory

type QueryAppConfigRequest

type QueryAppConfigRequest struct{}

type QueryAppConfigResponse

type QueryAppConfigResponse struct {
	config.App `yaml:",inline" json:",inline"`
}

type QueryAppConfigSchemaRequest

type QueryAppConfigSchemaRequest struct{}

type QueryAppConfigSchemaResponse

type QueryAppConfigSchemaResponse map[string]any

type QueryRSSHubCategoriesRequest

type QueryRSSHubCategoriesRequest struct{}

type QueryRSSHubCategoriesResponse

type QueryRSSHubCategoriesResponse struct {
	Categories []string `json:"categories,omitempty"`
}

type QueryRSSHubRoutesRequest

type QueryRSSHubRoutesRequest struct {
	WebsiteID string `json:"website_id,omitempty"`
}

type QueryRSSHubRoutesResponse

type QueryRSSHubRoutesResponse struct {
	Routes []RSSHubRoute `json:"routes,omitempty"`
}

type QueryRSSHubWebsitesRequest

type QueryRSSHubWebsitesRequest struct {
	Category string `json:"category,omitempty"`
}

type QueryRSSHubWebsitesResponse

type QueryRSSHubWebsitesResponse struct {
	Websites []RSSHubWebsite `json:"websites,omitempty"`
}

type QueryRequest

type QueryRequest struct {
	Query        string    `json:"query,omitempty"`
	Threshold    float32   `json:"threshold,omitempty"`
	LabelFilters []string  `json:"label_filters,omitempty"`
	Summarize    bool      `json:"summarize,omitempty"`
	Limit        int       `json:"limit,omitempty"`
	Start        time.Time `json:"start,omitempty"`
	End          time.Time `json:"end,omitempty"`
}

func (*QueryRequest) Validate

func (r *QueryRequest) Validate() error

type QueryRequestSemanticFilter

type QueryRequestSemanticFilter struct {
	Query     string  `json:"query,omitempty"`
	Threshold float32 `json:"threshold,omitempty"`
}

type QueryResponse

type QueryResponse struct {
	Summary string          `json:"summary,omitempty"`
	Feeds   []*block.FeedVO `json:"feeds"`
	Count   int             `json:"count"`
}

type RSSHubRoute

type RSSHubRoute struct {
	Name        string         `json:"name,omitempty"`
	Description string         `json:"description,omitempty"`
	Path        any            `json:"path,omitempty"`
	Example     string         `json:"example,omitempty"`
	Parameters  map[string]any `json:"parameters,omitempty"`
	Features    map[string]any `json:"features,omitempty"`
}

type RSSHubWebsite

type RSSHubWebsite struct {
	ID          string   `json:"id,omitempty"`
	Name        string   `json:"name,omitempty"`
	Description string   `json:"description,omitempty"`
	Categories  []string `json:"categories,omitempty"`
}

type WriteRequest

type WriteRequest struct {
	Feeds []*model.Feed `json:"feeds"`
}

type WriteResponse

type WriteResponse struct{} // TODO: data may lost (if crash just now) after Response returned.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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