github.com/amimof/huego@v1.2.1/rule.go (about)

     1  package huego
     2  
     3  // Rule represents a bridge rule https://developers.meethue.com/documentation/rules-api
     4  type Rule struct {
     5  	Name           string        `json:"name,omitempty"`
     6  	LastTriggered  string        `json:"lasttriggered,omitempty"`
     7  	CreationTime   string        `json:"creationtime,omitempty"`
     8  	TimesTriggered int           `json:"timestriggered,omitempty"`
     9  	Owner          string        `json:"owner,omitempty"`
    10  	Status         string        `json:"status,omitempty"`
    11  	Conditions     []*Condition  `json:"conditions,omitempty"`
    12  	Actions        []*RuleAction `json:"actions,omitempty"`
    13  	ID             int           `json:",omitempty"`
    14  }
    15  
    16  // Condition defines the condition of a rule
    17  type Condition struct {
    18  	Address  string `json:"address,omitempty"`
    19  	Operator string `json:"operator,omitempty"`
    20  	Value    string `json:"value,omitempty"`
    21  }
    22  
    23  // RuleAction defines the rule to execute when a rule triggers
    24  type RuleAction struct {
    25  	Address string      `json:"address,omitempty"`
    26  	Method  string      `json:"method,omitempty"`
    27  	Body    interface{} `json:"body,omitempty"`
    28  }