Documentation
¶
Overview ¶
Package resources defines declarative Admin API resource metadata.
Index ¶
Constants ¶
const ( MaxBatchLookupKeys = 1000 MaxBatchLookupKeyBytes = 256 MaxBatchLookupAggregateBytes = 64 << 10 )
Variables ¶
var (
ErrInvalidBatchLookup = errors.New("invalid batch lookup")
)
Functions ¶
func ValidateBatchResult ¶ added in v2.0.1
func ValidateBatchResult[T any](request BatchLookup, result map[string]T) error
ValidateBatchResult rejects response keys that were not requested. Missing keys are valid and are represented by omission from the result object.
Types ¶
type BatchLookup ¶ added in v2.0.1
type BatchLookup struct {
// contains filtered or unexported fields
}
BatchLookup is an immutable, validated repeated-query lookup request.
func ParseBatchLookup ¶ added in v2.0.1
func ParseBatchLookup(values url.Values, parameter string) (BatchLookup, error)
ParseBatchLookup accepts exactly one repeated query parameter and preserves its value order. It rejects duplicate, malformed, or excessive keys.
func ParseBatchLookupQuery ¶ added in v2.0.1
func ParseBatchLookupQuery(rawQuery, parameter string) (BatchLookup, error)
ParseBatchLookupQuery parses the raw query without discarding malformed percent-encoding, then applies the strict batch lookup contract.
func (BatchLookup) Contains ¶ added in v2.0.1
func (b BatchLookup) Contains(key string) bool
Contains reports membership in the validated request.
func (BatchLookup) Keys ¶ added in v2.0.1
func (b BatchLookup) Keys() []string
Keys returns a copy in request order.
type Endpoint ¶ added in v2.0.1
type Endpoint struct {
Name string `json:"name"`
Method string `json:"method"`
Path string `json:"path"`
Permission string `json:"-"`
}
Endpoint describes an authenticated HTTP endpoint used by a module.
type Module ¶ added in v2.0.1
type Module struct {
ID string `json:"id"`
Version string `json:"version"`
Title string `json:"title"`
Description string `json:"description"`
Icon string `json:"icon"`
Kind string `json:"kind"`
Path string `json:"path"`
Order int `json:"order"`
Permission string `json:"-"`
Endpoints []Endpoint `json:"endpoints"`
}
Module is a frontend-safe description of one admin area.