diff --git a/go.mod b/go.mod index 45f6b7f..345627b 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.22.8 require ( github.com/essentialkaos/check v1.4.1 - github.com/essentialkaos/ek/v13 v13.9.2 + github.com/essentialkaos/ek/v13 v13.10.0 ) require ( diff --git a/go.sum b/go.sum index 970a51c..581c987 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/essentialkaos/check v1.4.1 h1:SuxXzrbokPGTPWxGRnzy0hXvtb44mtVrdNxgPa1s4c8= github.com/essentialkaos/check v1.4.1/go.mod h1:xQOYwFvnxfVZyt5Qvjoa1SxcRqu5VyP77pgALr3iu+M= -github.com/essentialkaos/ek/v13 v13.9.2 h1:3sXGDUZ5C5+8tSmat1cTj6lhYIzCOlcaHC2ulShF2OQ= -github.com/essentialkaos/ek/v13 v13.9.2/go.mod h1:6G9EPJ/k4N0mugTLqPuWS/fb7K5JwoEqZSkNSfBCsgg= +github.com/essentialkaos/ek/v13 v13.10.0 h1:uoLNjiDRJ/bOPAciq8Ff92r+XHgTm+rBI4ItOtZje9k= +github.com/essentialkaos/ek/v13 v13.10.0/go.mod h1:6G9EPJ/k4N0mugTLqPuWS/fb7K5JwoEqZSkNSfBCsgg= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= diff --git a/pachca.go b/pachca.go index e25967f..1e39883 100644 --- a/pachca.go +++ b/pachca.go @@ -1541,6 +1541,11 @@ func (c *Client) AddThreadMessage(messageID uint64, message *MessageRequest) (*M return c.AddMessage(message) } +// AddThreadMessageText helper to create thread and add new message with given text to it +func (c *Client) AddThreadMessageText(messageID uint64, text string) (*Message, error) { + return c.AddThreadMessage(messageID, &MessageRequest{Content: text}) +} + // FILES //////////////////////////////////////////////////////////////////////////// // // UploadFile uploads new file and returns key of it @@ -1658,6 +1663,11 @@ func (p Properties) Names() []string { return result } +// IsSet returns true if property has a value +func (p *Property) IsSet() bool { + return p != nil && p.Value != "" +} + // IsText returns true if property has text type func (p *Property) IsText() bool { return p != nil && p.Type == PROP_TYPE_TEXT diff --git a/pachca_test.go b/pachca_test.go index 72e2b9c..9614465 100644 --- a/pachca_test.go +++ b/pachca_test.go @@ -326,6 +326,10 @@ func (s *PachcaSuite) TestPropertiesHelpers(c *C) { c.Assert(p.Find("test1"), NotNil) c.Assert(p.Has("test1"), Equals, true) + c.Assert(p.Get(6).IsSet(), Equals, false) + c.Assert(p.Get(10).IsSet(), Equals, false) + c.Assert(p.Get(1).IsSet(), Equals, true) + c.Assert(p.FindAny("abcd", "test100", "test"), IsNil) c.Assert(p.HasAny("abcd", "test100", "test"), Equals, false) c.Assert(p.FindAny("abcd", "test4", "test").Name, Equals, "test4")