api

package
v0.11.0-rc9 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: Apache-2.0, MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Prefix is the non-colliding REST prefix for the Auto Claim admin API.
	Prefix = "/autoclaim/v1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API exposes Auto Claim manual decision routes.

func New

func New(
	cfg Config,
	storage Storage,
	registry autoclaimtypes.ClaimerRegistry,
	options ...Option,
) (*API, error)

New creates an optional Auto Claim admin API. Disabled APIs do not register Auto Claim routes.

func (*API) RegisterRoutes

func (a *API) RegisterRoutes(router gin.IRouter)

RegisterRoutes registers Auto Claim admin routes on router when the API is enabled.

func (*API) Router

func (a *API) Router() http.Handler

Router returns the API HTTP handler.

type Config

type Config struct {
	Enabled bool
}

Config configures the optional Auto Claim admin API.

func ConfigFromRESTConfig

func ConfigFromRESTConfig(enabled bool, _ aggkitcommon.RESTConfig) Config

ConfigFromRESTConfig builds an admin API Config from global config.

type Option

type Option func(*API)

Option configures an API instance.

func WithLogger

func WithLogger(log aggkitcommon.Logger) Option

WithLogger configures optional API startup logs.

func WithNow

func WithNow(now func() time.Time) Option

WithNow configures the clock used for manual decision timestamps.

type PublicREST

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

PublicREST serves the Auto Claim public read endpoints.

func NewPublicREST

func NewPublicREST(querier Querier, readTimeout time.Duration) *PublicREST

NewPublicREST creates a PublicREST that serves autoclaim read endpoints.

func (*PublicREST) RegisterRoutes

func (p *PublicREST) RegisterRoutes(router gin.IRouter)

RegisterRoutes registers Auto Claim public read routes on router.

GET /autoclaim/v1/bridges
GET /autoclaim/v1/bridges/:id

type Querier

type Querier interface {
	GetRequest(ctx context.Context, key autoclaimtypes.RequestKey) (*autoclaimtypes.AutoClaimRequest, error)
	ListRequests(ctx context.Context, filter autoclaimtypes.RequestFilter) (*autoclaimtypes.RequestPage, error)
}

Querier is the read-only view of Auto Claim request state needed for the public API.

type Storage

Storage is the admin API persistence boundary.

Directories

Path Synopsis
Package docs Code generated by swaggo/swag.
Package docs Code generated by swaggo/swag.

Jump to

Keyboard shortcuts

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