api

package
v1.10.2 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: AGPL-3.0 Imports: 30 Imported by: 0

Documentation

Overview

Package api implements the /api/v1/ REST handlers for monbooru.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Gallery struct {
	Name             string
	GalleryPath      string
	ThumbnailsPath   string
	DB               *db.DB
	TagSvc           *tags.Service
	RelationsSvc     *relations.Service
	InvalidateCaches func()
	// VisibleCount / TagCount return the cached non-missing-image and
	// non-alias-tag counts (the same values the Settings page shows). May
	// be nil; listGalleries falls back to a direct query then.
	VisibleCount func() (int, error)
	TagCount     func() (int, error)
}

Gallery is what API handlers need to act on a single gallery. InvalidateCaches is called after every image add/delete; may be nil.

type Handler

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

Handler is the root handler for all /api/v1/ routes.

func New

func New(cfg *config.Config, jobManager *jobs.Manager, resolver ResolverFunc, version string) *Handler

New creates a new API handler. version is surfaced on the /api/v1/ root so clients (e.g. monloader) can read the server version without scraping HTML.

func (*Handler) Mount

func (h *Handler) Mount(mux *http.ServeMux)

Mount registers every API route on mux under /api/v1/.

type ResolverFunc added in v1.1.0

type ResolverFunc func(name string) (Gallery, bool)

ResolverFunc resolves a gallery by name. Empty name = active gallery.

Jump to

Keyboard shortcuts

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