rest

package
v0.0.0-...-bc5f972 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIController

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

APIController is a server that registers endpoints for a REST API

func NewAPIController

func NewAPIController(opts ...APIControllerOpt) *APIController

NewAPIController creates an API Controller for REST API

func (*APIController) Router

func (c *APIController) Router() http.Handler

Router returns the http handler for serving REST API Server routes

type APIControllerOpt

type APIControllerOpt interface {
	// contains filtered or unexported methods
}

APIControllerOpt in an interface for applying APIHandler options.

func WithAuthenticator

func WithAuthenticator(authn users.Authenticator) APIControllerOpt

WithAuthenticator applies the given authenticator to the API Controller

func WithLogger

func WithLogger(l *slog.Logger) APIControllerOpt

WithLogger applies a custom logger for the APIController

func WithMeter

func WithMeter(m metricapi.Meter) APIControllerOpt

WithMeter applies a custom OpenTelemetry Meter for the APIController (if not set no metrics are collected)

func WithSecret

func WithSecret(s []byte) APIControllerOpt

WithSecret applies the given secret to the API Controller

func WithTracer

func WithTracer(t traceapi.Tracer) APIControllerOpt

WithTracer applies a custom OpenTelemetry Tracer for the APIController (if not set no traces are collected)

Jump to

Keyboard shortcuts

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