diff --git a/.gitignore b/.gitignore index 44c53ad..01c121c 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ *.dll *.so *.dylib +.idea # Test binary, built with `go test -c` *.test diff --git a/const.go b/const.go index 83ba6e1..15137a6 100644 --- a/const.go +++ b/const.go @@ -60,6 +60,7 @@ const ( PropertyTypeStatus PropertyType = "status" PropertyTypeUniqueID PropertyType = "unique_id" PropertyTypeVerification PropertyType = "verification" + PropertyTypeButton PropertyType = "button" ) const ( diff --git a/object.go b/object.go index eb6f84b..4bf9578 100644 --- a/object.go +++ b/object.go @@ -212,3 +212,6 @@ type Verification struct { VerifiedBy *User `json:"verified_by,omitempty"` Date *DateObject `json:"date,omitempty"` } + +type Button struct { +} diff --git a/property.go b/property.go index 40ba426..88ded83 100644 --- a/property.go +++ b/property.go @@ -393,6 +393,20 @@ func (p VerificationProperty) GetType() PropertyType { return p.Type } +type ButtonProperty struct { + ID ObjectID `json:"id,omitempty"` + Type PropertyType `json:"type,omitempty"` + Button Button `json:"button"` +} + +func (p ButtonProperty) GetID() string { + return p.ID.String() +} + +func (p ButtonProperty) GetType() PropertyType { + return p.Type +} + type Properties map[string]Property func (p *Properties) UnmarshalJSON(data []byte) error { @@ -485,6 +499,8 @@ func decodeProperty(raw map[string]interface{}) (Property, error) { p = &UniqueIDProperty{} case PropertyTypeVerification: p = &VerificationProperty{} + case PropertyTypeButton: + p = &ButtonProperty{} default: return nil, fmt.Errorf("unsupported property type: %s", raw["type"].(string)) }