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 include_num_members support to conversation.info request #989

Merged
merged 7 commits into from Dec 16, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 7 additions & 6 deletions conversation.go
Expand Up @@ -358,16 +358,17 @@ func (api *Client) CreateConversationContext(ctx context.Context, channelName st
}

// GetConversationInfo retrieves information about a conversation
func (api *Client) GetConversationInfo(channelID string, includeLocale bool) (*Channel, error) {
return api.GetConversationInfoContext(context.Background(), channelID, includeLocale)
func (api *Client) GetConversationInfo(channelID string, includeLocale, includeNumMembers bool) (*Channel, error) {
kanata2 marked this conversation as resolved.
Show resolved Hide resolved
return api.GetConversationInfoContext(context.Background(), channelID, includeLocale, includeNumMembers)
}

// GetConversationInfoContext retrieves information about a conversation with a custom context
func (api *Client) GetConversationInfoContext(ctx context.Context, channelID string, includeLocale bool) (*Channel, error) {
func (api *Client) GetConversationInfoContext(ctx context.Context, channelID string, includeLocale, includeNumMembers bool) (*Channel, error) {
values := url.Values{
"token": {api.token},
"channel": {channelID},
"include_locale": {strconv.FormatBool(includeLocale)},
"token": {api.token},
"channel": {channelID},
"include_locale": {strconv.FormatBool(includeLocale)},
"include_num_members": {strconv.FormatBool(includeNumMembers)},
}
response, err := api.channelRequest(ctx, "conversations.info", values)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion conversation_test.go
Expand Up @@ -400,7 +400,7 @@ func TestGetConversationInfo(t *testing.T) {
http.HandleFunc("/conversations.info", okChannelJsonHandler)
once.Do(startServer)
api := New("testing-token", OptionAPIURL("http://"+serverAddr+"/"))
channel, err := api.GetConversationInfo("CXXXXXXXX", false)
channel, err := api.GetConversationInfo("CXXXXXXXX", false, false)
if err != nil {
t.Errorf("Unexpected error: %s", err)
return
Expand Down