diff --git a/logo.go b/logo.go index 5c0fe63..949fbd5 100644 --- a/logo.go +++ b/logo.go @@ -1,15 +1,28 @@ package atomfeed -import "errors" +import ( + "errors" + "fmt" + + "github.com/google/uuid" +) type Logo struct { *CommonAttributes URI IRI `xml:"uri"` } +func NewLogo() *Logo { + return &Logo{URI: IRI(fmt.Sprint("urn:uuid:", uuid.New()))} +} + func (l *Logo) Check() error { if l.URI == "" { return errors.New("uri element of logo empty") + } else { + if !isValidIRI(l.URI) { + return fmt.Errorf("uri element %v of logo not correctly formatted", l.URI) + } } return nil