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

Add ScheduledMessage type #753

Merged
merged 1 commit into from
Oct 2, 2020
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -722,12 +722,12 @@ type GetScheduledMessagesParameters struct {
}

// GetScheduledMessages returns the list of scheduled messages based on params
func (api *Client) GetScheduledMessages(params *GetScheduledMessagesParameters) (channels []Message, nextCursor string, err error) {
func (api *Client) GetScheduledMessages(params *GetScheduledMessagesParameters) (channels []ScheduledMessage, nextCursor string, err error) {
return api.GetScheduledMessagesContext(context.Background(), params)
}

// GetScheduledMessagesContext returns the list of scheduled messages in a Slack team with a custom context
func (api *Client) GetScheduledMessagesContext(ctx context.Context, params *GetScheduledMessagesParameters) (channels []Message, nextCursor string, err error) {
func (api *Client) GetScheduledMessagesContext(ctx context.Context, params *GetScheduledMessagesParameters) (channels []ScheduledMessage, nextCursor string, err error) {
values := url.Values{
"token": {api.token},
}
Expand All @@ -747,8 +747,8 @@ func (api *Client) GetScheduledMessagesContext(ctx context.Context, params *GetS
values.Add("oldest", params.Oldest)
}
response := struct {
Messages []Message `json:"scheduled_messages"`
ResponseMetaData responseMetaData `json:"response_metadata"`
Messages []ScheduledMessage `json:"scheduled_messages"`
ResponseMetaData responseMetaData `json:"response_metadata"`
SlackResponse
}{}

Expand Down
9 changes: 9 additions & 0 deletions messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,15 @@ const (
ResponseTypeEphemeral = "ephemeral"
)

// ScheduledMessage contains information about a slack scheduled message
type ScheduledMessage struct {
ID string `json:"id"`
Channel string `json:"channel_id"`
PostAt int `json:"post_at"`
DateCreated int `json:"date_created"`
Text string `json:"text"`
}

// Icon is used for bot messages
type Icon struct {
IconURL string `json:"icon_url,omitempty"`
Expand Down