httpapi

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package httpapi serves the docz-api read endpoints under /api/v1: onboarded repos, repo detail, doc types, and documents. Handlers read through a narrow store interface, resolve the {type} URL segment by name/id_prefix/alias, and map rows to the DESIGN-0001 wire DTOs. Every route runs behind the authorize middleware and hides repos outside the caller's allowed set as 404s.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler serves the /api/v1 read and search routes. searcher is optional: when nil, the /search route is not mounted.

func NewHandler

func NewHandler(st storeReader) *Handler

NewHandler builds a Handler over a store reader, without search.

func NewHandlerWithSearch

func NewHandlerWithSearch(st storeReader, s Searcher) *Handler

NewHandlerWithSearch builds a Handler with both the store reader and a searcher, enabling the /search route.

func (*Handler) Mount

func (h *Handler) Mount(r chi.Router, gate func(http.Handler) http.Handler, extras ...func(chi.Router))

Mount registers the read routes on r behind the gate middleware (Phase 6 composes the session gate and the authorize seam into gate). Liveness and readiness probes are mounted elsewhere and bypass it. The /search route is registered only when a searcher was provided. extras run inside the same gated /api/v1 group, letting callers add routes (e.g. the auth session / logout endpoints) that share the gate without re-declaring it.

type Searcher

type Searcher interface {
	Search(ctx context.Context, p *search.SearchParams) (search.SearchResult, error)
}

Searcher is the search surface httpapi needs. *search.Client satisfies it.

Jump to

Keyboard shortcuts

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