diff --git a/types.go b/types.go index 15aaab23a2d4c47a9cc7f77fc880eea01d28321a..e2212c87d6faa5de822bda9b02cfa0db1b67bd3b 100644 --- a/types.go +++ b/types.go @@ -378,6 +378,7 @@ const ( const ( ResourceTypeEmail = "email" ResourceTypeMailingList = "list" + ResourceTypeNewsletter = "newsletter" ResourceTypeWebsite = "web" ResourceTypeDomain = "domain" ResourceTypeDAV = "dav" @@ -395,7 +396,7 @@ const ( // Returns true if the given status is valid for the given resource type. func isValidStatusByResourceType(rtype, rstatus string) bool { switch rtype { - case ResourceTypeEmail, ResourceTypeMailingList: + case ResourceTypeEmail, ResourceTypeMailingList, ResourceTypeNewsletter: switch rstatus { case ResourceStatusActive, ResourceStatusInactive, ResourceStatusReadonly: return true @@ -478,11 +479,12 @@ type Resource struct { // Details about the specific type (only one of these can be // set, depending on the value of 'type'). - Email *Email `json:"email,omitempty"` - List *MailingList `json:"list,omitempty"` - Website *Website `json:"website,omitempty"` - DAV *WebDAV `json:"dav,omitempty"` - Database *Database `json:"database,omitempty"` + Email *Email `json:"email,omitempty"` + List *MailingList `json:"list,omitempty"` + Newsletter *Newsletter `json:"newsletter,omitempty"` + Website *Website `json:"website,omitempty"` + DAV *WebDAV `json:"dav,omitempty"` + Database *Database `json:"database,omitempty"` } // Copy the resource (makes a deep copy). @@ -498,6 +500,9 @@ func (r *Resource) Copy() *Resource { case r.List != nil: l := *r.List rr.List = &l + case r.Newsletter != nil: + l := *r.Newsletter + rr.Newsletter = &l case r.DAV != nil: d := *r.DAV rr.DAV = &d @@ -537,6 +542,13 @@ type MailingList struct { Public bool `json:"public"` } +// Newsletter resource attributes. +type Newsletter struct { + Admins []string `json:"admins"` + Public bool `json:"public"` +} + + // WebDAV represents a hosting account. type WebDAV struct { UID int `json:"uid"`