web

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2025 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateHighlight

type CreateHighlight struct {
	Title        string            `json:"title"`         // [book] book title
	Author       string            `json:"author"`        // [book] book author
	SourceURL    string            `json:"source_url"`    // [book] url of article / tweet / podcast
	Category     HighlightCategory `json:"category"`      // [book]
	Text         string            `json:"text"`          // [highlight] highlight text
	Note         string            `json:"note"`          // [highlight] note for highlight
	Chapter      string            `json:"chapter"`       // [highlight] chapter of the book
	Location     int               `json:"location"`      // [highlight] highlights location, used to order the highlights
	HighlightURL string            `json:"highlight_url"` // [highlight] unique url for the highlight (e.g. a concrete tweet)
}

type CreateHighlightRequest

type CreateHighlightRequest struct {
	Highlights []CreateHighlight `json:"highlights"`
}

type CreateHighlightResponse

type CreateHighlightResponse struct {
	ID                 int               `json:"id"`                  // [book] generated
	Title              string            `json:"title"`               // [book]
	Author             string            `json:"author"`              // [book]
	Category           HighlightCategory `json:"category"`            // [book]
	NumHighlights      int               `json:"num_highlights"`      // [book] calculated from highlights
	LastHighlightAt    string            `json:"last_highlight_at"`   // [book] calculated from highlights
	UpdatedAt          string            `json:"updated"`             // [book] generated
	SourceURL          string            `json:"source_url"`          // [book]
	ModifiedHighlights []int             `json:"modified_highlights"` // [highlight] generated
}

type ErrorResponse

type ErrorResponse struct {
	Error   string `json:"error"`
	Code    int    `json:"code"`
	Details string `json:"details,omitempty"`
}

type HighlightCategory

type HighlightCategory string
const (
	HighlightCategoryBooks HighlightCategory = "books"
)

type ListBook

type ListBook struct {
	ID            int               `json:"id"` // generated
	Title         string            `json:"title"`
	Author        string            `json:"author"`
	NumHighlights int               `json:"num_highlights"` // calculated
	SourceURL     string            `json:"source_url"`
	Category      HighlightCategory `json:"category"`
	UpdatedAt     string            `json:"updated"` // generated
}

type ListBooksResponse

type ListBooksResponse struct {
	Results []ListBook `json:"results"`
}

type ListHighlight

type ListHighlight struct {
	ID        int    `json:"id"`      // generated
	BookID    int    `json:"book_id"` // foreign key to Book.ID
	Text      string `json:"text"`
	Note      string `json:"note"`
	Chapter   string `json:"chapter"`
	Location  int    `json:"location"`
	URL       string `json:"url"`
	UpdatedAt string `json:"updated"` // generated
}

type ListHighlightsResponse

type ListHighlightsResponse struct {
	Results []ListHighlight `json:"results"`
}

type Server

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

func New

func New(conf *config.Config, stor storage.Storage) *Server

func (*Server) App

func (s *Server) App() *fiber.App

func (*Server) CheckAuth

func (s *Server) CheckAuth(user, pass string) bool

func (*Server) CheckToken

func (s *Server) CheckToken(c *fiber.Ctx, key string) (bool, error)

func (*Server) HandleAuth

func (s *Server) HandleAuth(c *fiber.Ctx) error

func (*Server) HandleCreateHighlights

func (s *Server) HandleCreateHighlights(c *fiber.Ctx) error

func (*Server) HandleError

func (s *Server) HandleError(c *fiber.Ctx, err error) error

func (*Server) HandleListBooks

func (s *Server) HandleListBooks(c *fiber.Ctx) error

func (*Server) HandleListHighlights

func (s *Server) HandleListHighlights(c *fiber.Ctx) error

func (*Server) HandleRoot

func (s *Server) HandleRoot(c *fiber.Ctx) error

func (*Server) HandleUIDeleteHighlight added in v0.2.2

func (s *Server) HandleUIDeleteHighlight(c *fiber.Ctx) error

func (*Server) HandleUIIndex

func (s *Server) HandleUIIndex(c *fiber.Ctx) error

func (*Server) HandleUIListBooks

func (s *Server) HandleUIListBooks(c *fiber.Ctx) error

func (*Server) HandleUIListHighlights

func (s *Server) HandleUIListHighlights(c *fiber.Ctx) error

func (*Server) HandleUIUpdateHighlight added in v0.2.2

func (s *Server) HandleUIUpdateHighlight(c *fiber.Ctx) error

Jump to

Keyboard shortcuts

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