api

package
v0.0.0-...-1ca8fc8 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterHandlers

func RegisterHandlers(ctx context.Context, router *chi.Mux, policies io.Reader, svc devicemanagement.DeviceManagement, alarmSvc alarms.AlarmService) (*chi.Mux, error)

Types

type ApiResponse

type ApiResponse struct {
	Meta  *meta  `json:"meta,omitempty"`
	Data  any    `json:"data"`
	Links *links `json:"links,omitempty"`
}

func (ApiResponse) Byte

func (r ApiResponse) Byte() []byte

type GeoJSONFeature

type GeoJSONFeature struct {
	ID         string         `json:"id"`
	Type       string         `json:"type"`
	Geometry   any            `json:"geometry"`
	Properties map[string]any `json:"properties"`
}

func ConvertDevice

func ConvertDevice(d types.Device) (*GeoJSONFeature, error)

type GeoJSONFeatureCollection

type GeoJSONFeatureCollection struct {
	Type     string           `json:"type"`
	Features []GeoJSONFeature `json:"features"`
	Meta     *meta            `json:"meta,omitempty"`
	Links    *links           `json:"links,omitempty"`
}

func NewFeatureCollection

func NewFeatureCollection() *GeoJSONFeatureCollection

func NewFeatureCollectionWithDevices

func NewFeatureCollectionWithDevices(devices []types.Device) (*GeoJSONFeatureCollection, error)

type GeoJSONGeometry

type GeoJSONGeometry interface {
	GeoPropertyType() string
	GeoPropertyValue() GeoJSONGeometry
	GetAsPoint() GeoJSONPropertyPoint
}

type GeoJSONProperty

type GeoJSONProperty struct {
	PropertyImpl
	Val GeoJSONGeometry `json:"value"`
}

GeoJSONProperty is used to encapsulate different GeoJSONGeometry types

func CreateGeoJSONPropertyFromLineString

func CreateGeoJSONPropertyFromLineString(coordinates [][]float64) *GeoJSONProperty

CreateGeoJSONPropertyFromLineString creates a GeoJSONProperty from an array of line coordinate arrays

func CreateGeoJSONPropertyFromMultiPolygon

func CreateGeoJSONPropertyFromMultiPolygon(coordinates [][][][]float64) *GeoJSONProperty

CreateGeoJSONPropertyFromMultiPolygon creates a GeoJSONProperty from an array of polygon coordinate arrays

func CreateGeoJSONPropertyFromWGS84

func CreateGeoJSONPropertyFromWGS84(longitude, latitude float64) *GeoJSONProperty

CreateGeoJSONPropertyFromWGS84 creates a GeoJSONProperty from a WGS84 coordinate

func (*GeoJSONProperty) GeoPropertyType

func (gjp *GeoJSONProperty) GeoPropertyType() string

func (*GeoJSONProperty) GeoPropertyValue

func (gjp *GeoJSONProperty) GeoPropertyValue() GeoJSONGeometry

func (*GeoJSONProperty) GetAsPoint

func (gjp *GeoJSONProperty) GetAsPoint() GeoJSONPropertyPoint

func (*GeoJSONProperty) Type

func (gjp *GeoJSONProperty) Type() string

func (*GeoJSONProperty) Value

func (gjp *GeoJSONProperty) Value() any

type GeoJSONPropertyLineString

type GeoJSONPropertyLineString struct {
	Type        string      `json:"type"`
	Coordinates [][]float64 `json:"coordinates"`
}

GeoJSONPropertyLineString is used as the value object for a GeoJSONPropertyLineString

func (*GeoJSONPropertyLineString) GeoPropertyType

func (gjpls *GeoJSONPropertyLineString) GeoPropertyType() string

func (*GeoJSONPropertyLineString) GeoPropertyValue

func (gjpls *GeoJSONPropertyLineString) GeoPropertyValue() GeoJSONGeometry

func (*GeoJSONPropertyLineString) GetAsPoint

func (gjpls *GeoJSONPropertyLineString) GetAsPoint() GeoJSONPropertyPoint

type GeoJSONPropertyMultiPolygon

type GeoJSONPropertyMultiPolygon struct {
	Type        string          `json:"type"`
	Coordinates [][][][]float64 `json:"coordinates"`
}

GeoJSONPropertyMultiPolygon is used as the value object for a GeoJSONPropertyMultiPolygon

func (*GeoJSONPropertyMultiPolygon) GeoPropertyType

func (gjpmp *GeoJSONPropertyMultiPolygon) GeoPropertyType() string

func (*GeoJSONPropertyMultiPolygon) GeoPropertyValue

func (gjpmp *GeoJSONPropertyMultiPolygon) GeoPropertyValue() GeoJSONGeometry

func (*GeoJSONPropertyMultiPolygon) GetAsPoint

type GeoJSONPropertyPoint

type GeoJSONPropertyPoint struct {
	Type        string     `json:"type"`
	Coordinates [2]float64 `json:"coordinates"`
}

GeoJSONPropertyPoint is used as the value object for a GeoJSONPropertyPoint

func (*GeoJSONPropertyPoint) GeoPropertyType

func (gjpp *GeoJSONPropertyPoint) GeoPropertyType() string

func (*GeoJSONPropertyPoint) GeoPropertyValue

func (gjpp *GeoJSONPropertyPoint) GeoPropertyValue() GeoJSONGeometry

func (*GeoJSONPropertyPoint) GetAsPoint

func (gjpp *GeoJSONPropertyPoint) GetAsPoint() GeoJSONPropertyPoint

func (GeoJSONPropertyPoint) Latitude

func (gjpp GeoJSONPropertyPoint) Latitude() float64

func (GeoJSONPropertyPoint) Longitude

func (gjpp GeoJSONPropertyPoint) Longitude() float64

type PropertyImpl

type PropertyImpl struct {
	Type string `json:"type"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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