api

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package api handles the API requests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chain

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

func NewChain

func NewChain(constructors ...Constructor) Chain

NewChain creates a new chain for a given list of middleware constructors

func (Chain) Then

func (c Chain) Then(h http.Handler) http.Handler

func (Chain) ThenFunc

func (c Chain) ThenFunc(fn http.HandlerFunc) http.Handler

type Constructor

type Constructor func(http.Handler) http.Handler

type DataPoint

type DataPoint struct {
	Timestamp     time.Time `json:"timestamp"`
	ResponseTime  int64     `json:"response_time"`
	IsUp          bool      `json:"is_up"`
	UpRatio       float64   `json:"up_ratio,omitempty"`
	DegradedRatio float64   `json:"degraded_ratio,omitempty"`
	DownRatio     float64   `json:"down_ratio,omitempty"`
}

type MonitorStats

type MonitorStats struct {
	ID              int64       `json:"id"`
	Name            string      `json:"name"`
	URL             string      `json:"url"`
	CheckInterval   int64       `json:"check_interval"`
	AvgResponseTime int64       `json:"avg_response_time"`
	UptimePct       float64     `json:"uptime_pct"`
	Percentiles     Percentiles `json:"percentiles"`
	Datapoints      []DataPoint `json:"data_points"`
}

type Percentiles

type Percentiles struct {
	P50 int64 `json:"p50"`
	P75 int64 `json:"p75"`
	P90 int64 `json:"p90"`
	P95 int64 `json:"p95"`
	P99 int64 `json:"p99"`
}

type PushSubscriptionKeys

type PushSubscriptionKeys struct {
	P256dh string `json:"p256dh"`
	Auth   string `json:"auth"`
}

type PushSubscriptionRequest

type PushSubscriptionRequest struct {
	Endpoint string               `json:"endpoint"`
	Keys     PushSubscriptionKeys `json:"keys"`
}

type Server

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

func NewServer

func NewServer(cfg *config.Config) *Server

func (*Server) GetConfig

func (s *Server) GetConfig(w http.ResponseWriter, r *http.Request)

func (*Server) GetIncident

func (s *Server) GetIncident(w http.ResponseWriter, r *http.Request)

func (*Server) GetIncidents

func (s *Server) GetIncidents(w http.ResponseWriter, r *http.Request)

func (*Server) GetMonitors added in v0.1.1

func (s *Server) GetMonitors(w http.ResponseWriter, r *http.Request)

func (*Server) GetVAPIDPublicKey

func (s *Server) GetVAPIDPublicKey(w http.ResponseWriter, r *http.Request)

GetVAPIDPublicKey returns the VAPID public key for client subscription

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

func (*Server) SubscribeToPushNotifications

func (s *Server) SubscribeToPushNotifications(w http.ResponseWriter, r *http.Request)

SubscribeToPushNotifications subscribes a user to push notifications for a monitor

func (*Server) UnsubscribeFromPushNotifications

func (s *Server) UnsubscribeFromPushNotifications(w http.ResponseWriter, r *http.Request)

UnsubscribeFromPushNotifications unsubscribes a user from push notifications

func (*Server) WithCORS

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

Jump to

Keyboard shortcuts

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