Skip to content

Commit

Permalink
Merge pull request #9 from essentialkaos/develop
Browse files Browse the repository at this point in the history
Version 0.2.0
  • Loading branch information
andyone authored Nov 1, 2024
2 parents f0bf15a + f77bb28 commit 55eabf0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -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=
Expand Down
10 changes: 10 additions & 0 deletions pachca.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions pachca_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 55eabf0

Please sign in to comment.