api

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package api exposes The Rabbit Hole's item store over HTTP as JSON — the stable /api/* contract (see docs/api.md). Handlers call the same internal/store functions the CLI calls. It is mounted by internal/server alongside the HTML web UI; the two are separate route sets over the same store.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API wires the JSON HTTP handlers to a Store.

func New

func New(db *store.Store) *API

New returns an API backed by db.

func (*API) Routes

func (s *API) Routes() http.Handler

Routes builds the JSON API handler. Uses the stdlib's method+wildcard ServeMux (Go 1.22+) — no router dependency needed. The patterns keep their full /api/ prefix so this mux still matches when internal/server mounts it under "/api/" without StripPrefix.

type Item

type Item struct {
	ID             string     `json:"id"`
	Source         string     `json:"source"`
	Title          string     `json:"title"`
	Link           string     `json:"link"`
	Status         string     `json:"status"`
	LLMScore       *int       `json:"llm_score,omitempty"`
	LLMScoreReason *string    `json:"llm_score_reason,omitempty"`
	LLMScoreModel  *string    `json:"llm_score_model,omitempty"`
	LLMProfileID   *string    `json:"llm_profile_id,omitempty"`
	LLMProfileName *string    `json:"llm_profile_name,omitempty"`
	LLMProfileHash *string    `json:"llm_profile_hash,omitempty"`
	UserScore      *int       `json:"user_score,omitempty"`
	PublishedAt    *time.Time `json:"published_at,omitempty"`
}

Item is the JSON shape of a store.ItemRow. Kept separate from ItemRow so internal/store stays free of HTTP/JSON concerns.

Jump to

Keyboard shortcuts

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