Skip to content
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
32 changes: 32 additions & 0 deletions src/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<UpdateChannelAPIResponse>} 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<UpdateChannelAPIResponse>} 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
*
Expand Down
2 changes: 2 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -2425,6 +2426,7 @@ export type ChannelData = CustomChannelData &
members: string[] | Array<NewMemberPayload>;
blocklist_behavior: AutomodBehavior;
automod: Automod;
filter_tags: string[];
}>;

export type ChannelMute = {
Expand Down
10 changes: 10 additions & 0 deletions test/typescript/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ const executables = [
imports: ['Channel', 'Unpacked'],
type: "Unpacked<ReturnType<Channel<{ attachmentType: {}; channelType: { description?: string; }; commandType: string & {}; eventType: {}; messageType: {}; reactionType: {}; userType: {}; pollType: {}; pollOptionType: {}; }>['addMembers']>>",
},
{
f: rg.addFilterTags,
imports: ['Channel', 'Unpacked'],
type: "Unpacked<ReturnType<Channel<{ attachmentType: {}; channelType: { description?: string; }; commandType: string & {}; eventType: {}; messageType: {}; reactionType: {}; userType: {}; pollType: {}; pollOptionType: {}; }>['addFilterTags']>>",
},
{
f: rg.addModerators,
imports: ['Channel', 'Unpacked'],
Expand Down Expand Up @@ -333,6 +338,11 @@ const executables = [
imports: ['Channel', 'Unpacked'],
type: "Unpacked<ReturnType<Channel<{ attachmentType: {}; channelType: { description?: string; }; commandType: string & {}; eventType: {}; messageType: {}; reactionType: {}; userType: {}; pollType: {}; pollOptionType: {}; }>['removeMembers']>>",
},
{
f: rg.removeFilterTags,
imports: ['Channel', 'Unpacked'],
type: "Unpacked<ReturnType<Channel<{ attachmentType: {}; channelType: { description?: string; }; commandType: string & {}; eventType: {}; messageType: {}; reactionType: {}; userType: {}; pollType: {}; pollOptionType: {}; }>['removeFilterTags']>>",
},
{
f: rg.removeShadowBan,
imports: ['StreamChat', 'DefaultGenerics', 'Unpacked'],
Expand Down
16 changes: 16 additions & 0 deletions test/typescript/response-generators/channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down Expand Up @@ -243,6 +257,7 @@ async function watch() {
module.exports = {
acceptInvite,
addMembers,
addFilterTags,
addModerators,
create,
deleteChannel,
Expand All @@ -260,6 +275,7 @@ module.exports = {
queryMembers,
rejectInvite,
removeMembers,
removeFilterTags,
sendFile,
sendImage,
show,
Expand Down