stream-chat
Advanced tools
Comparing version 8.40.2 to 8.40.3
/// <reference types="node" /> | ||
import { ChannelState } from './channel_state'; | ||
import { StreamChat } from './client'; | ||
import { APIResponse, BanUserOptions, ChannelAPIResponse, ChannelData, ChannelMemberAPIResponse, ChannelQueryOptions, ChannelResponse, ChannelUpdateOptions, CreateCallOptions, CreateCallResponse, DefaultGenerics, DeleteChannelAPIResponse, Event, EventAPIResponse, EventHandler, EventTypes, ExtendableGenerics, FormatMessageResponse, GetMultipleMessagesAPIResponse, GetReactionsAPIResponse, GetRepliesAPIResponse, InviteOptions, MarkReadOptions, MarkUnreadOptions, MemberSort, Message, MessageFilters, MessagePaginationOptions, MessageResponse, MessageSetType, MuteChannelAPIResponse, PartialUpdateChannel, PartialUpdateChannelAPIResponse, PinnedMessagePaginationOptions, PinnedMessagesSort, QueryMembersOptions, Reaction, ReactionAPIResponse, SearchAPIResponse, SearchOptions, SendMessageAPIResponse, TruncateChannelAPIResponse, TruncateOptions, UpdateChannelAPIResponse, UserFilters, UserResponse, QueryChannelAPIResponse, PollVoteData, SendMessageOptions, AscDesc } from './types'; | ||
import { APIResponse, BanUserOptions, ChannelAPIResponse, ChannelData, ChannelMemberAPIResponse, ChannelMemberResponse, ChannelQueryOptions, ChannelResponse, ChannelUpdateOptions, CreateCallOptions, CreateCallResponse, DefaultGenerics, DeleteChannelAPIResponse, Event, EventAPIResponse, EventHandler, EventTypes, ExtendableGenerics, FormatMessageResponse, GetMultipleMessagesAPIResponse, GetReactionsAPIResponse, GetRepliesAPIResponse, InviteOptions, MarkReadOptions, MarkUnreadOptions, MemberSort, Message, MessageFilters, MessagePaginationOptions, MessageResponse, MessageSetType, MuteChannelAPIResponse, PartialUpdateChannel, PartialUpdateChannelAPIResponse, PartialUpdateMember, PinnedMessagePaginationOptions, PinnedMessagesSort, QueryMembersOptions, Reaction, ReactionAPIResponse, SearchAPIResponse, SearchOptions, SendMessageAPIResponse, TruncateChannelAPIResponse, TruncateOptions, UpdateChannelAPIResponse, UserFilters, UserResponse, QueryChannelAPIResponse, PollVoteData, SendMessageOptions, AscDesc } from './types'; | ||
import { Role } from './permissions'; | ||
@@ -115,2 +115,11 @@ /** | ||
/** | ||
* partialUpdateMember - Partial update a member | ||
* | ||
* @param {string} user_id member user id | ||
* @param {PartialUpdateMember<StreamChatGenerics>} updates | ||
* | ||
* @return {Promise<ChannelMemberResponse<StreamChatGenerics>>} Updated member | ||
*/ | ||
partialUpdateMember(user_id: string, updates: PartialUpdateMember<StreamChatGenerics>): Promise<ChannelMemberResponse<StreamChatGenerics>>; | ||
/** | ||
* sendReaction - Send a reaction about a message | ||
@@ -545,4 +554,5 @@ * | ||
_extendEventWithOwnReactions(event: Event<StreamChatGenerics>): void; | ||
_hydrateMembers(members: ChannelMemberResponse<StreamChatGenerics>[]): void; | ||
_disconnect(): void; | ||
} | ||
//# sourceMappingURL=channel.d.ts.map |
{ | ||
"name": "stream-chat", | ||
"version": "8.40.2", | ||
"version": "8.40.3", | ||
"description": "JS SDK for the Stream Chat API", | ||
@@ -5,0 +5,0 @@ "author": "GetStream", |
@@ -40,2 +40,3 @@ import { ChannelState } from './channel_state'; | ||
PartialUpdateChannelAPIResponse, | ||
PartialUpdateMember, | ||
PinnedMessagePaginationOptions, | ||
@@ -304,2 +305,21 @@ PinnedMessagesSort, | ||
/** | ||
* partialUpdateMember - Partial update a member | ||
* | ||
* @param {string} user_id member user id | ||
* @param {PartialUpdateMember<StreamChatGenerics>} updates | ||
* | ||
* @return {Promise<ChannelMemberResponse<StreamChatGenerics>>} Updated member | ||
*/ | ||
async partialUpdateMember(user_id: string, updates: PartialUpdateMember<StreamChatGenerics>) { | ||
if (!user_id) { | ||
throw Error('Please specify the user id'); | ||
} | ||
return await this.getClient().patch<ChannelMemberResponse<StreamChatGenerics>>( | ||
this._channelURL() + `/member/${encodeURIComponent(user_id)}`, | ||
updates, | ||
); | ||
} | ||
/** | ||
* sendReaction - Send a reaction about a message | ||
@@ -1638,8 +1658,3 @@ * | ||
if (state.members) { | ||
this.state.members = state.members.reduce((acc, member) => { | ||
if (member.user) { | ||
acc[member.user.id] = member; | ||
} | ||
return acc; | ||
}, {} as ChannelState<StreamChatGenerics>['members']); | ||
this._hydrateMembers(state.members); | ||
} | ||
@@ -1662,2 +1677,11 @@ | ||
_hydrateMembers(members: ChannelMemberResponse<StreamChatGenerics>[]) { | ||
this.state.members = members.reduce((acc, member) => { | ||
if (member.user) { | ||
acc[member.user.id] = member; | ||
} | ||
return acc; | ||
}, {} as ChannelState<StreamChatGenerics>['members']); | ||
} | ||
_disconnect() { | ||
@@ -1664,0 +1688,0 @@ this._client.logger('info', `channel:disconnect() - Disconnecting the channel ${this.cid}`, { |
@@ -77,5 +77,13 @@ import type { Channel } from './channel'; | ||
constructor({ client, threadData }: { client: StreamChat<SCG>; threadData: ThreadResponse<SCG> }) { | ||
const channel = client.channel(threadData.channel.type, threadData.channel.id, { | ||
name: threadData.channel.name, | ||
}); | ||
if (threadData.channel.members) { | ||
channel._hydrateMembers(threadData.channel.members); | ||
} | ||
this.state = new StateStore<ThreadState<SCG>>({ | ||
active: false, | ||
channel: client.channel(threadData.channel.type, threadData.channel.id), | ||
channel, | ||
createdAt: new Date(threadData.created_at), | ||
@@ -82,0 +90,0 @@ deletedAt: threadData.deleted_at ? new Date(threadData.deleted_at) : null, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6836631
71030