Skip to content

Commit

Permalink
huh
Browse files Browse the repository at this point in the history
  • Loading branch information
RealCodingTeam committed Jun 28, 2016
1 parent 5f6a972 commit 12a226f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ var (
EndpointChannelMessage = func(cID, mID string) string { return EndpointChannels + cID + "/messages/" + mID }
EndpointChannelMessageAck = func(cID, mID string) string { return EndpointChannels + cID + "/messages/" + mID + "/ack" }
EndpointChannelMessagesBulkDelete = func(cID string) string { return EndpointChannel(cID) + "/messages/bulk_delete" }
EndpointChannelMessagesPins = func(cID string) string { return EndpointChannel(cID) + "/pins" }
EndpointChannelMessagePin = func(cID, mID string) string { return EndpointChannel(cID) + "/pins/" + mID }

EndpointInvite = func(iID string) string { return EndpointAPI + "invite/" + iID }

Expand Down
33 changes: 33 additions & 0 deletions restapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,39 @@ func (s *Session) ChannelMessagesBulkDelete(channelID string, messages []string)
return
}

// ChannelMessagePin pins a message within a given channel.
// channelID: The ID of a channel.
// messageID: The ID of a message.
func (s *Session) ChannelMessagePin(channelID, messageID string) (err error) {

_, err = s.Request("PUT", EndpointChannelMessagePin(channelID, messageID), nil)
return
}

// ChannelMessageUnpin unpins a message within a given channel.
// channelID: The ID of a channel.
// messageID: The ID of a message.
func (s *Session) ChannelMessageUnpin(channelID, messageID string) (err error) {

_, err = s.Request("DELETE", EndpointChannelMessagePin(channelID, messageID), nil)
return
}

// ChannelMessagesPinned returns an array of Message structures for pinned messages
// within a given channel
// channelID : The ID of a Channel.
func (s *Session) ChannelMessagesPinned(channelID string) (st []*Message, err error) {

body, err := s.Request("GET", EndpointChannelMessagesPins(channelID), nil)

if err != nil {
return
}

err = unmarshal(body, &st)
return
}

// ChannelFileSend sends a file to the given channel.
// channelID : The ID of a Channel.
// io.Reader : A reader for the file contents.
Expand Down

0 comments on commit 12a226f

Please sign in to comment.