Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change API for ChannelMessages to accept Message ID's as strings. Fixes #120 #127

Merged
merged 1 commit into from
Feb 20, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions restapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -794,19 +794,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