http

package
v0.0.0-...-e6755ab Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2025 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const ErrorCodeJSONDecodingFailed = 1001
View Source
const ErrorCodeServerError = 500
View Source
const ErrorCodeValidationFailed = 1002

Variables

This section is empty.

Functions

func NewJSONError

func NewJSONError(message string, code int) []byte

func NewRouter

func NewRouter(application app.App) *chi.Mux

func NewServerError

func NewServerError(ctx context.Context, err error) []byte

func ZapErrorLogContext

func ZapErrorLogContext(err error) []zap.Field

Types

type AlertDestinationCreateRequest

type AlertDestinationCreateRequest struct {
	Type           string            `json:"type" validate:"required"`
	WebhookURL     *string           `json:"webhook_url" validate:"omitempty,http_url"`
	WebhookHeaders map[string]string `json:"webhook_headers" validate:"omitempty"`
}

type AlertDestinationHandler

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

func NewAlertDestinationHandler

func NewAlertDestinationHandler(application app.App) AlertDestinationHandler

func (AlertDestinationHandler) Create

Create creates a new alert notification destination. The request model is AlertDestinationCreateRequest.

type AlertHandler

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

func NewAlertHandler

func NewAlertHandler(application app.App) AlertHandler

func (AlertHandler) List

type AlertListResponse

type AlertListResponse struct {
	Alerts []repository.Alert `json:"alerts"`
}

type Error

type Error struct {
	Message string `json:"message"`
	Code    int    `json:"code"`
}

type Event

type Event ingestion.SDKEvent

type EventHandler

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

func NewEventHandler

func NewEventHandler(app app.App, aggr *ingestion.Aggregator) EventHandler

func (EventHandler) IngestionHandler

func (h EventHandler) IngestionHandler() func(w http.ResponseWriter, r *http.Request)

type NetworkAddress

type NetworkAddress struct {
	Host string
	Port int
}

func (NetworkAddress) String

func (addr NetworkAddress) String() string

type Project

type Project struct {
	ID               uint      `json:"id"`
	CreatedAt        time.Time `json:"created_at"`
	UpdatedAt        time.Time `json:"updated_at"`
	Name             string    `json:"name"`
	IngestionAPIKeys []string  `json:"ingestion_api_keys"`
	PublicID         string    `json:"public_id"`
}

type ProjectCreateRequest

type ProjectCreateRequest struct {
	Name string `json:"name" validate:"required"`
}

type ProjectCreateResponse

type ProjectCreateResponse struct {
	Project Project `json:"project"`
}

type ProjectEventMessage

type ProjectEventMessage struct {
	ProjectID uint  `json:"project_id"`
	Event     Event `json:"event"`
}

type ProjectHandler

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

func NewProjectHandler

func NewProjectHandler(application app.App) ProjectHandler

func (ProjectHandler) Create

func (h ProjectHandler) Create(w http.ResponseWriter, r *http.Request)

func (ProjectHandler) Read

type ProjectReadResponse

type ProjectReadResponse struct {
	Project Project `json:"project"`
}

type Server

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

func NewServer

func NewServer(logger *zap.Logger, addr NetworkAddress) *Server

func (*Server) Address

func (s *Server) Address() string

func (*Server) Close

func (s *Server) Close() error

func (*Server) OnShutdown

func (s *Server) OnShutdown(fn func() error)

func (*Server) Run

func (s *Server) Run() error

func (*Server) SetHandler

func (s *Server) SetHandler(h http.Handler)

func (*Server) ShutdownHandler

func (s *Server) ShutdownHandler(osSignalEnabled bool, cancelFunc func() error) func() error

type ZapError

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

func NewZapError

func NewZapError(err error, fields ...zap.Field) ZapError

func (ZapError) Error

func (e ZapError) Error() string

func (ZapError) LogContext

func (e ZapError) LogContext() []zap.Field

func (ZapError) Unwrap

func (e ZapError) Unwrap() error

Jump to

Keyboard shortcuts

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