feat: add support for batch channel updates#1654
Conversation
|
Size Change: +175 B (+0.05%) Total Size: 355 kB
|
| updated_at?: string; | ||
| }; | ||
|
|
||
| export type UpdateChannelsBatchRequest = { |
There was a problem hiding this comment.
| 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) { |
There was a problem hiding this comment.
| 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, |
There was a problem hiding this comment.
| 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>( |
There was a problem hiding this comment.
| 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>; |
There was a problem hiding this comment.
Will this be only ChannelData or a union of ChannelData & ChannelResponse? I see that channel.update() accepts the union:
Line 584 in 39abbb6
| }; | ||
|
|
||
| export type UpdateChannelsBatchRequest = { | ||
| operation: string; |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
| * @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 |
There was a problem hiding this comment.
| * @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>; |
There was a problem hiding this comment.
These are the newly added members, right?
| | RequireOnlyOne<Pick<QueryFilter<string>, '$in'>> | ||
| | RequireOnlyOne<Pick<QueryFilter<string[]>, '$eq'>> |
There was a problem hiding this comment.
| | 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.
| | RequireOnlyOne<Pick<QueryFilter<string>, '$in'>> | ||
| | RequireOnlyOne<Pick<QueryFilter<string[]>, '$eq'>> |
There was a problem hiding this comment.
| | 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.
| | RequireOnlyOne<Pick<QueryFilter<string>, '$in'>> | ||
| | RequireOnlyOne<Pick<QueryFilter<Record<string, string>>, '$eq'>> |
There was a problem hiding this comment.
| | 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.
CLA
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