api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Overview

Package api owns shithub's PAT-authenticated HTTP API surface. S08 ships exactly one route: GET /api/v1/user. Later sprints (S22 PRs, S30 orgs, …) extend the surface here.

Routes registered here run inside the CSRF-EXEMPT group of the chi router. Auth is provided by the PATAuth middleware: no PAT → 401; PAT lacking the required scope → 403; valid scoped PAT → 200.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deps

type Deps struct {
	Pool      *pgxpool.Pool
	Debouncer *pat.Debouncer
}

Deps is the wiring the API handlers need. Constructed by the web package and injected at registration time.

type Handlers

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

Handlers is the registered API handler set. Construct with New.

func New

func New(d Deps) (*Handlers, error)

New constructs the handler set, validating Deps.

func (*Handlers) Mount

func (h *Handlers) Mount(r chi.Router)

Mount registers /api/v1/* on r. Caller is responsible for putting r in a CSRF-exempt group.

Jump to

Keyboard shortcuts

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