Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
wangxufire committed Jun 7, 2017
2 parents be925cb + 6def807 commit 11bf4bb
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions directmessages.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ func (a TwitterApi) PostDMToUserId(text string, userId int64) (message DirectMes
return a.postDirectMessagesImpl(v)
}

// DeleteDirectMessage will destroy (delete) the direct message with the specified ID.
// https://dev.twitter.com/rest/reference/post/direct_messages/destroy
func (a TwitterApi) DeleteDirectMessage(id int64, includeEntities bool) (message DirectMessage, err error) {
v := url.Values{}
v.Set("id", strconv.FormatInt(id, 10))
v.Set("include_entities", strconv.FormatBool(includeEntities))
response_ch := make(chan response)
a.queryQueue <- query{a.baseUrl + "/direct_messages/destroy.json", v, &message, _POST, response_ch}
return message, (<-response_ch).err
}

func (a TwitterApi) postDirectMessagesImpl(v url.Values) (message DirectMessage, err error) {
response_ch := make(chan response)
a.queryQueue <- query{a.baseUrl + "/direct_messages/new.json", v, &message, _POST, response_ch}
Expand Down

0 comments on commit 11bf4bb

Please sign in to comment.