v2

package
v0.1.121 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: Apache-2.0 Imports: 7 Imported by: 5

Documentation

Index

Constants

View Source
const (
	ApiVersion = "v2"
	ApiBase    = "/api/v2"

	ApiEventRoute              = ApiBase + "/event"
	ApiAllEventRoute           = ApiEventRoute + "/" + All
	ApiEventIdRoute            = ApiEventRoute + "/" + Id + "/{" + Id + "}"
	ApiEventPushRoute          = ApiEventRoute + "/" + Pushed
	ApiEventCountRoute         = ApiEventRoute + "/" + Count
	ApiEventCountByDeviceRoute = ApiEventCountRoute + "/" + Device + "/{" + DeviceName + "}"
	ApiEventByDeviceNameRoute  = ApiEventRoute + "/" + Device + "/" + Name + "/{" + Name + "}"
	ApiEventByTimeRangeRoute   = ApiEventRoute + "/" + Start + "/{" + Start + "}/" + End + "/{" + End + "}"
	ApiEventByAgeRoute         = ApiEventRoute + "/" + Age + "/{" + Age + "}"
	ApiEventScrubRoute         = ApiEventRoute + "/" + Scrub

	ApiReadingRoute             = ApiBase + "/reading"
	ApiAllReadingRoute          = ApiReadingRoute + "/" + All
	ApiReadingCountRoute        = ApiReadingRoute + "/" + Count
	ApiReadingIdRoute           = ApiReadingRoute + "/" + Id + "/{" + Id + "}"
	ApiReadingByDeviceNameRoute = ApiReadingRoute + "/" + Device + "/" + Name + "/{" + Name + "}"
	ApiReadingByTypeRoute       = ApiReadingRoute + "/" + Type + "/{" + Type + "}"
	ApiReadingByTimeRangeRoute  = ApiReadingRoute + "/" + Start + "/{" + Start + "}/" + End + "/{" + End + "}"

	ApiDeviceProfileRoute                       = ApiBase + "/deviceprofile"
	ApiDeviceProfileUploadFileRoute             = ApiDeviceProfileRoute + "/uploadfile"
	ApiDeviceProfileByNameRoute                 = ApiDeviceProfileRoute + "/" + Name + "/{" + Name + "}"
	ApiDeviceProfileByIdRoute                   = ApiDeviceProfileRoute + "/" + Id + "/{" + Id + "}"
	ApiAllDeviceProfileRoute                    = ApiDeviceProfileRoute + "/" + All
	ApiDeviceProfileByManufacturerRoute         = ApiDeviceProfileRoute + "/" + Manufacturer + "/{" + Manufacturer + "}"
	ApiDeviceProfileByModelRoute                = ApiDeviceProfileRoute + "/" + Model + "/{" + Model + "}"
	ApiDeviceProfileByManufacturerAndModelRoute = ApiDeviceProfileRoute + "/" + Manufacturer + "/{" + Manufacturer + "}" + "/" + Model + "/{" + Model + "}"

	ApiDeviceServiceRoute       = ApiBase + "/deviceservice"
	ApiAllDeviceServiceRoute    = ApiDeviceServiceRoute + "/" + All
	ApiDeviceServiceByNameRoute = ApiDeviceServiceRoute + "/" + Name + "/{" + Name + "}"
	ApiDeviceServiceByIdRoute   = ApiDeviceServiceRoute + "/" + Id + "/{" + Id + "}"

	ApiDeviceRoute              = ApiBase + "/device"
	ApiAllDeviceRoute           = ApiDeviceRoute + "/" + All
	ApiDeviceIdExistsRoute      = ApiDeviceRoute + "/" + Check + "/" + Id + "/{" + Id + "}"
	ApiDeviceNameExistsRoute    = ApiDeviceRoute + "/" + Check + "/" + Name + "/{" + Name + "}"
	ApiDeviceByIdRoute          = ApiDeviceRoute + "/" + Id + "/{" + Id + "}"
	ApiDeviceByNameRoute        = ApiDeviceRoute + "/" + Name + "/{" + Name + "}"
	ApiDeviceByProfileIdRoute   = ApiDeviceRoute + "/" + Profile + "/" + Id + "/{" + Id + "}"
	ApiDeviceByProfileNameRoute = ApiDeviceRoute + "/" + Profile + "/" + Name + "/{" + Name + "}"
	ApiDeviceByServiceIdRoute   = ApiDeviceRoute + "/" + Service + "/" + Id + "/{" + Id + "}"
	ApiDeviceByServiceNameRoute = ApiDeviceRoute + "/" + Service + "/" + Name + "/{" + Name + "}"

	ApiConfigRoute  = ApiBase + "/config"
	ApiMetricsRoute = ApiBase + "/metrics"
	ApiPingRoute    = ApiBase + "/ping"
	ApiVersionRoute = ApiBase + "/version"
)

Constants related to defined routes in the v2 service APIs

View Source
const (
	All          = "all"
	Id           = "id"
	Created      = "created"
	Modified     = "modified"
	Pushed       = "pushed"
	Count        = "count"
	Device       = "device"
	DeviceId     = "deviceId"
	DeviceName   = "deviceName"
	Check        = "check"
	Profile      = "profile"
	Service      = "service"
	ProfileName  = "profileName"
	ServiceName  = "serviceName"
	Start        = "start"
	End          = "end"
	Age          = "age"
	Scrub        = "scrub"
	Type         = "type"
	Name         = "name"
	Label        = "label"
	Manufacturer = "manufacturer"
	Model        = "model"
	ValueType    = "valueType"
	Offset       = "offset" //query string to specify the number of items to skip before starting to collect the result set.
	Limit        = "limit"  //query string to specify the numbers of items to return
	Labels       = "labels" //query string to specify associated user-defined labels for querying a given object. More than one label may be specified via a comma-delimited list
)

Constants related to defined url path names and parameters in the v2 service APIs

View Source
const (
	DefaultOffset  = 0
	DefaultLimit   = 20
	CommaSeparator = ","
)

Constants related to the default value of query strings in the v2 service APIs

Variables

This section is empty.

Functions

func Validate

func Validate(a interface{}) error

Validate function will use the validator package to validate the struct annotation

func ValidateAutoEventFrequency added in v0.1.67

func ValidateAutoEventFrequency(fl validator.FieldLevel) bool

ValidateAutoEventFrequency validate AutoEvent's Frequency field which should follow the ISO 8601 Durations format

func ValidateDtoNoneEmptyString added in v0.1.112

func ValidateDtoNoneEmptyString(fl validator.FieldLevel) bool

ValidateDtoNoneEmptyString used to check the UpdateDTO name pointer value

func ValidateDtoUuid added in v0.1.112

func ValidateDtoUuid(fl validator.FieldLevel) bool

ValidateDtoUuid used to check the UpdateDTO uuid pointer value Currently, required_without can not correct work with other tag, so write custom tag instead. Issue can refer to https://github.com/go-playground/validator/issues/624

Types

This section is empty.

Directories

Path Synopsis
clients

Jump to

Keyboard shortcuts

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