Skip to content

Commit ab55fc6

Browse files
grv87jomei
authored andcommitted
Add button property support into property_config
1 parent 12c1355 commit ab55fc6

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

const.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const (
3434
PropertyConfigStatus PropertyConfigType = "status"
3535
PropertyConfigUniqueID PropertyConfigType = "unique_id"
3636
PropertyConfigVerification PropertyConfigType = "verification"
37+
PropertyConfigButton PropertyConfigType = "button"
3738
)
3839

3940
const (

property_config.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,20 @@ func (p VerificationPropertyConfig) GetID() PropertyID {
380380
return p.ID
381381
}
382382

383+
type ButtonPropertyConfig struct {
384+
ID PropertyID `json:"id"`
385+
Type PropertyConfigType `json:"type"`
386+
Button struct{} `json:"button"`
387+
}
388+
389+
func (p ButtonPropertyConfig) GetType() PropertyConfigType {
390+
return p.Type
391+
}
392+
393+
func (p ButtonPropertyConfig) GetID() PropertyID {
394+
return p.ID
395+
}
396+
383397
type PropertyConfigs map[string]PropertyConfig
384398

385399
func (p *PropertyConfigs) UnmarshalJSON(data []byte) error {
@@ -447,6 +461,8 @@ func parsePropertyConfigs(raw map[string]interface{}) (PropertyConfigs, error) {
447461
p = &UniqueIDPropertyConfig{}
448462
case PropertyConfigVerification:
449463
p = &VerificationPropertyConfig{}
464+
case PropertyConfigButton:
465+
p = &ButtonPropertyConfig{}
450466
default:
451467

452468
return nil, fmt.Errorf("unsupported property type: %s", rawProperty["type"].(string))

0 commit comments

Comments
 (0)