Skip to content

Commit

Permalink
Merge pull request #127 from iopred/docs
Browse files Browse the repository at this point in the history
BREAKING -- Change API for ChannelMessages to accept Message ID's as strings. Fixes #120
  • Loading branch information
bwmarrin committed Feb 20, 2016
2 parents c3cb846 + 50b7bdd commit f67b815
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions restapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -772,19 +772,19 @@ func (s *Session) ChannelTyping(channelID string) (err error) {
// limit : The number messages that can be returned.
// beforeID : If provided all messages returned will be before given ID.
// afterID : If provided all messages returned will be after given ID.
func (s *Session) ChannelMessages(channelID string, limit int, beforeID int, afterID int) (st []*Message, err error) {
func (s *Session) ChannelMessages(channelID string, limit int, beforeID, afterID string) (st []*Message, err error) {

uri := CHANNEL_MESSAGES(channelID)

v := url.Values{}
if limit > 0 {
v.Set("limit", strconv.Itoa(limit))
}
if afterID > 0 {
v.Set("after", strconv.Itoa(afterID))
if afterID != "" {
v.Set("after", afterID)
}
if beforeID > 0 {
v.Set("before", strconv.Itoa(beforeID))
if beforeID != "" {
v.Set("before", beforeID)
}
if len(v) > 0 {
uri = fmt.Sprintf("%s?%s", uri, v.Encode())
Expand Down

0 comments on commit f67b815

Please sign in to comment.