diff --git a/src/channel.ts b/src/channel.ts index 20a87c4fe..76cb7265e 100644 --- a/src/channel.ts +++ b/src/channel.ts @@ -775,6 +775,38 @@ export class Channel { return await this._update({ add_members: members, message, ...options }); } + /** + * addFilterTags - add filter tags to the channel + * + * @param {string[]} tags An array of tags to add to the channel + * @param {Message} [message] Optional message object for channel members notification + * @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating + * @return {Promise} The server response + */ + async addFilterTags( + tags: string[], + message?: Message, + options: ChannelUpdateOptions = {}, + ) { + return await this._update({ add_filter_tags: tags, message, ...options }); + } + + /** + * removeFilterTags - remove filter tags from the channel + * + * @param {string[]} tags An array of tags to remove from the channel + * @param {Message} [message] Optional message object for channel members notification + * @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating + * @return {Promise} The server response + */ + async removeFilterTags( + tags: string[], + message?: Message, + options: ChannelUpdateOptions = {}, + ) { + return await this._update({ remove_filter_tags: tags, message, ...options }); + } + /** * addModerators - add moderators to the channel * diff --git a/src/types.ts b/src/types.ts index 76a58000f..a999bea76 100644 --- a/src/types.ts +++ b/src/types.ts @@ -282,6 +282,7 @@ export type ChannelResponse = CustomChannelData & { created_by?: UserResponse | null; created_by_id?: string; deleted_at?: string; + filter_tags?: string[]; hidden?: boolean; invites?: string[]; joined?: boolean; @@ -2425,6 +2426,7 @@ export type ChannelData = CustomChannelData & members: string[] | Array; blocklist_behavior: AutomodBehavior; automod: Automod; + filter_tags: string[]; }>; export type ChannelMute = { diff --git a/test/typescript/index.js b/test/typescript/index.js index 683d78f3f..fa6d4cfbd 100644 --- a/test/typescript/index.js +++ b/test/typescript/index.js @@ -22,6 +22,11 @@ const executables = [ imports: ['Channel', 'Unpacked'], type: "Unpacked['addMembers']>>", }, + { + f: rg.addFilterTags, + imports: ['Channel', 'Unpacked'], + type: "Unpacked['addFilterTags']>>", + }, { f: rg.addModerators, imports: ['Channel', 'Unpacked'], @@ -333,6 +338,11 @@ const executables = [ imports: ['Channel', 'Unpacked'], type: "Unpacked['removeMembers']>>", }, + { + f: rg.removeFilterTags, + imports: ['Channel', 'Unpacked'], + type: "Unpacked['removeFilterTags']>>", + }, { f: rg.removeShadowBan, imports: ['StreamChat', 'DefaultGenerics', 'Unpacked'], diff --git a/test/typescript/response-generators/channel.js b/test/typescript/response-generators/channel.js index 0153e89c2..9683c856c 100644 --- a/test/typescript/response-generators/channel.js +++ b/test/typescript/response-generators/channel.js @@ -27,6 +27,20 @@ async function addMembers() { return await channel.addMembers(newMembers); } +async function addFilterTags() { + const channel = await utils.createTestChannelForUser(uuidv4(), johnID); + await channel.watch(); + + return await channel.addFilterTags(['tag1', 'tag2']); +} + +async function removeFilterTags() { + const channel = await utils.createTestChannelForUser(uuidv4(), johnID); + await channel.watch(); + + return await channel.removeFilterTags(['tag1']); +} + async function addModerators() { const channel = await utils.createTestChannel(uuidv4(), johnID); return await channel.addModerators([johnID]); @@ -243,6 +257,7 @@ async function watch() { module.exports = { acceptInvite, addMembers, + addFilterTags, addModerators, create, deleteChannel, @@ -260,6 +275,7 @@ module.exports = { queryMembers, rejectInvite, removeMembers, + removeFilterTags, sendFile, sendImage, show,