From efa18bdbb9961ed00b52716ce8d2143428cc72a7 Mon Sep 17 00:00:00 2001 From: Rafael Marinho Date: Wed, 22 Oct 2025 12:29:03 +0200 Subject: [PATCH 1/4] feat(CHA-1391): support addMembers Batch --- src/channel.ts | 9 +++++++++ src/types.ts | 17 +++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/channel.ts b/src/channel.ts index 47be99ab1..670883325 100644 --- a/src/channel.ts +++ b/src/channel.ts @@ -71,6 +71,8 @@ import type { TruncateOptions, UpdateChannelAPIResponse, UpdateChannelOptions, + UpdateChannelsBatchRequest, + UpdateChannelsBatchResponse, UpdateLocationPayload, UserResponse, } from './types'; @@ -614,6 +616,13 @@ export class Channel { }); } + async batch_update(data: UpdateChannelsBatchRequest) { + return await this.getClient().put( + this.getClient().baseURL + '/channels/batch', + data, + ); + } + /** * updatePartial - partial update channel properties * diff --git a/src/types.ts b/src/types.ts index 2057543f5..6dcc56ea2 100644 --- a/src/types.ts +++ b/src/types.ts @@ -4446,3 +4446,20 @@ export type EventHook = { created_at?: string; updated_at?: string; }; + +export type UpdateChannelsBatchRequest = { + operation: string; + filter: UpdateChannelsBatchFilters; + members?: string[] | Array; + data?: Partial; +}; + +export type UpdateChannelsBatchFilters = { + cids?: string[]; + channel_types?: string[]; + tags?: Record; +}; + +export type UpdateChannelsBatchResponse = { + result: Record; +} & Partial; From 72008f826c9651df6dd20a0c7698151cc655852e Mon Sep 17 00:00:00 2001 From: Rafael Marinho Date: Wed, 22 Oct 2025 16:42:50 +0200 Subject: [PATCH 2/4] fix(cha-1391): fix to call from server --- src/channel.ts | 9 --------- src/client.ts | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/channel.ts b/src/channel.ts index 670883325..47be99ab1 100644 --- a/src/channel.ts +++ b/src/channel.ts @@ -71,8 +71,6 @@ import type { TruncateOptions, UpdateChannelAPIResponse, UpdateChannelOptions, - UpdateChannelsBatchRequest, - UpdateChannelsBatchResponse, UpdateLocationPayload, UserResponse, } from './types'; @@ -616,13 +614,6 @@ export class Channel { }); } - async batch_update(data: UpdateChannelsBatchRequest) { - return await this.getClient().put( - this.getClient().baseURL + '/channels/batch', - data, - ); - } - /** * updatePartial - partial update channel properties * diff --git a/src/client.ts b/src/client.ts index c2cbe8703..bc9c08d34 100644 --- a/src/client.ts +++ b/src/client.ts @@ -209,6 +209,8 @@ import type { TokenOrProvider, TranslateResponse, UnBanUserOptions, + UpdateChannelsBatchRequest, + UpdateChannelsBatchResponse, UpdateChannelTypeRequest, UpdateChannelTypeResponse, UpdateCommandOptions, @@ -4762,4 +4764,17 @@ export class StreamChat { syncDeliveredCandidates(collections: Channel[]) { this.messageDeliveryReporter.syncDeliveredCandidates(collections); } + + /** + * Update Channels Batch + * + * @param {UpdateChannelsBatchRequest} payload for updating channels in batch + * @return {Promise} The server response + */ + async updateChannelsBatch(payload: UpdateChannelsBatchRequest) { + return await this.put( + this.baseURL + `/channels/batch`, + payload, + ); + } } From ba42acce2b478510c68acdb4c7d9ef12cd7f1efb Mon Sep 17 00:00:00 2001 From: javierdfm Date: Fri, 14 Nov 2025 09:25:24 +0100 Subject: [PATCH 3/4] fix: updated channel batch filters --- src/types.ts | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/types.ts b/src/types.ts index 6dcc56ea2..f38101979 100644 --- a/src/types.ts +++ b/src/types.ts @@ -4454,11 +4454,20 @@ export type UpdateChannelsBatchRequest = { data?: Partial; }; -export type UpdateChannelsBatchFilters = { - cids?: string[]; - channel_types?: string[]; - tags?: Record; -}; +export type UpdateChannelsBatchFilters = QueryFilters<{ + cids?: + | RequireOnlyOne, '$in'>> + | RequireOnlyOne, '$eq'>> + | PrimitiveFilter; + types?: + | RequireOnlyOne, '$in'>> + | RequireOnlyOne, '$eq'>> + | PrimitiveFilter; + filter_tags?: + | RequireOnlyOne, '$in'>> + | RequireOnlyOne>, '$eq'>> + | PrimitiveFilter>; +}>; export type UpdateChannelsBatchResponse = { result: Record; From 6d97dee22544d7542cf2b4dc6b60d59fdededecc Mon Sep 17 00:00:00 2001 From: javierdfm Date: Tue, 18 Nov 2025 14:03:58 +0100 Subject: [PATCH 4/4] fix: updated --- src/client.ts | 10 +++++----- src/types.ts | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/client.ts b/src/client.ts index bc9c08d34..3f12c5926 100644 --- a/src/client.ts +++ b/src/client.ts @@ -209,7 +209,7 @@ import type { TokenOrProvider, TranslateResponse, UnBanUserOptions, - UpdateChannelsBatchRequest, + UpdateChannelsBatchOptions, UpdateChannelsBatchResponse, UpdateChannelTypeRequest, UpdateChannelTypeResponse, @@ -4768,11 +4768,11 @@ export class StreamChat { /** * Update Channels Batch * - * @param {UpdateChannelsBatchRequest} payload for updating channels in batch - * @return {Promise} The server response + * @param {UpdateChannelsBatchOptions} payload for updating channels in batch + * @return {Promise} The server response */ - async updateChannelsBatch(payload: UpdateChannelsBatchRequest) { - return await this.put( + async updateChannelsBatch(payload: UpdateChannelsBatchOptions) { + return await this.put( this.baseURL + `/channels/batch`, payload, ); diff --git a/src/types.ts b/src/types.ts index 2d08fbf78..d225fe94c 100644 --- a/src/types.ts +++ b/src/types.ts @@ -4460,7 +4460,7 @@ export type EventHook = { updated_at?: string; }; -export type UpdateChannelsBatchRequest = { +export type UpdateChannelsBatchOptions = { operation: string; filter: UpdateChannelsBatchFilters; members?: string[] | Array;