diff --git a/lib/stream-chat/channel.rb b/lib/stream-chat/channel.rb index 19b2ec1..6fe2eb6 100644 --- a/lib/stream-chat/channel.rb +++ b/lib/stream-chat/channel.rb @@ -267,6 +267,18 @@ def add_moderators(user_ids) update(nil, nil, add_moderators: user_ids) end + # Adds filter tags to the channel. + sig { params(tags: T::Array[String]).returns(StreamChat::StreamResponse) } + def add_filter_tags(tags) + update(nil, nil, add_filter_tags: tags) + end + + # Removes filter tags from the channel. + sig { params(tags: T::Array[String]).returns(StreamChat::StreamResponse) } + def remove_filter_tags(tags) + update(nil, nil, remove_filter_tags: tags) + end + # Removes members from the channel. sig { params(user_ids: T::Array[String]).returns(StreamChat::StreamResponse) } def remove_members(user_ids) diff --git a/spec/channel_spec.rb b/spec/channel_spec.rb index 1215c1c..fcf751d 100644 --- a/spec/channel_spec.rb +++ b/spec/channel_spec.rb @@ -502,4 +502,20 @@ def loop_times(times) # Verify it's deleted expect { @channel.get_draft(@random_user[:id], parent_id: parent_id) }.to raise_error(StreamChat::StreamAPIException) end + + it 'can add and remove filter tags' do + tags = %w[urgent bug] + # Add tags + response = @channel.add_filter_tags(tags) + expect(response).to include 'channel' + + # Ensure tags are set + response = @channel.query + expect(response['channel']['filter_tags']).to match_array(tags) + + # Remove one tag + @channel.remove_filter_tags(['urgent']) + response = @channel.query + expect(response['channel']['filter_tags']).to match_array(['bug']) + end end