From 5d7c3a76af85a857a6bb0bff5bac5282c0a9908f Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Tue, 25 Sep 2018 17:55:20 +0200 Subject: bug: add the optional field AvatarUrl to Person --- bug/person.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'bug/person.go') diff --git a/bug/person.go b/bug/person.go index ff4d4a70..c79e9935 100644 --- a/bug/person.go +++ b/bug/person.go @@ -10,8 +10,9 @@ import ( ) type Person struct { - Name string `json:"name"` - Email string `json:"email"` + Name string `json:"name"` + Email string `json:"email"` + AvatarUrl string `json:"avatar_url"` } // GetUser will query the repository for user detail and build the corresponding Person @@ -61,6 +62,10 @@ func (p Person) Validate() error { return fmt.Errorf("email is not fully printable") } + if p.AvatarUrl != "" && !text.ValidUrl(p.AvatarUrl) { + return fmt.Errorf("avatarUrl is not a valid URL") + } + return nil } -- cgit