ChannelService
The ChannelService
provides data and interaction for the channel list and message list.
Type parameters
Name | Type |
---|---|
T | extends DefaultStreamChatGenerics = DefaultStreamChatGenerics |
Properties
activeChannel$
• activeChannel$: Observable
\<undefined
| Channel
\<T
>>
Emits the currently active channel.
If you want to subscribe to channel events, you need to manually reenter Angular's change detection zone, our Change detection guide explains this in detail.
The active channel will always be marked as read when a new message is received
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:97
activeChannelLastReadMessageId
• Optional
activeChannelLastReadMessageId: string
The last read message id of the active channel, it's used by the message list component to display unread UI, and jump to latest read message
This property isn't always updated, please use channel.read
to display up-to-date read information
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:149
activeChannelMessages$
• activeChannelMessages$: Observable
\<StreamMessage
\<T
>[]>
Emits the list of currently loaded messages of the active channel.
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:101
activeChannelPinnedMessages$
• activeChannelPinnedMessages$: Observable
\<StreamMessage
\<T
>[]>
Emits the list of pinned messages of the active channel.
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:105
activeChannelUnreadCount
• Optional
activeChannelUnreadCount: number
The unread count of the active channel, it's used by the message list component to display unread UI
This property isn't always updated, please use channel.read
to display up-to-date read information
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:155
activeParentMessage$
• activeParentMessage$: Observable
\<undefined
| StreamMessage
\<T
>>
Emits the currently selected parent message. If no message is selected, it emits undefined.
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:117
activeParentMessageId$
• activeParentMessageId$: Observable
\<undefined
| string
>
Emits the id of the currently selected parent message. If no message is selected, it emits undefined.
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:109
activeThreadMessages$
• activeThreadMessages$: Observable
\<StreamMessage
\<T
>[]>
Emits the list of currently loaded thread replies belonging to the selected parent message. If there is no currently active thread it emits an empty array.
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:113
beforeSendMessage
• Optional
beforeSendMessage: (input
: MessageInput
\<T
>) => MessageInput
\<T
> | Promise
\<MessageInput
\<T
>>
The provided method will be called before a new message is sent to Stream's API. You can use this hook to tranfrom or enrich the message being sent.
Type declaration
▸ (input
): MessageInput
\<T
> | Promise
\<MessageInput
\<T
>>
Parameters
Name | Type |
---|---|
input | MessageInput \<T > |
Returns
MessageInput
\<T
> | Promise
\<MessageInput
\<T
>>
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:304
beforeUpdateMessage
• Optional
beforeUpdateMessage: (message
: StreamMessage
\<T
>) => StreamMessage
\<T
> | Promise
\<StreamMessage
\<T
>>
The provided method will be called before a message is sent to Stream's API for update. You can use this hook to tranfrom or enrich the message being updated.
Type declaration
▸ (message
): StreamMessage
\<T
> | Promise
\<StreamMessage
\<T
>>
Parameters
Name | Type |
---|---|
message | StreamMessage \<T > |
Returns
StreamMessage
\<T
> | Promise
\<StreamMessage
\<T
>>
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:310
bouncedMessage$
• bouncedMessage$: BehaviorSubject
\<undefined
| StreamMessage
\<T
>>
If you're using semantic filters for moderation you can set up rules for bouncing messages.
If a message is bounced, it will be emitted via this Observable
. The built-in MessageBouncePrompt
component will display the bounce option to the user if a bounced message is clicked.
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:143
channelQueryState$
• channelQueryState$: Observable
\<undefined
| ChannelQueryState
>
The result of the latest channel query request.
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:87
channels$
• channels$: Observable
\<undefined
| Channel
\<T
>[]>
Emits the currently loaded and watched channel list.
If you want to subscribe to channel events, you need to manually reenter Angular's change detection zone, our Change detection guide explains this in detail.
Apart from pagination, the channel list is also updated on the following events:
Event type | Default behavior | Custom handler to override |
---|---|---|
channel.deleted | Remove channel from the list | customChannelDeletedHandler |
channel.hidden | Remove channel from the list | customChannelHiddenHandler |
channel.truncated | Updates the channel | customChannelTruncatedHandler |
channel.updated | Updates the channel | customChannelUpdatedHandler |
channel.visible | Adds the channel to the list | customChannelVisibleHandler |
message.new | Moves the channel to top of the list | customNewMessageHandler |
notification.added_to_channel | Adds the new channel to the top of the list and starts watching it | customAddedToChannelNotificationHandler |
notification.message_new | Adds the new channel to the top of the list and starts watching it | customNewMessageNotificationHandler |
notification.removed_from_channel | Removes the channel from the list | customRemovedFromChannelNotificationHandler |
It's important to note that filters don't apply to updates to the list from events.
Our platform documentation covers the topic of channel events in depth.
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:83
customAddedToChannelNotificationHandler
• Optional
customAddedToChannelNotificationHandler: (clientEvent
: ClientEvent
\<DefaultStreamChatGenerics
>, channelListSetter
: (channels
: (Channel
\<T
> | ChannelResponse
\<T
>)[], shouldStopWatchingRemovedChannels?
: boolean
) => void
) => void
Custom event handler to call when the user is added to a channel, provide an event handler if you want to override the default channel list ordering
Type declaration
▸ (clientEvent
, channelListSetter
): void
Parameters
Name | Type |
---|---|
clientEvent | ClientEvent \<DefaultStreamChatGenerics > |
channelListSetter | (channels : (Channel \<T > | ChannelResponse \<T >)[], shouldStopWatchingRemovedChannels? : boolean ) => void |
Returns
void
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:169
customChannelDeletedHandler
• Optional
customChannelDeletedHandler: (event
: Event
\<DefaultGenerics
>, channel
: Channel
\<T
>, channelListSetter
: (channels
: (Channel
\<T
> | ChannelResponse
\<T
>)[], shouldStopWatchingRemovedChannels?
: boolean
) => void
, messageListSetter
: (messages
: StreamMessage
\<T
>[]) => void
, threadListSetter
: (messages
: StreamMessage
\<T
>[]) => void
, parentMessageSetter
: (message
: undefined
| StreamMessage
\<T
>) => void
) => void
Custom event handler to call when a channel is deleted, provide an event handler if you want to override the default channel list ordering
Type declaration
▸ (event
, channel
, channelListSetter
, messageListSetter
, threadListSetter
, parentMessageSetter
): void
Parameters
Name | Type |
---|---|
event | Event \<DefaultGenerics > |
channel | Channel \<T > |
channelListSetter | (channels : (Channel \<T > | ChannelResponse \<T >)[], shouldStopWatchingRemovedChannels? : boolean ) => void |
messageListSetter | (messages : StreamMessage \<T >[]) => void |
threadListSetter | (messages : StreamMessage \<T >[]) => void |
parentMessageSetter | (message : undefined | StreamMessage \<T >) => void |
Returns
void
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:189
customChannelHiddenHandler
• Optional
customChannelHiddenHandler: (event
: Event
\<DefaultGenerics
>, channel
: Channel
\<T
>, channelListSetter
: (channels
: (Channel
\<T
> | ChannelResponse
\<T
>)[], shouldStopWatchingRemovedChannels?
: boolean
) => void
, messageListSetter
: (messages
: StreamMessage
\<T
>[]) => void
, threadListSetter
: (messages
: StreamMessage
\<T
>[]) => void
, parentMessageSetter
: (message
: undefined
| StreamMessage
\<T
>) => void
) => void
Custom event handler to call when a channel becomes hidden, provide an event handler if you want to override the default channel list ordering
Type declaration
▸ (event
, channel
, channelListSetter
, messageListSetter
, threadListSetter
, parentMessageSetter
): void
Parameters
Name | Type |
---|---|
event | Event \<DefaultGenerics > |
channel | Channel \<T > |
channelListSetter | (channels : (Channel \<T > | ChannelResponse \<T >)[], shouldStopWatchingRemovedChannels? : boolean ) => void |
messageListSetter | (messages : StreamMessage \<T >[]) => void |
threadListSetter | (messages : StreamMessage \<T >[]) => void |
parentMessageSetter | (message : undefined | StreamMessage \<T >) => void |
Returns
void
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:231
customChannelTruncatedHandler
• Optional
customChannelTruncatedHandler: (event
: Event
\<DefaultGenerics
>, channel
: Channel
\<T
>, channelListSetter
: (channels
: (Channel
\<T
> | ChannelResponse
\<T
>)[], shouldStopWatchingRemovedChannels?
: boolean
) => void
, messageListSetter
: (messages
: StreamMessage
\<T
>[]) => void
, threadListSetter
: (messages
: StreamMessage
\<T
>[]) => void
, parentMessageSetter
: (message
: undefined
| StreamMessage
\<T
>) => void
) => void
Custom event handler to call when a channel is truncated, provide an event handler if you want to override the default channel list ordering
Type declaration
▸ (event
, channel
, channelListSetter
, messageListSetter
, threadListSetter
, parentMessageSetter
): void
Parameters
Name | Type |
---|---|
event | Event \<DefaultGenerics > |
channel | Channel \<T > |
channelListSetter | (channels : (Channel \<T > | ChannelResponse \<T >)[], shouldStopWatchingRemovedChannels? : boolean ) => void |
messageListSetter | (messages : StreamMessage \<T >[]) => void |
threadListSetter | (messages : StreamMessage \<T >[]) => void |
parentMessageSetter | (message : undefined | StreamMessage \<T >) => void |
Returns
void
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:217
customChannelUpdatedHandler
• Optional
customChannelUpdatedHandler: (event
: Event
\<DefaultGenerics
>, channel
: Channel
\<T
>, channelListSetter
: (channels
: (Channel
\<T
> | ChannelResponse
\<T
>)[], shouldStopWatchingRemovedChannels?
: boolean
) => void
, messageListSetter
: (messages
: StreamMessage
\<DefaultStreamChatGenerics
>[]) => void
, threadListSetter
: (messages
: StreamMessage
\<DefaultStreamChatGenerics
>[]) => void
, parentMessageSetter
: (message
: undefined
| StreamMessage
\<DefaultStreamChatGenerics
>) => void
) => void
Custom event handler to call when a channel is updated, provide an event handler if you want to override the default channel list ordering
Type declaration
▸ (event
, channel
, channelListSetter
, messageListSetter
, threadListSetter
, parentMessageSetter
): void
Parameters
Name | Type |
---|---|
event | Event \<DefaultGenerics > |
channel | Channel \<T > |
channelListSetter | (channels : (Channel \<T > | ChannelResponse \<T >)[], shouldStopWatchingRemovedChannels? : boolean ) => void |
messageListSetter | (messages : StreamMessage \<DefaultStreamChatGenerics >[]) => void |
threadListSetter | (messages : StreamMessage \<DefaultStreamChatGenerics >[]) => void |
parentMessageSetter | (message : undefined | StreamMessage \<DefaultStreamChatGenerics >) => void |
Returns
void
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:203
customChannelVisibleHandler
• Optional
customChannelVisibleHandler: (event
: Event
\<DefaultGenerics
>, channel
: Channel
\<T
>, channelListSetter
: (channels
: (Channel
\<T
> | ChannelResponse
\<T
>)[], shouldStopWatchingRemovedChannels?
: boolean
) => void
, messageListSetter
: (messages
: StreamMessage
\<T
>[]) => void
, threadListSetter
: (messages
: StreamMessage
\<T
>[]) => void
, parentMessageSetter
: (message
: undefined
| StreamMessage
\<T
>) => void
) => void
Custom event handler to call when a channel becomes visible, provide an event handler if you want to override the default channel list ordering
Type declaration
▸ (event
, channel
, channelListSetter
, messageListSetter
, threadListSetter
, parentMessageSetter
): void
Parameters
Name | Type |
---|---|
event | Event \<DefaultGenerics > |
channel | Channel \<T > |
channelListSetter | (channels : (Channel \<T > | ChannelResponse \<T >)[], shouldStopWatchingRemovedChannels? : boolean ) => void |
messageListSetter | (messages : StreamMessage \<T >[]) => void |
threadListSetter | (messages : StreamMessage \<T >[]) => void |
parentMessageSetter | (message : undefined | StreamMessage \<T >) => void |
Returns
void
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:245
customFileDeleteRequest
• Optional
customFileDeleteRequest: (url
: string
, channel
: Channel
\<T
>) => Promise
\<void
>
You can override the default file delete request - override this if you use your own CDN
Type declaration
▸ (url
, channel
): Promise
\<void
>
Parameters
Name | Type |
---|---|
url | string |
channel | Channel \<T > |
Returns
Promise
\<void
>
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:287
customFileUploadRequest
• Optional
customFileUploadRequest: (file
: File
, channel
: Channel
\<T
>) => Promise
\<{ file
: string
}>
You can override the default file upload request - you can use this to upload files to your own CDN
Type declaration
▸ (file
, channel
): Promise
\<{ file
: string
}>
Parameters
Name | Type |
---|---|
file | File |
channel | Channel \<T > |
Returns
Promise
\<{ file
: string
}>
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:273
customImageDeleteRequest
• Optional
customImageDeleteRequest: (url
: string
, channel
: Channel
\<T
>) => Promise
\<void
>
You can override the default image delete request - override this if you use your own CDN
Type declaration
▸ (url
, channel
): Promise
\<void
>
Parameters
Name | Type |
---|---|
url | string |
channel | Channel \<T > |
Returns
Promise
\<void
>
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:291
customImageUploadRequest
• Optional
customImageUploadRequest: (file
: File
, channel
: Channel
\<T
>) => Promise
\<{ file
: string
}>
You can override the default image upload request - you can use this to upload images to your own CDN
Type declaration
▸ (file
, channel
): Promise
\<{ file
: string
}>
Parameters
Name | Type |
---|---|
file | File |
channel | Channel \<T > |
Returns
Promise
\<{ file
: string
}>
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:280
customNewMessageHandler
• Optional
customNewMessageHandler: (event
: Event
\<DefaultGenerics
>, channel
: Channel
\<T
>, channelListSetter
: (channels
: (Channel
\<T
> | ChannelResponse
\<T
>)[], shouldStopWatchingRemovedChannels?
: boolean
) => void
, messageListSetter
: (messages
: StreamMessage
\<T
>[]) => void
, threadListSetter
: (messages
: StreamMessage
\<T
>[]) => void
, parentMessageSetter
: (message
: undefined
| StreamMessage
\<T
>) => void
) => void
Custom event handler to call if a new message received from a channel that is being watched, provide an event handler if you want to override the default channel list ordering
Type declaration
▸ (event
, channel
, channelListSetter
, messageListSetter
, threadListSetter
, parentMessageSetter
): void
Parameters
Name | Type |
---|---|
event | Event \<DefaultGenerics > |
channel | Channel \<T > |
channelListSetter | (channels : (Channel \<T > | ChannelResponse \<T >)[], shouldStopWatchingRemovedChannels? : boolean ) => void |
messageListSetter | (messages : StreamMessage \<T >[]) => void |
threadListSetter | (messages : StreamMessage \<T >[]) => void |
parentMessageSetter | (message : undefined | StreamMessage \<T >) => void |
Returns
void
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:259
customNewMessageNotificationHandler
• Optional
customNewMessageNotificationHandler: (clientEvent
: ClientEvent
\<DefaultStreamChatGenerics
>, channelListSetter
: (channels
: (Channel
\<T
> | ChannelResponse
\<T
>)[], shouldStopWatchingRemovedChannels?
: boolean
) => void
) => void
Custom event handler to call if a new message received from a channel that is not being watched, provide an event handler if you want to override the default channel list ordering
Type declaration
▸ (clientEvent
, channelListSetter
): void
Parameters
Name | Type |
---|---|
clientEvent | ClientEvent \<DefaultStreamChatGenerics > |
channelListSetter | (channels : (Channel \<T > | ChannelResponse \<T >)[], shouldStopWatchingRemovedChannels? : boolean ) => void |
Returns
void
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:159
customPaginator
• Optional
customPaginator: (channelQueryResult
: Channel
\<T
>[]) => NextPageConfiguration
By default the SDK uses an offset based pagination, you can change/extend this by providing your own custom paginator method.
The method will be called with the result of the latest channel query.
You can return either an offset, or a filter using the $lte
/$gte
operator. If you return a filter, it will be merged with the filter provided for the init
method.
Type declaration
▸ (channelQueryResult
): NextPageConfiguration
Parameters
Name | Type |
---|---|
channelQueryResult | Channel \<T >[] |
Returns
NextPageConfiguration
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:320
customRemovedFromChannelNotificationHandler
• Optional
customRemovedFromChannelNotificationHandler: (clientEvent
: ClientEvent
\<DefaultStreamChatGenerics
>, channelListSetter
: (channels
: (Channel
\<T
> | ChannelResponse
\<T
>)[], shouldStopWatchingRemovedChannels?
: boolean
) => void
) => void
Custom event handler to call when the user is removed from a channel, provide an event handler if you want to override the default channel list ordering
Type declaration
▸ (clientEvent
, channelListSetter
): void
Parameters
Name | Type |
---|---|
clientEvent | ClientEvent \<DefaultStreamChatGenerics > |
channelListSetter | (channels : (Channel \<T > | ChannelResponse \<T >)[], shouldStopWatchingRemovedChannels? : boolean ) => void |
Returns
void
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:179
hasMoreChannels$
• hasMoreChannels$: Observable
\<boolean
>
Emits false
if there are no more pages of channels that can be loaded.
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:56
jumpToMessage$
• jumpToMessage$: Observable
\<{ id?
: string
; parentId?
: string
}>
Emits the ID of the message the message list should jump to (can be a channel message or thread message)
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:125
latestMessageDateByUserByChannels$
• latestMessageDateByUserByChannels$: Observable
\<{ [key: string]
: Date
; }>
Emits a map that contains the date of the latest message sent by the current user by channels (this is used to detect if slow mode countdown should be started)
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:137
messageDeleteConfirmationHandler
• Optional
messageDeleteConfirmationHandler: (message
: StreamMessage
\<T
>) => Promise
\<boolean
>
The provided method will be called before deleting a message. If the returned Promise resolves to true
to deletion will go ahead. If false
is returned, the message won't be deleted.
Type declaration
▸ (message
): Promise
\<boolean
>
Parameters
Name | Type |
---|---|
message | StreamMessage \<T > |
Returns
Promise
\<boolean
>
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:298
messageToQuote$
• messageToQuote$: Observable
\<undefined
| StreamMessage
\<T
>>
Emits the currently selected message to quote
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:121
usersTypingInChannel$
• usersTypingInChannel$: Observable
\<UserResponse
\<T
>[]>
Emits the list of users that are currently typing in the channel (current user is not included)
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:129
usersTypingInThread$
• usersTypingInThread$: Observable
\<UserResponse
\<T
>[]>
Emits the list of users that are currently typing in the active thread (current user is not included)
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:133
MAX_MESSAGE_REACTIONS_TO_FETCH
▪ Static
Readonly
MAX_MESSAGE_REACTIONS_TO_FETCH: 1200
internal
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:324
Accessors
activeChannel
• get
activeChannel(): undefined
| Channel
\<T
>
The current active channel
Returns
undefined
| Channel
\<T
>
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:1520
activeChannelMessages
• get
activeChannelMessages(): (StreamMessage
\<T
> | MessageResponse
\<T
> | FormatMessageResponse
\<T
>)[]
The current active channel messages
Returns
(StreamMessage
\<T
> | MessageResponse
\<T
> | FormatMessageResponse
\<T
>)[]
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:1527
channels
• get
channels(): Channel
\<T
>[]
The current list of channels
Returns
Channel
\<T
>[]
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:1513
shouldMarkActiveChannelAsRead
• get
shouldMarkActiveChannelAsRead(): boolean
If set to false, read events won't be sent as new messages are received. If set to true active channel (if any) will immediately be marked as read.
Returns
boolean
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:495
• set
shouldMarkActiveChannelAsRead(shouldMarkActiveChannelAsRead
): void
If set to false, read events won't be sent as new messages are received. If set to true active channel (if any) will immediately be marked as read.
Parameters
Name | Type |
---|---|
shouldMarkActiveChannelAsRead | boolean |
Returns
void
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:502
Methods
addChannel
▸ addChannel(channel
): void
Add a new channel to the channel list The channel will be added to the beginning of the channel list
Parameters
Name | Type |
---|---|
channel | Channel \<T > |
Returns
void
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:1051
addReaction
▸ addReaction(messageId
, reactionType
, customData?
): Promise
\<void
>
Adds a reaction to a message.
Parameters
Name | Type | Description |
---|---|---|
messageId | string | The id of the message to add the reaction to |
reactionType | string | The type of the reaction |
customData? | T ["reactionType" ] |
Returns
Promise
\<void
>
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:742
autocompleteMembers
▸ autocompleteMembers(searchTerm
): Promise
\<ChannelMemberResponse
\<T
>[]>
Returns the autocomplete options for current channel members. If the channel has less than 100 members, it returns the channel members, otherwise sends a search request with the given search term.
Parameters
Name | Type | Description |
---|---|---|
searchTerm | string | Text to search for in the names of members |
Returns
Promise
\<ChannelMemberResponse
\<T
>[]>
The list of members matching the search filter
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:978
deleteAttachment
▸ deleteAttachment(attachmentUpload
): Promise
\<void
>
Deletes an uploaded file by URL. If you want to know more about file uploads check out the platform documentation
Parameters
Name | Type | Description |
---|---|---|
attachmentUpload | AttachmentUpload \<DefaultStreamChatGenerics > | Attachment to be deleted (output of the AttachmentService ) |
Returns
Promise
\<void
>
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:962
deleteMessage
▸ deleteMessage(message
, isLocalDelete?
): Promise
\<void
>
Deletes the message from the active channel
Parameters
Name | Type | Default value | Description |
---|---|---|---|
message | StreamMessage \<DefaultStreamChatGenerics > | undefined | Message to be deleted |
isLocalDelete | boolean | false | set this true if you want to delete a message that's only part of the local state, not yet saved on the backend |
Returns
Promise
\<void
>
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:864
deselectActiveChannel
▸ deselectActiveChannel(): void
Deselects the currently active (if any) channel
Returns
void
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:549
getMessageReactions
▸ getMessageReactions(messageId
): Promise
\<ReactionResponse
\<T
>[]>
Get the last 1200 reactions of a message in the current active channel. If you need to fetch more reactions please use the following endpoint.
Parameters
Name | Type |
---|---|
messageId | string |
Returns
Promise
\<ReactionResponse
\<T
>[]>
all reactions of a message
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:1536
init
▸ init(filters
, sort?
, options?
, shouldSetActiveChannel?
): Promise
\<Channel
\<T
>[]>
Queries the channels with the given filters, sorts and options. More info about channel querying can be found in the platform documentation. By default the first channel in the list will be set as active channel and will be marked as read.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
filters | ChannelFilters \<T > | undefined | |
sort? | ChannelSort \<T > | undefined | |
options? | ChannelOptions | undefined | |
shouldSetActiveChannel | boolean | true | Decides if the first channel in the result should be made as an active channel, or no channel should be marked as active |
Returns
Promise
\<Channel
\<T
>[]>
the list of channels found by the query
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:679
jumpToMessage
▸ jumpToMessage(messageId
, parentMessageId?
): Promise
\<void
>
Jumps to the selected message inside the message list, if the message is not yet loaded, it'll load the message (and it's surroundings) from the API.
Parameters
Name | Type | Description |
---|---|---|
messageId | string | The ID of the message to be loaded, 'latest' means jump to the latest messages |
parentMessageId? | string | The ID of the parent message if we want to load a thread message |
Returns
Promise
\<void
>
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:1147
loadMoreChannels
▸ loadMoreChannels(): Promise
\<void
>
Loads the next page of channels. The page size can be set in the query option object.
Returns
Promise
\<void
>
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:732
loadMoreMessages
▸ loadMoreMessages(direction?
): undefined
| false
| Promise
\<QueryChannelAPIResponse
\<T
>>
Loads the next page of messages of the active channel. The page size can be set in the query option object.
Parameters
Name | Type | Default value |
---|---|---|
direction | "older" | "newer" | 'older' |
Returns
undefined
| false
| Promise
\<QueryChannelAPIResponse
\<T
>>
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:610
loadMoreThreadReplies
▸ loadMoreThreadReplies(direction?
): Promise
\<void
>
Loads the next page of messages of the active thread. The page size can be set in the query option object.
Parameters
Name | Type | Default value |
---|---|---|
direction | "older" | "newer" | 'older' |
Returns
Promise
\<void
>
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:649
markMessageUnread
▸ markMessageUnread(messageId
): Promise
\<undefined
| null
| APIResponse
>
Marks the channel from the given message as unread
Parameters
Name | Type |
---|---|
messageId | string |
Returns
Promise
\<undefined
| null
| APIResponse
>
the result of the request
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:1569
pinMessage
▸ pinMessage(message
): Promise
\<void
>
Pins the given message in the channel
Parameters
Name | Type |
---|---|
message | StreamMessage \<DefaultStreamChatGenerics > |
Returns
Promise
\<void
>
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:1176
removeReaction
▸ removeReaction(messageId
, reactionType
): Promise
\<void
>
Removes a reaction from a message.
Parameters
Name | Type | Description |
---|---|---|
messageId | string | The id of the message to remove the reaction from |
reactionType | string | Thr type of reaction to remove |
Returns
Promise
\<void
>
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:758
resendMessage
▸ resendMessage(message
): Promise
\<StreamMessage
\<T
>>
Resends the given message to the active channel
Parameters
Name | Type | Description |
---|---|---|
message | StreamMessage \<DefaultStreamChatGenerics > | The message to resend |
Returns
Promise
\<StreamMessage
\<T
>>
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:812
reset
▸ reset(): void
Resets the activeChannel$
, channels$
and activeChannelMessages$
Observables. Useful when disconnecting a chat user, use in combination with disconnectUser
.
Returns
void
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:715
selectMessageToQuote
▸ selectMessageToQuote(message
): void
Selects or deselects the current message to quote reply to
Parameters
Name | Type | Description |
---|---|---|
message | undefined | StreamMessage \<DefaultStreamChatGenerics > | The message to select, if called with undefined , it deselects the message |
Returns
void
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:1042
sendAction
▸ sendAction(messageId
, formData
, parentMessageId?
): Promise
\<void
>
Runs a message action in the current channel. Updates the message list based on the action result (if no message is returned, the message will be removed from the message list).
Parameters
Name | Type |
---|---|
messageId | string |
formData | Record \<string , string > |
parentMessageId? | string |
Returns
Promise
\<void
>
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:1005
sendMessage
▸ sendMessage(text
, attachments?
, mentionedUsers?
, parentId?
, quotedMessageId?
, customData?
): Promise
\<StreamMessage
\<T
>>
Sends a message to the active channel. The message is immediately added to the message list, if an error occurs and the message can't be sent, the error is indicated in state
of the message.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
text | string | undefined | The text of the message |
attachments | Attachment \<T >[] | [] | The attachments |
mentionedUsers | UserResponse \<T >[] | [] | Mentioned users |
parentId | undefined | string | undefined | Id of the parent message (if sending a thread reply) |
quotedMessageId | undefined | string | undefined | Id of the message to quote (if sending a quote reply) |
customData | undefined | Partial \<T ["messageType" ]> | undefined |
Returns
Promise
\<StreamMessage
\<T
>>
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:773
setAsActiveChannel
▸ setAsActiveChannel(channel
): void
Sets the given channel
as active and marks it as read.
If the channel wasn't previously part of the channel, it will be added to the beginning of the list.
Parameters
Name | Type |
---|---|
channel | Channel \<T > |
Returns
void
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:517
setAsActiveParentMessage
▸ setAsActiveParentMessage(message
, loadMessagesForm?
): Promise
\<void
>
Sets the given message
as an active parent message. If undefined
is provided, it will deleselect the current parent message.
Parameters
Name | Type | Default value |
---|---|---|
message | undefined | StreamMessage \<T > | undefined |
loadMessagesForm | "state" | "request" | 'request' |
Returns
Promise
\<void
>
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:575
typingStarted
▸ typingStarted(parentId?
): Promise
\<void
>
Call this method if user started typing in the active channel
Parameters
Name | Type | Description |
---|---|---|
parentId? | string | The id of the parent message, if user is typing in a thread |
Returns
Promise
\<void
>
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:1496
typingStopped
▸ typingStopped(parentId?
): Promise
\<void
>
Call this method if user stopped typing in the active channel
Parameters
Name | Type | Description |
---|---|---|
parentId? | string | The id of the parent message, if user were typing in a thread |
Returns
Promise
\<void
>
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:1505
unpinMessage
▸ unpinMessage(message
): Promise
\<void
>
Removes the given message from pinned messages
Parameters
Name | Type |
---|---|
message | StreamMessage \<DefaultStreamChatGenerics > |
Returns
Promise
\<void
>
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:1195
updateMessage
▸ updateMessage(message
): Promise
\<StreamMessage
\<T
> | T
["messageType"
] & {} & {} & {} & Omit
\<MessageResponse
\<{}>, "status"
| "created_at"
| "pinned_at"
| "updated_at"
> & UR
& {}>
Updates the message in the active channel
Parameters
Name | Type | Description |
---|---|---|
message | StreamMessage \<T > | Mesage to be updated |
Returns
Promise
\<StreamMessage
\<T
> | T
["messageType"
] & {} & {} & {} & Omit
\<MessageResponse
\<{}>, "status"
| "created_at"
| "pinned_at"
| "updated_at"
> & UR
& {}>
Defined in
projects/stream-chat-angular/src/lib/channel.service.ts:829
uploadAttachments
▸ uploadAttachments(uploads
): Promise
\<AttachmentUpload
\<DefaultStreamChatGenerics
>[]>
Uploads files to the channel. If you want to know more about file uploads check out the platform documentation.
Parameters
Name | Type | Description |
---|---|---|
uploads | AttachmentUpload \<DefaultStreamChatGenerics >[] | the attachments to upload (output of the AttachmentService ) |
Returns
Promise
\<AttachmentUpload
\<DefaultStreamChatGenerics
>[]>
the result of file upload requests