api

package
v0.0.0-...-72e33f6 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const Route = "/v1"

Variables

This section is empty.

Functions

func ActorMiddleware

func ActorMiddleware() echo.MiddlewareFunc

ActorMiddleware sets the actor context from session context or token.

func DahuaAferoFileURI

func DahuaAferoFileURI(name string) string

func DahuaDeviceFileURI

func DahuaDeviceFileURI(deviceID int64, filePath string) string

func MediamtxURI

func MediamtxURI(path string) string

func RequireAuthMiddleware

func RequireAuthMiddleware() echo.MiddlewareFunc

RequireAuthMiddleware allows only if actor is system or session is valid.

func SessionMiddleware

func SessionMiddleware() echo.MiddlewareFunc

SessionMiddleware sets the session context.

func WS

func WS(ctx context.Context, conn *websocket.Conn, pub *pubsub.Pub)

Types

type Server

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

func NewServer

func NewServer(
	pub *pubsub.Pub,
	db sqlite.DB,
	dahuaAFS afero.Fs,
	mediamtxURL *url.URL,
) *Server

func (*Server) DahuaAfero

func (s *Server) DahuaAfero(prefix string) echo.HandlerFunc

func (*Server) DahuaDevices

func (s *Server) DahuaDevices(c echo.Context) error

func (*Server) DahuaDevicesIDAudio

func (s *Server) DahuaDevicesIDAudio(c echo.Context) error

func (*Server) DahuaDevicesIDCoaxialCaps

func (s *Server) DahuaDevicesIDCoaxialCaps(c echo.Context) error

func (*Server) DahuaDevicesIDCoaxialStatus

func (s *Server) DahuaDevicesIDCoaxialStatus(c echo.Context) error

func (*Server) DahuaDevicesIDDetail

func (s *Server) DahuaDevicesIDDetail(c echo.Context) error

func (*Server) DahuaDevicesIDError

func (s *Server) DahuaDevicesIDError(c echo.Context) error

func (*Server) DahuaDevicesIDEvents

func (s *Server) DahuaDevicesIDEvents(c echo.Context) error

func (*Server) DahuaDevicesIDFiles

func (s *Server) DahuaDevicesIDFiles(c echo.Context) error

func (*Server) DahuaDevicesIDFilesPath

func (s *Server) DahuaDevicesIDFilesPath(c echo.Context) error

func (*Server) DahuaDevicesIDLicenses

func (s *Server) DahuaDevicesIDLicenses(c echo.Context) error

func (*Server) DahuaDevicesIDPTZPresetGET

func (s *Server) DahuaDevicesIDPTZPresetGET(c echo.Context) error

func (*Server) DahuaDevicesIDPTZPresetPOST

func (s *Server) DahuaDevicesIDPTZPresetPOST(c echo.Context) error

func (*Server) DahuaDevicesIDRPCPOST

func (s *Server) DahuaDevicesIDRPCPOST(c echo.Context) error

func (*Server) DahuaDevicesIDSnapshot

func (s *Server) DahuaDevicesIDSnapshot(c echo.Context) error

func (*Server) DahuaDevicesIDSoftware

func (s *Server) DahuaDevicesIDSoftware(c echo.Context) error

func (*Server) DahuaDevicesIDStorage

func (s *Server) DahuaDevicesIDStorage(c echo.Context) error

func (*Server) DahuaDevicesIDUptime

func (s *Server) DahuaDevicesIDUptime(c echo.Context) error

func (*Server) DahuaDevicesIDUsers

func (s *Server) DahuaDevicesIDUsers(c echo.Context) error

func (*Server) DahuaEvents

func (s *Server) DahuaEvents(c echo.Context) error

func (*Server) Mediamtx

func (s *Server) Mediamtx(prefix string) echo.HandlerFunc

func (*Server) Register

func (s *Server) Register(e *echo.Group) *Server

func (*Server) RegisterSession

func (s *Server) RegisterSession(e *echo.Group) *Server

func (*Server) Session

func (s *Server) Session(c echo.Context) error

func (*Server) SessionDELETE

func (s *Server) SessionDELETE(c echo.Context) error

func (*Server) SessionPOST

func (s *Server) SessionPOST(c echo.Context) error

func (Server) WS

func (s Server) WS(c echo.Context) error

type SesionResp

type SesionResp struct {
	Admin    bool   `json:"admin"`
	Disabled bool   `json:"disabled"`
	UserID   int64  `json:"user_id"`
	Username string `json:"username"`
	Valid    bool   `json:"valid"`
}

type StreamPayload

type StreamPayload struct {
	Data    any     `json:"data,omitempty"`
	Message *string `json:"message,omitempty"`
	OK      bool    `json:"ok"`
}

type WSData

type WSData struct {
	Type string `json:"type"`
	Data any    `json:"data"`
}

type WSEvent

type WSEvent struct {
	Action string `json:"action"`
	Data   any    `json:"data"`
}

Jump to

Keyboard shortcuts

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