Skip to content

feat: add support for batch channel updates#1654

Closed
javierdfm wants to merge 4 commits intomasterfrom
batch-updates
Closed

feat: add support for batch channel updates#1654
javierdfm wants to merge 4 commits intomasterfrom
batch-updates

Conversation

@javierdfm
Copy link
Contributor

@javierdfm javierdfm commented Nov 17, 2025

CLA

  • I have signed the Stream CLA (required).
  • Code changes are tested

Description of the changes, What, Why and How?

Changelog

Part of adding Channel Batch Updates: https://linear.app/stream/project/batch-channel-operations-97fcafb76ea0/overview

This adds the endpoint for BatchUpdates with filtering

@github-actions
Copy link
Contributor

Size Change: +175 B (+0.05%)

Total Size: 355 kB

Filename Size Change
dist/cjs/index.browser.js 118 kB +59 B (+0.05%)
dist/cjs/index.node.js 119 kB +58 B (+0.05%)
dist/esm/index.mjs 117 kB +58 B (+0.05%)

compressed-size-action

updated_at?: string;
};

export type UpdateChannelsBatchRequest = {
Copy link
Contributor

@MartinCupela MartinCupela Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export type UpdateChannelsBatchRequest = {
export type UpdateChannelsBatchOptions = {

Changing Request for Options feels more descriptive to me as word "request" would probably refer more the the HTTP request that holds this payload. Also word options is already used across the SDK.

* @param {UpdateChannelsBatchRequest} payload for updating channels in batch
* @return {Promise<UpdateChannelsBatchResponse>} The server response
*/
async updateChannelsBatch(payload: UpdateChannelsBatchRequest) {
Copy link
Contributor

@MartinCupela MartinCupela Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
async updateChannelsBatch(payload: UpdateChannelsBatchRequest) {
async updateChannelsBatch(options: UpdateChannelsBatchOptions) {

Changing Request for Options feels more descriptive to me as word "request" would probably refer more the the HTTP request that holds this payload. Also word options is already used across the SDK.

TokenOrProvider,
TranslateResponse,
UnBanUserOptions,
UpdateChannelsBatchRequest,
Copy link
Contributor

@MartinCupela MartinCupela Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
UpdateChannelsBatchRequest,
UpdateChannelsBatchOptions,

Changing Request for Options feels more descriptive to me as word "request" would probably refer more the the HTTP request that holds this payload. Also word options is already used across the SDK.

* @return {Promise<UpdateChannelsBatchResponse>} The server response
*/
async updateChannelsBatch(payload: UpdateChannelsBatchRequest) {
return await this.put<UpdateChannelsBatchResponse>(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return await this.put<UpdateChannelsBatchResponse>(
return await this.put<APIResponse & UpdateChannelsBatchResponse>(

May it be that the returned JSON will also contain fields from APIResponse type?

operation: string;
filter: UpdateChannelsBatchFilters;
members?: string[] | Array<NewMemberPayload>;
data?: Partial<ChannelData>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this be only ChannelData or a union of ChannelData & ChannelResponse? I see that channel.update() accepts the union:

channelData: Partial<ChannelData & ChannelResponse> = {},

};

export type UpdateChannelsBatchRequest = {
operation: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is operation any string or is it a rather set of defined strings? Or is it an id?

/**
* Update Channels Batch
*
* @param {UpdateChannelsBatchRequest} payload for updating channels in batch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param {UpdateChannelsBatchRequest} payload for updating channels in batch
* @param {UpdateChannelsBatchOptions} payload for updating channels in batch

* Update Channels Batch
*
* @param {UpdateChannelsBatchRequest} payload for updating channels in batch
* @return {Promise<UpdateChannelsBatchResponse>} The server response
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @return {Promise<UpdateChannelsBatchResponse>} The server response
* @return {Promise<APIResponse & UpdateChannelsBatchResponse>} The server response

Not sure

export type UpdateChannelsBatchRequest = {
operation: string;
filter: UpdateChannelsBatchFilters;
members?: string[] | Array<NewMemberPayload>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are the newly added members, right?

Comment on lines +4472 to +4473
| RequireOnlyOne<Pick<QueryFilter<string>, '$in'>>
| RequireOnlyOne<Pick<QueryFilter<string[]>, '$eq'>>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| RequireOnlyOne<Pick<QueryFilter<string>, '$in'>>
| RequireOnlyOne<Pick<QueryFilter<string[]>, '$eq'>>
| RequireOnlyOne<Pick<QueryFilter<string>, '$in' | '$eq'>>

Maybe could be simplified to this if we want to allow $in or $eq exclusively.

Comment on lines +4476 to +4477
| RequireOnlyOne<Pick<QueryFilter<string>, '$in'>>
| RequireOnlyOne<Pick<QueryFilter<string[]>, '$eq'>>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| RequireOnlyOne<Pick<QueryFilter<string>, '$in'>>
| RequireOnlyOne<Pick<QueryFilter<string[]>, '$eq'>>
| RequireOnlyOne<Pick<QueryFilter<string>, '$in' | '$eq'>>

Maybe could be simplified to this if we want to allow $in or $eq exclusively.

Comment on lines +4480 to +4481
| RequireOnlyOne<Pick<QueryFilter<string>, '$in'>>
| RequireOnlyOne<Pick<QueryFilter<Record<string, string>>, '$eq'>>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| RequireOnlyOne<Pick<QueryFilter<string>, '$in'>>
| RequireOnlyOne<Pick<QueryFilter<Record<string, string>>, '$eq'>>
| RequireOnlyOne<Pick<QueryFilter<string>, '$in' | '$eq'>>

Maybe could be simplified to this if we want to allow $in or $eq exclusively.

@javierdfm javierdfm closed this Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants