zmapi

package
v0.0.0-...-55a3b1d Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractCSRFToken

func ExtractCSRFToken(root *html.Node) (string, bool)

func FindNodeAttrByKey

func FindNodeAttrByKey(node *html.Node, key string) (html.Attribute, bool)

Types

type AlarmStatus

type AlarmStatus string
const (
	AlarmStatusInvalid  AlarmStatus = ""
	AlarmStatusIdle     AlarmStatus = "0"
	AlarmStatusPreAlarm AlarmStatus = "1"
	AlarmStatusAlert    AlarmStatus = "2"
	AlarmStatusAlarm    AlarmStatus = "3"
	AlarmStatusTape     AlarmStatus = "4"
)

func ParseAlarmStatus

func ParseAlarmStatus(raw string) AlarmStatus

func (AlarmStatus) String

func (s AlarmStatus) String() string

type AlertedMonitor

type AlertedMonitor struct {
	Monitor     Monitor
	AlarmStatus AlarmStatus
}

type Client

type Client interface {
	Login() error
	LoginSession() LoginSession
	RefreshLogin() error
	Monitors() (MonitorList, error)
	ExportEvent(event MonitorEvent) (io.ReadCloser, error)
	DownloadMP4(event MonitorEvent) (io.ReadCloser, error)
	AlarmStatus(monitor Monitor) (AlarmStatus, error)
	ListEvents() (EventList, error)
	ListEventsBetween(start, end time.Time) (EventList, error)
	ListMonitorEvents(monitorID string, start, end time.Time) (EventList, error)
	Version() (Version, error)
	AlertedMonitors() (map[string]AlertedMonitor, []error)
}

func NewClient

func NewClient(endpoint apitools.Endpoint, credentials LoginCredentials) Client

type EventList

type EventList []MonitorEvent

type EventWrapper

type EventWrapper struct {
	Event MonitorEvent `json:"Event"`
}

type ExportEventResult

type ExportEventResult struct {
	Result     string `json:"result"`
	ExportFile string `json:"exportFile"`
}

type ListEventsResponse

type ListEventsResponse struct {
	Events     []EventWrapper    `json:"events"`
	Pagination PaginationDetails `json:"pagination"`
}

type ListMonitorsResponse

type ListMonitorsResponse struct {
	Monitors []Monitor `json:"monitors"`
}

type LoginCredentials

type LoginCredentials struct {
	Username string
	Password string
}

type LoginDetails

type LoginDetails struct {
	AccessToken         string  `json:"access_token"`
	AccessTokenExpires  float64 `json:"access_token_expires"`
	APIVersion          string  `json:"apiversion"`
	AppendPassword      int64   `json:"append_password"`
	Credentials         string  `json:"credentials"`
	RefreshToken        string  `json:"refresh_token"`
	RefreshTokenExpires float64 `json:"refresh_token_expires"`
	Version             string  `json:"version"`
}

type LoginSession

type LoginSession struct {
	Details     LoginDetails
	Created     time.Time
	LastRefresh time.Time
}

func (LoginSession) Expired

func (s LoginSession) Expired() bool

func (*LoginSession) Refresh

func (s *LoginSession) Refresh(details LoginDetails)

func (LoginSession) RefreshRequired

func (s LoginSession) RefreshRequired() bool

type Monitor

type Monitor struct {
	Details MonitorDetails `json:"Monitor"`
	Status  MonitorStatus  `json:"Monitor_Status"`
}

func (Monitor) Name

func (s Monitor) Name() string

type MonitorAlarmStatus

type MonitorAlarmStatus struct {
	Status string `json:"status"`
}

type MonitorDetails

type MonitorDetails struct {
	AlarmFrameCount        string      `json:"AlarmFrameCount"`
	AlarmMaxFPS            interface{} `json:"AlarmMaxFPS"`
	AlarmRefBlendPerc      string      `json:"AlarmRefBlendPerc"`
	AnalysisFPSLimit       interface{} `json:"AnalysisFPSLimit"`
	AnalysisUpdateDelay    string      `json:"AnalysisUpdateDelay"`
	ArchivedEventDiskSpace interface{} `json:"ArchivedEventDiskSpace"`
	ArchivedEvents         interface{} `json:"ArchivedEvents"`
	AutoStopTimeout        interface{} `json:"AutoStopTimeout"`
	Brightness             string      `json:"Brightness"`
	Channel                string      `json:"Channel"`
	Colour                 string      `json:"Colour"`
	Colours                string      `json:"Colours"`
	Contrast               string      `json:"Contrast"`
	ControlAddress         interface{} `json:"ControlAddress"`
	ControlDevice          interface{} `json:"ControlDevice"`
	ControlID              interface{} `json:"ControlId"`
	Controllable           string      `json:"Controllable"`
	DayEventDiskSpace      string      `json:"DayEventDiskSpace"`
	DayEvents              string      `json:"DayEvents"`
	DecoderHWAccelDevice   interface{} `json:"DecoderHWAccelDevice"`
	DecoderHWAccelName     string      `json:"DecoderHWAccelName"`
	DefaultCodec           string      `json:"DefaultCodec"`
	DefaultRate            string      `json:"DefaultRate"`
	DefaultScale           string      `json:"DefaultScale"`
	Deinterlacing          string      `json:"Deinterlacing"`
	Device                 string      `json:"Device"`
	Enabled                string      `json:"Enabled"`
	EncoderParameters      string      `json:"EncoderParameters"`
	EventPrefix            string      `json:"EventPrefix"`
	Exif                   bool        `json:"Exif"`
	FPSReportInterval      string      `json:"FPSReportInterval"`
	Format                 string      `json:"Format"`
	FrameSkip              string      `json:"FrameSkip"`
	Function               string      `json:"Function"`
	Height                 string      `json:"Height"`
	Host                   interface{} `json:"Host"`
	HourEventDiskSpace     string      `json:"HourEventDiskSpace"`
	HourEvents             string      `json:"HourEvents"`
	Hue                    string      `json:"Hue"`
	ID                     string      `json:"Id"`
	ImageBufferCount       string      `json:"ImageBufferCount"`
	LabelFormat            string      `json:"LabelFormat"`
	LabelSize              string      `json:"LabelSize"`
	LabelX                 string      `json:"LabelX"`
	LabelY                 string      `json:"LabelY"`
	LinkedMonitors         string      `json:"LinkedMonitors"`
	MaxFPS                 interface{} `json:"MaxFPS"`
	Method                 string      `json:"Method"`
	MinSectionLength       string      `json:"MinSectionLength"`
	MonthEventDiskSpace    string      `json:"MonthEventDiskSpace"`
	MonthEvents            string      `json:"MonthEvents"`
	MotionFrameSkip        string      `json:"MotionFrameSkip"`
	Name                   string      `json:"Name"`
	Notes                  string      `json:"Notes"`
	Options                interface{} `json:"Options"`
	Orientation            string      `json:"Orientation"`
	OutputCodec            interface{} `json:"OutputCodec"`
	OutputContainer        interface{} `json:"OutputContainer"`
	Palette                string      `json:"Palette"`
	Pass                   interface{} `json:"Pass"`
	Path                   string      `json:"Path"`
	Port                   string      `json:"Port"`
	PostEventCount         string      `json:"PostEventCount"`
	PreEventCount          string      `json:"PreEventCount"`
	Protocol               interface{} `json:"Protocol"`
	RTSPDescribe           bool        `json:"RTSPDescribe"`
	RecordAudio            string      `json:"RecordAudio"`
	RefBlendPerc           string      `json:"RefBlendPerc"`
	Refresh                interface{} `json:"Refresh"`
	ReturnDelay            interface{} `json:"ReturnDelay"`
	ReturnLocation         string      `json:"ReturnLocation"`
	SaveJPEGs              string      `json:"SaveJPEGs"`
	SectionLength          string      `json:"SectionLength"`
	Sequence               string      `json:"Sequence"`
	ServerID               string      `json:"ServerId"`
	SignalCheckColour      string      `json:"SignalCheckColour"`
	SignalCheckPoints      string      `json:"SignalCheckPoints"`
	StorageID              string      `json:"StorageId"`
	StreamReplayBuffer     string      `json:"StreamReplayBuffer"`
	SubPath                string      `json:"SubPath"`
	TotalEventDiskSpace    string      `json:"TotalEventDiskSpace"`
	TotalEvents            string      `json:"TotalEvents"`
	TrackDelay             interface{} `json:"TrackDelay"`
	TrackMotion            string      `json:"TrackMotion"`
	Triggers               string      `json:"Triggers"`
	Type                   string      `json:"Type"`
	User                   interface{} `json:"User"`
	V4LCapturesPerFrame    string      `json:"V4LCapturesPerFrame"`
	V4LMultiBuffer         interface{} `json:"V4LMultiBuffer"`
	VideoWriter            string      `json:"VideoWriter"`
	WarmupCount            string      `json:"WarmupCount"`
	WebColour              string      `json:"WebColour"`
	WeekEventDiskSpace     string      `json:"WeekEventDiskSpace"`
	WeekEvents             string      `json:"WeekEvents"`
	Width                  string      `json:"Width"`
	ZoneCount              string      `json:"ZoneCount"`
}

func (MonitorDetails) ParseAlertFrameCount

func (s MonitorDetails) ParseAlertFrameCount() (int, error)

type MonitorEvent

type MonitorEvent struct {
	AlarmFrames        string `json:"AlarmFrames"`
	Archived           string `json:"Archived"`
	AvgScore           string `json:"AvgScore"`
	Cause              string `json:"Cause"`
	DefaultVideo       string `json:"DefaultVideo"`
	DiskSpace          string `json:"DiskSpace"`
	Emailed            string `json:"Emailed"`
	EndTime            string `json:"EndTime"`
	Executed           string `json:"Executed"`
	FileSystemPath     string `json:"FileSystemPath"`
	Frames             string `json:"Frames"`
	Height             string `json:"Height"`
	ID                 string `json:"Id"`
	Length             string `json:"Length"`
	Locked             bool   `json:"Locked"`
	MaxScore           string `json:"MaxScore"`
	MaxScoreFrameID    string `json:"MaxScoreFrameId"`
	Messaged           string `json:"Messaged"`
	MonitorID          string `json:"MonitorId"`
	Name               string `json:"Name"`
	Notes              string `json:"Notes"`
	Orientation        string `json:"Orientation"`
	SaveJPEGs          string `json:"SaveJPEGs"`
	Scheme             string `json:"Scheme"`
	SecondaryStorageID string `json:"SecondaryStorageId"`
	StartTime          string `json:"StartTime"`
	StateID            string `json:"StateId"`
	StorageID          string `json:"StorageId"`
	TotScore           string `json:"TotScore"`
	Uploaded           string `json:"Uploaded"`
	Videoed            string `json:"Videoed"`
	Width              string `json:"Width"`
}

func (MonitorEvent) ParseAlertFrames

func (s MonitorEvent) ParseAlertFrames() (int, error)

func (MonitorEvent) ParseEndTime

func (s MonitorEvent) ParseEndTime() (time.Time, error)

func (MonitorEvent) ParseStartTime

func (s MonitorEvent) ParseStartTime() (time.Time, error)

func (MonitorEvent) String

func (s MonitorEvent) String() string

type MonitorList

type MonitorList []Monitor

type MonitorStatus

type MonitorStatus struct {
	AnalysisFPS      string `json:"AnalysisFPS"`
	CaptureBandwidth string `json:"CaptureBandwidth"`
	CaptureFPS       string `json:"CaptureFPS"`
	MonitorID        string `json:"MonitorId"`
	State            string `json:"Status"`
}

type PaginationDetails

type PaginationDetails struct {
	Count      int64                  `json:"count"`
	Current    int64                  `json:"current"`
	Limit      int64                  `json:"limit"`
	NextPage   bool                   `json:"nextPage"`
	Options    map[string]interface{} `json:"options"`
	Order      map[string]string      `json:"order"`
	Page       int64                  `json:"page"`
	PageCount  int64                  `json:"pageCount"`
	ParamType  string                 `json:"paramType"`
	PrevPage   bool                   `json:"prevPage"`
	QueryScope interface{}            `json:"queryScope"`
}

type Version

type Version struct {
	APIVersion     string `json:"apiversion"`
	ServiceVersion string `json:"version"`
}

Jump to

Keyboard shortcuts

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