Skip to content
Closed
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
15 changes: 15 additions & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ import type {
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.

UpdateChannelsBatchResponse,
UpdateChannelTypeRequest,
UpdateChannelTypeResponse,
UpdateCommandOptions,
Expand Down Expand Up @@ -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
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

* @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

*/
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.

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?

this.baseURL + `/channels/batch`,
payload,
);
}
}
26 changes: 26 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4459,3 +4459,29 @@ export type EventHook = {
created_at?: string;
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.

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?

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?

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 UpdateChannelsBatchFilters = QueryFilters<{
cids?:
| RequireOnlyOne<Pick<QueryFilter<string>, '$in'>>
| RequireOnlyOne<Pick<QueryFilter<string[]>, '$eq'>>
Comment on lines +4472 to +4473
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.

| PrimitiveFilter<string[]>;
types?:
| RequireOnlyOne<Pick<QueryFilter<string>, '$in'>>
| RequireOnlyOne<Pick<QueryFilter<string[]>, '$eq'>>
Comment on lines +4476 to +4477
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.

| PrimitiveFilter<string[]>;
filter_tags?:
| RequireOnlyOne<Pick<QueryFilter<string>, '$in'>>
| RequireOnlyOne<Pick<QueryFilter<Record<string, string>>, '$eq'>>
Comment on lines +4480 to +4481
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.

| PrimitiveFilter<Record<string, string>>;
}>;

export type UpdateChannelsBatchResponse = {
result: Record<string, string>;
} & Partial<TaskResponse>;
Loading