httpapi

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 4 Imported by: 1 module, 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 httpapi implements the API conventions from docs/api-conventions.md: resource IDs, cursor pagination envelope, and problem-details error codes. All /privacy/v1 and /iam/v1 handlers must use these helpers.

Index

Constants

View Source
const (
	DefaultLimit = 20
	MaxLimit     = 100
	// MaxCatalogLimit is the page limit of lists that hold configuration
	// rather than data about people — roles, permissions, API keys — which a
	// console loads whole to fill a picker. Lists of users, requests and
	// events keep MaxLimit, so one call exposes at most that many records.
	MaxCatalogLimit = 1000
)
View Source
const (
	CodeValidationFailed    = "validation_failed"
	CodeUnauthenticated     = "unauthenticated"
	CodePermissionDenied    = "permission_denied"
	CodeNotFound            = "not_found"
	CodeConflict            = "conflict"
	CodeIdempotencyConflict = "idempotency_conflict"
	CodeLegalHoldActive     = "legal_hold_active"
	CodePolicyViolation     = "policy_violation"
	CodeRateLimited         = "rate_limited"
	// CodeReauthenticationNeeded: the action needs a sign-in more recent than
	// the one the token carries.
	CodeReauthenticationNeeded = "reauthentication_needed"
	// CodeInsufficientAAL: the user has MFA and the action needs a session that
	// verified the second factor (aal2).
	CodeInsufficientAAL = "insufficient_aal"
	CodeInternal        = "internal"
)

Variables

This section is empty.

Functions

func NewID

func NewID(prefix string) string

NewID returns "<prefix>_<32 hex>". Prefixes: pr, dst, hold, role, key, evt.

func ValidID

func ValidID(id string) bool

Types

type ListParams

type ListParams struct {
	Limit  int
	Cursor string
	Sort   string // "field" | "-field", comma-separated
	// Max caps Limit; zero means MaxLimit.
	Max int
}

ListParams is the canonical list input. Cursor is opaque to clients.

func (ListParams) Norm

func (p ListParams) Norm() ListParams

type Page

type Page[T any] struct {
	Items      []T     `json:"items"`
	NextCursor *string `json:"next_cursor"`
}

Page is the list envelope: {"items":[...],"next_cursor":"..."|null}.

Jump to

Keyboard shortcuts

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