Skip to content

Commit

Permalink
add testcase for basic properties only in chat_go.test, add includeAl…
Browse files Browse the repository at this point in the history
…lMetadata flag to conversationHistory
  • Loading branch information
h3rby7 committed Jun 29, 2022
1 parent 33c3a9e commit b31335c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
8 changes: 8 additions & 0 deletions chat_test.go
Expand Up @@ -82,6 +82,14 @@ func TestPostMessage(t *testing.T) {
blockStr := `[{"type":"context","block_id":"context","elements":[{"type":"plain_text","text":"hello"}]}]`

tests := map[string]messageTest{
"OnlyBasicProperties": {
endpoint: "/chat.postMessage",
opt: []MsgOption{},
expected: url.Values{
"channel": []string{"CXXX"},
"token": []string{"testing-token"},
},
},
"Blocks": {
endpoint: "/chat.postMessage",
opt: []MsgOption{
Expand Down
18 changes: 12 additions & 6 deletions conversation.go
Expand Up @@ -571,12 +571,13 @@ func (api *Client) JoinConversationContext(ctx context.Context, channelID string
}

type GetConversationHistoryParameters struct {
ChannelID string
Cursor string
Inclusive bool
Latest string
Limit int
Oldest string
ChannelID string
Cursor string
Inclusive bool
Latest string
Limit int
Oldest string
IncludeAllMetadata bool
}

type GetConversationHistoryResponse struct {
Expand Down Expand Up @@ -615,6 +616,11 @@ func (api *Client) GetConversationHistoryContext(ctx context.Context, params *Ge
if params.Oldest != "" {
values.Add("oldest", params.Oldest)
}
if params.IncludeAllMetadata {
values.Add("include_all_metadata", "1")
} else {
values.Add("include_all_metadata", "0")
}

response := GetConversationHistoryResponse{}

Expand Down
2 changes: 1 addition & 1 deletion messages.go
Expand Up @@ -129,7 +129,7 @@ type Msg struct {
ReplaceOriginal bool `json:"replace_original"`
DeleteOriginal bool `json:"delete_original"`

// Block type Message
// metadata
Metadata SlackMetadata `json:"metadata,omitempty"`

// Block type Message
Expand Down

0 comments on commit b31335c

Please sign in to comment.