Skip to content

Commit a0317e5

Browse files
authored
Add support for hard deleting messages (#133)
fixes #132
1 parent 493ac13 commit a0317e5

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

message.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,13 +270,24 @@ func (c *Client) UpdateMessage(msg *Message, msgID string) (*Message, error) {
270270
}
271271

272272
func (c *Client) DeleteMessage(msgID string) error {
273+
return c.deleteMessage(msgID, false)
274+
}
275+
276+
func (c *Client) HardDeleteMessage(msgID string) error {
277+
return c.deleteMessage(msgID, true)
278+
}
279+
280+
func (c *Client) deleteMessage(msgID string, hard bool) error {
273281
if msgID == "" {
274282
return errors.New("message ID must be not empty")
275283
}
276-
277284
p := path.Join("messages", url.PathEscape(msgID))
278285

279-
return c.makeRequest(http.MethodDelete, p, nil, nil, nil)
286+
params := map[string][]string{}
287+
if hard {
288+
params["hard"] = []string{"true"}
289+
}
290+
return c.makeRequest(http.MethodDelete, p, params, nil, nil)
280291
}
281292

282293
type MessageFlag struct {

0 commit comments

Comments
 (0)