stream-chat 9.50.2 → 10.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.browser.js +18869 -13986
- package/dist/cjs/index.browser.js.map +4 -4
- package/dist/cjs/index.node.js +18888 -13992
- package/dist/cjs/index.node.js.map +4 -4
- package/dist/esm/index.mjs +18866 -13983
- package/dist/esm/index.mjs.map +4 -4
- package/dist/types/ChannelPaginatorsOrchestrator.d.ts +130 -0
- package/dist/types/EventHandlerPipeline.d.ts +104 -0
- package/dist/types/api-client.d.ts +26 -0
- package/dist/types/campaign.d.ts +0 -44
- package/dist/types/channel.d.ts +436 -480
- package/dist/types/channel_batch_updater.d.ts +0 -93
- package/dist/types/channel_manager.d.ts +8 -10
- package/dist/types/channel_state.d.ts +53 -201
- package/dist/types/client.d.ts +440 -1910
- package/dist/types/client_state.d.ts +4 -4
- package/dist/types/configuration/InstanceConfigurationService.d.ts +26 -0
- package/dist/types/configuration/index.d.ts +1 -0
- package/dist/types/configuration/types.d.ts +53 -0
- package/dist/types/connection.d.ts +49 -41
- package/dist/types/connection_fallback.d.ts +6 -4
- package/dist/types/constants.d.ts +0 -4
- package/dist/types/custom_types.d.ts +2 -0
- package/dist/types/errors.d.ts +2 -2
- package/dist/types/gen/chat/ChannelApi.d.ts +45 -0
- package/dist/types/gen/chat/ChatApi.d.ts +334 -0
- package/dist/types/gen/model-decoders/decoders.d.ts +3 -0
- package/dist/types/gen/model-decoders/event-decoder-mapping.d.ts +6 -0
- package/dist/types/gen/models/index.d.ts +8836 -0
- package/dist/types/gen/moderation/ModerationApi.d.ts +50 -0
- package/dist/types/gen-imports.d.ts +3 -0
- package/dist/types/index.d.ts +5 -5
- package/dist/types/insights.d.ts +7 -6
- package/dist/types/logger.d.ts +9 -0
- package/dist/types/messageComposer/LocationComposer.d.ts +7 -4
- package/dist/types/messageComposer/attachmentIdentity.d.ts +2 -2
- package/dist/types/messageComposer/attachmentManager.d.ts +8 -4
- package/dist/types/messageComposer/configuration/types.d.ts +11 -11
- package/dist/types/messageComposer/linkPreviewsManager.d.ts +25 -13
- package/dist/types/messageComposer/messageComposer.d.ts +10 -10
- package/dist/types/messageComposer/middleware/messageComposer/types.d.ts +3 -3
- package/dist/types/messageComposer/middleware/pollComposer/types.d.ts +4 -7
- package/dist/types/messageComposer/middleware/textComposer/commandUtils.d.ts +3 -3
- package/dist/types/messageComposer/middleware/textComposer/commands.d.ts +7 -7
- package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +218 -4
- package/dist/types/messageComposer/middleware/textComposer/types.d.ts +9 -4
- package/dist/types/messageComposer/pollComposer.d.ts +5 -4
- package/dist/types/messageComposer/textComposer.d.ts +8 -3
- package/dist/types/messageComposer/types.d.ts +6 -28
- package/dist/types/messageDelivery/MessageDeliveryReporter.d.ts +40 -25
- package/dist/types/messageDelivery/MessageReceiptsTracker.d.ts +53 -12
- package/dist/types/messageOperations/MessageOperationStatePolicy.d.ts +19 -0
- package/dist/types/messageOperations/MessageOperations.d.ts +17 -0
- package/dist/types/messageOperations/index.d.ts +3 -0
- package/dist/types/messageOperations/types.d.ts +49 -0
- package/dist/types/moderation.d.ts +21 -203
- package/dist/types/notifications/types.d.ts +8 -7
- package/dist/types/offline-support/offline_support_api.d.ts +110 -87
- package/dist/types/offline-support/types.d.ts +19 -23
- package/dist/types/offline-support/util.d.ts +4 -2
- package/dist/types/pagination/FilterBuilder.d.ts +1 -1
- package/dist/types/pagination/ItemIndex.d.ts +82 -0
- package/dist/types/pagination/cursorDerivation/createdAtAroundPaginationFlags.d.ts +9 -0
- package/dist/types/pagination/cursorDerivation/idAroundPaginationFlags.d.ts +6 -0
- package/dist/types/pagination/cursorDerivation/index.d.ts +1 -0
- package/dist/types/pagination/cursorDerivation/linearPaginationFlags.d.ts +6 -0
- package/dist/types/pagination/filterCompiler.d.ts +7 -0
- package/dist/types/pagination/index.d.ts +1 -3
- package/dist/types/pagination/paginators/BasePaginator.d.ts +709 -0
- package/dist/types/pagination/paginators/ChannelPaginator.d.ts +58 -0
- package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +260 -0
- package/dist/types/pagination/paginators/MessagePaginator.d.ts +208 -0
- package/dist/types/pagination/paginators/PinnedMessagePaginator.d.ts +39 -0
- package/dist/types/pagination/paginators/ReminderPaginator.d.ts +19 -0
- package/dist/types/pagination/paginators/UserGroupPaginator.d.ts +24 -0
- package/dist/types/pagination/paginators/index.d.ts +7 -0
- package/dist/types/pagination/sortCompiler.d.ts +49 -0
- package/dist/types/pagination/types.normalization.d.ts +11 -0
- package/dist/types/pagination/utility.normalization.d.ts +18 -0
- package/dist/types/pagination/utility.queryChannel.d.ts +26 -0
- package/dist/types/pagination/utility.search.d.ts +13 -0
- package/dist/types/permissions.d.ts +1 -1
- package/dist/types/poll.d.ts +29 -32
- package/dist/types/poll_manager.d.ts +2 -2
- package/dist/types/reminders/Reminder.d.ts +2 -5
- package/dist/types/reminders/ReminderManager.d.ts +2 -9
- package/dist/types/search/MessageSearchSource.d.ts +4 -4
- package/dist/types/search/UserSearchSource.d.ts +1 -1
- package/dist/types/search/types.d.ts +3 -3
- package/dist/types/segment.d.ts +0 -34
- package/dist/types/signing.d.ts +105 -65
- package/dist/types/store.d.ts +1 -0
- package/dist/types/thread.d.ts +51 -34
- package/dist/types/thread_manager.d.ts +3 -3
- package/dist/types/token_manager.d.ts +15 -10
- package/dist/types/types.d.ts +196 -3384
- package/dist/types/utils/FixedSizeQueueCache.d.ts +12 -6
- package/dist/types/utils/WithSubscriptions.d.ts +2 -1
- package/dist/types/utils/concurrency.d.ts +4 -4
- package/dist/types/utils/mergeWith/mergeWith.d.ts +3 -3
- package/dist/types/utils/mergeWith/mergeWithCore.d.ts +8 -3
- package/dist/types/utils/retryable.d.ts +34 -0
- package/dist/types/utils.d.ts +104 -137
- package/package.json +7 -3
- package/src/ChannelPaginatorsOrchestrator.ts +545 -0
- package/src/CooldownTimer.ts +2 -2
- package/src/EventHandlerPipeline.ts +228 -0
- package/src/LiveLocationManager.ts +12 -11
- package/src/api-client.ts +275 -0
- package/src/campaign.ts +1 -77
- package/src/channel.ts +1262 -1277
- package/src/channel_batch_updater.ts +1 -211
- package/src/channel_manager.ts +92 -88
- package/src/channel_state.ts +144 -1013
- package/src/client.ts +888 -3944
- package/src/client_state.ts +4 -4
- package/src/configuration/InstanceConfigurationService.ts +73 -0
- package/src/configuration/index.ts +1 -0
- package/src/configuration/types.ts +81 -0
- package/src/connection.ts +145 -94
- package/src/connection_fallback.ts +29 -27
- package/src/constants.ts +1 -5
- package/src/custom_types.ts +4 -1
- package/src/errors.ts +2 -2
- package/src/gen/chat/ChannelApi.ts +275 -0
- package/src/gen/chat/ChatApi.ts +2554 -0
- package/src/gen/model-decoders/decoders.ts +2680 -0
- package/src/gen/model-decoders/event-decoder-mapping.ts +198 -0
- package/src/gen/models/index.ts +12673 -0
- package/src/gen/moderation/ModerationApi.ts +607 -0
- package/src/gen-imports.ts +3 -0
- package/src/index.ts +5 -10
- package/src/insights.ts +6 -5
- package/src/logger.ts +28 -0
- package/src/messageComposer/LocationComposer.ts +9 -5
- package/src/messageComposer/MessageComposerEffectHandlers.ts +1 -0
- package/src/messageComposer/attachmentIdentity.ts +16 -9
- package/src/messageComposer/attachmentManager.ts +13 -8
- package/src/messageComposer/configuration/types.ts +11 -11
- package/src/messageComposer/linkPreviewsManager.ts +9 -10
- package/src/messageComposer/messageComposer.ts +57 -53
- package/src/messageComposer/middleware/messageComposer/attachments.ts +1 -2
- package/src/messageComposer/middleware/messageComposer/cleanData.ts +1 -1
- package/src/messageComposer/middleware/messageComposer/compositionValidation.ts +2 -2
- package/src/messageComposer/middleware/messageComposer/messageComposerState.ts +2 -2
- package/src/messageComposer/middleware/messageComposer/sharedLocation.ts +4 -3
- package/src/messageComposer/middleware/messageComposer/textComposer.ts +2 -2
- package/src/messageComposer/middleware/messageComposer/types.ts +3 -4
- package/src/messageComposer/middleware/messageComposer/userDataInjection.ts +9 -5
- package/src/messageComposer/middleware/pollComposer/state.ts +0 -2
- package/src/messageComposer/middleware/pollComposer/types.ts +4 -7
- package/src/messageComposer/middleware/textComposer/TextComposerMiddlewareExecutor.ts +10 -1
- package/src/messageComposer/middleware/textComposer/commandEffects.ts +4 -4
- package/src/messageComposer/middleware/textComposer/commandUtils.ts +3 -6
- package/src/messageComposer/middleware/textComposer/commands.ts +3 -3
- package/src/messageComposer/middleware/textComposer/mentionUtils.ts +1 -1
- package/src/messageComposer/middleware/textComposer/mentions.ts +31 -15
- package/src/messageComposer/middleware/textComposer/types.ts +9 -4
- package/src/messageComposer/pollComposer.ts +6 -8
- package/src/messageComposer/textComposer.ts +27 -2
- package/src/messageComposer/types.ts +6 -28
- package/src/messageDelivery/MessageDeliveryReporter.ts +101 -45
- package/src/messageDelivery/MessageReceiptsTracker.ts +294 -21
- package/src/messageOperations/MessageOperationStatePolicy.ts +77 -0
- package/src/messageOperations/MessageOperations.ts +212 -0
- package/src/messageOperations/index.ts +10 -0
- package/src/messageOperations/types.ts +64 -0
- package/src/moderation.ts +38 -431
- package/src/notifications/types.ts +8 -7
- package/src/offline-support/offline_support_api.ts +198 -132
- package/src/offline-support/offline_sync_manager.ts +17 -7
- package/src/offline-support/types.ts +23 -26
- package/src/offline-support/util.ts +5 -4
- package/src/pagination/FilterBuilder.ts +4 -1
- package/src/pagination/ItemIndex.ts +112 -0
- package/src/pagination/cursorDerivation/createdAtAroundPaginationFlags.ts +73 -0
- package/src/pagination/cursorDerivation/idAroundPaginationFlags.ts +53 -0
- package/src/pagination/cursorDerivation/index.ts +1 -0
- package/src/pagination/cursorDerivation/linearPaginationFlags.ts +86 -0
- package/src/pagination/filterCompiler.ts +196 -0
- package/src/pagination/index.ts +1 -3
- package/src/pagination/paginators/BasePaginator.ts +2393 -0
- package/src/pagination/paginators/ChannelPaginator.ts +427 -0
- package/src/pagination/paginators/MessageIntervalPaginator.ts +1073 -0
- package/src/pagination/paginators/MessagePaginator.ts +496 -0
- package/src/pagination/paginators/PinnedMessagePaginator.ts +105 -0
- package/src/pagination/paginators/ReminderPaginator.ts +105 -0
- package/src/pagination/paginators/UserGroupPaginator.ts +125 -0
- package/src/pagination/paginators/index.ts +7 -0
- package/src/pagination/sortCompiler.ts +178 -0
- package/src/pagination/types.normalization.ts +14 -0
- package/src/pagination/utility.normalization.ts +106 -0
- package/src/pagination/utility.queryChannel.ts +84 -0
- package/src/pagination/utility.search.ts +80 -0
- package/src/permissions.ts +7 -8
- package/src/poll.ts +101 -110
- package/src/poll_manager.ts +14 -8
- package/src/reminders/Reminder.ts +2 -5
- package/src/reminders/ReminderManager.ts +19 -21
- package/src/search/BaseSearchSource.ts +0 -3
- package/src/search/ChannelMemberSearchSource.ts +7 -1
- package/src/search/ChannelSearchSource.ts +10 -3
- package/src/search/MessageSearchSource.ts +29 -30
- package/src/search/UserSearchSource.ts +12 -8
- package/src/search/types.ts +3 -4
- package/src/segment.ts +1 -95
- package/src/signing.ts +107 -67
- package/src/store.ts +2 -1
- package/src/thread.ts +439 -236
- package/src/thread_manager.ts +36 -15
- package/src/token_manager.ts +21 -10
- package/src/types.ts +375 -4524
- package/src/uploadManager.ts +8 -0
- package/src/utils/FixedSizeQueueCache.ts +12 -6
- package/src/utils/WithSubscriptions.ts +2 -1
- package/src/utils/concurrency.ts +4 -4
- package/src/utils/mergeWith/mergeWith.ts +3 -3
- package/src/utils/mergeWith/mergeWithCore.ts +140 -164
- package/src/utils/mergeWith/mergeWithDiff.ts +3 -3
- package/src/utils/retryable.ts +117 -0
- package/src/utils.ts +133 -524
- package/dist/types/events.d.ts +0 -72
- package/dist/types/pagination/BasePaginator.d.ts +0 -69
- package/dist/types/pagination/ReminderPaginator.d.ts +0 -16
- package/dist/types/pagination/UserGroupPaginator.d.ts +0 -21
- package/src/events.ts +0 -75
- package/src/pagination/BasePaginator.ts +0 -184
- package/src/pagination/ReminderPaginator.ts +0 -56
- package/src/pagination/UserGroupPaginator.ts +0 -93
package/dist/types/channel.d.ts
CHANGED
|
@@ -3,26 +3,79 @@ import { ChannelState } from './channel_state';
|
|
|
3
3
|
import { CooldownTimer } from './CooldownTimer';
|
|
4
4
|
import { MessageComposer } from './messageComposer';
|
|
5
5
|
import { MessageReceiptsTracker } from './messageDelivery';
|
|
6
|
+
import { MessagePaginator, PinnedMessagePaginator } from './pagination/paginators';
|
|
7
|
+
import { MessageOperations } from './messageOperations';
|
|
6
8
|
import type { StreamChat } from './client';
|
|
7
|
-
import type { AIState, APIResponse,
|
|
8
|
-
import type {
|
|
9
|
+
import type { AIState, APIResponse, BanUserOptions, ChannelData, ChannelGetOrCreateRequest, ChannelMemberResponse, ChannelResponse, ChannelStateResponseFields, ChannelUpdateOptions, CreateDraftResponse, DeleteMessageOptions, Event, EventAPIResponse, EventHandler, EventPayload, EventType, GetRepliesAPIResponse, GetRepliesRequest, LocalMessage, MarkReadRequest, MarkUnreadRequest, MessageRequest, MessageResponse, MessageSetType, PinnedMessagePaginationOptions, PinnedMessagesSort, QueryMembersPayload, ReactionAPIResponse, SearchPayload, SendMessageOptions, SharedLocation, UnBanUserOptions, UpdateChannelPartialRequest, UpdateLiveLocationRequest, UpdateMessageOptions, UserResponse } from './types';
|
|
10
|
+
import type { RoleName } from './permissions';
|
|
11
|
+
import { StateStore } from './store';
|
|
12
|
+
import type { ChannelMemberRequest as Gen_ChannelMemberRequest, ChannelPushPreferencesResponse as Gen_ChannelPushPreferencesResponse, ChannelStopWatchingRequest as Gen_ChannelStopWatchingRequest, CreateDraftRequest as Gen_CreateDraftRequest, HideChannelRequest as Gen_HideChannelRequest, MuteChannelRequest as Gen_MuteChannelRequest, SendMessageRequest as Gen_SendMessageRequest, ShowChannelRequest as Gen_ShowChannelRequest, UnmuteChannelRequest as Gen_UnmuteChannelRequest, UpdateChannelRequest as Gen_UpdateChannelRequest, WSEvent } from './gen/models';
|
|
13
|
+
import type { ChatApi } from './gen/chat/ChatApi';
|
|
14
|
+
import { ChannelApi } from './gen/chat/ChannelApi';
|
|
15
|
+
export type SendMessageWithStateUpdateParams = {
|
|
16
|
+
localMessage: LocalMessage;
|
|
17
|
+
message?: MessageRequest;
|
|
18
|
+
options?: SendMessageOptions;
|
|
19
|
+
/**
|
|
20
|
+
* Per-call override for the send/retry request (advanced).
|
|
21
|
+
* If set, it takes precedence over channel instance configuration handlers.
|
|
22
|
+
*/
|
|
23
|
+
sendMessageRequestFn?: CustomSendMessageRequestFn;
|
|
24
|
+
};
|
|
25
|
+
export type RetrySendMessageWithLocalUpdateParams = Omit<SendMessageWithStateUpdateParams, 'message'>;
|
|
26
|
+
export type UpdateMessageWithStateUpdateParams = {
|
|
27
|
+
localMessage: LocalMessage;
|
|
28
|
+
options?: UpdateMessageOptions;
|
|
29
|
+
/**
|
|
30
|
+
* Per-call override for the update request (advanced).
|
|
31
|
+
* If set, it takes precedence over channel instance configuration handlers.
|
|
32
|
+
*/
|
|
33
|
+
updateMessageRequestFn?: CustomUpdateMessageRequestFn;
|
|
34
|
+
};
|
|
35
|
+
export type DeleteMessageWithStateUpdateParams = {
|
|
36
|
+
localMessage: LocalMessage;
|
|
37
|
+
options?: DeleteMessageOptions;
|
|
38
|
+
/**
|
|
39
|
+
* Per-call override for the delete request (advanced).
|
|
40
|
+
* If set, it takes precedence over channel instance configuration handlers.
|
|
41
|
+
*/
|
|
42
|
+
deleteMessageRequestFn?: CustomDeleteMessageRequestFn;
|
|
43
|
+
};
|
|
44
|
+
export type CustomSendMessageRequestFn = (params: Omit<SendMessageWithStateUpdateParams, 'sendMessageRequestFn'>) => Promise<{
|
|
45
|
+
message: MessageResponse;
|
|
46
|
+
}>;
|
|
47
|
+
export type CustomUpdateMessageRequestFn = (params: Omit<UpdateMessageWithStateUpdateParams, 'updateMessageRequestFn'>) => Promise<{
|
|
48
|
+
message: MessageResponse;
|
|
49
|
+
}>;
|
|
50
|
+
export type CustomDeleteMessageRequestFn = (params: Omit<DeleteMessageWithStateUpdateParams, 'deleteMessageRequestFn'>) => Promise<{
|
|
51
|
+
message: MessageResponse;
|
|
52
|
+
}>;
|
|
53
|
+
export type CustomMarkReadRequestFn = (params: {
|
|
54
|
+
channel: Channel;
|
|
55
|
+
options?: MarkReadRequest;
|
|
56
|
+
}) => Promise<EventAPIResponse | null>;
|
|
57
|
+
export type ChannelInstanceConfig = {
|
|
58
|
+
requestHandlers?: {
|
|
59
|
+
deleteMessageRequest?: CustomDeleteMessageRequestFn;
|
|
60
|
+
markReadRequest?: CustomMarkReadRequestFn;
|
|
61
|
+
sendMessageRequest?: CustomSendMessageRequestFn;
|
|
62
|
+
retrySendMessageRequest?: CustomSendMessageRequestFn;
|
|
63
|
+
updateMessageRequest?: CustomUpdateMessageRequestFn;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
9
66
|
/**
|
|
10
|
-
*
|
|
67
|
+
* The Channel class manages its own state.
|
|
11
68
|
*/
|
|
12
|
-
export declare class Channel {
|
|
69
|
+
export declare class Channel extends ChannelApi {
|
|
13
70
|
_client: StreamChat;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
data: Partial<ChannelData & ChannelResponse> | undefined;
|
|
17
|
-
_data: Partial<ChannelData & ChannelResponse>;
|
|
71
|
+
data: Partial<ChannelResponse> | undefined;
|
|
72
|
+
_data: ChannelData;
|
|
18
73
|
cid: string;
|
|
19
74
|
/** */
|
|
20
|
-
listeners:
|
|
21
|
-
[key: string]: (string | EventHandler)[];
|
|
22
|
-
};
|
|
75
|
+
listeners: Map<EventType, Set<EventHandler>>;
|
|
23
76
|
state: ChannelState;
|
|
24
77
|
/**
|
|
25
|
-
* This boolean is a vague indication of
|
|
78
|
+
* This boolean is a vague indication of whether the channel exists on chat backend.
|
|
26
79
|
*
|
|
27
80
|
* If the value is true, then that means the channel has been initialized by either calling
|
|
28
81
|
* channel.create() or channel.query() or channel.watch().
|
|
@@ -32,7 +85,7 @@ export declare class Channel {
|
|
|
32
85
|
*/
|
|
33
86
|
initialized: boolean;
|
|
34
87
|
/**
|
|
35
|
-
* Indicates
|
|
88
|
+
* Indicates whether channel has been initialized by manually populating the state with some messages, members etc.
|
|
36
89
|
* Static state indicates that channel exists on backend, but is not being watched yet.
|
|
37
90
|
*/
|
|
38
91
|
offlineMode: boolean;
|
|
@@ -40,410 +93,345 @@ export declare class Channel {
|
|
|
40
93
|
lastTypingEvent: Date | null;
|
|
41
94
|
isTyping: boolean;
|
|
42
95
|
disconnected: boolean;
|
|
43
|
-
push_preferences?:
|
|
96
|
+
push_preferences?: Gen_ChannelPushPreferencesResponse;
|
|
97
|
+
readonly configState: StateStore<ChannelInstanceConfig>;
|
|
44
98
|
readonly messageComposer: MessageComposer;
|
|
45
99
|
readonly messageReceiptsTracker: MessageReceiptsTracker;
|
|
100
|
+
readonly messagePaginator: MessagePaginator;
|
|
101
|
+
readonly pinnedMessagesPaginator: PinnedMessagePaginator;
|
|
102
|
+
readonly messageOperations: MessageOperations;
|
|
46
103
|
readonly cooldownTimer: CooldownTimer;
|
|
47
104
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* @param {StreamChat} client the chat client
|
|
51
|
-
* @param {string} type the type of channel
|
|
52
|
-
* @param {string} [id] the id of the chat
|
|
53
|
-
* @param {ChannelData} data any additional custom params
|
|
105
|
+
* Creates a `Channel` instance bound to the given chat client.
|
|
54
106
|
*
|
|
55
|
-
* @
|
|
107
|
+
* @param client - The chat client.
|
|
108
|
+
* @param type - The type of channel.
|
|
109
|
+
* @param id - The ID of the chat (optional).
|
|
110
|
+
* @param data - Any additional custom params.
|
|
111
|
+
* @returns A new uninitialized channel.
|
|
56
112
|
*/
|
|
57
113
|
constructor(client: StreamChat, type: string, id: string | undefined, data: ChannelData);
|
|
58
114
|
/**
|
|
59
|
-
*
|
|
115
|
+
* Returns the chat client for this channel. Throws if `client.disconnect()` was called.
|
|
60
116
|
*
|
|
61
|
-
* @
|
|
117
|
+
* @returns The chat client.
|
|
62
118
|
*/
|
|
63
119
|
getClient(): StreamChat;
|
|
64
120
|
/**
|
|
65
|
-
*
|
|
121
|
+
* Returns the config for this channel ID (CID).
|
|
66
122
|
*
|
|
67
|
-
* @
|
|
123
|
+
* @returns The channel config.
|
|
68
124
|
*/
|
|
69
|
-
getConfig(): import("
|
|
125
|
+
getConfig(): import(".").ChannelConfigWithInfo | undefined;
|
|
126
|
+
_sendMessage(request: Gen_SendMessageRequest): Promise<import("./types").StreamResponse<import(".").SendMessageResponse>>;
|
|
70
127
|
/**
|
|
71
|
-
*
|
|
128
|
+
* Sends a message to this channel.
|
|
72
129
|
*
|
|
73
|
-
* @param
|
|
74
|
-
*
|
|
75
|
-
* @
|
|
76
|
-
* @param {boolean} [options.is_pending_message] DEPRECATED, please use `pending` instead.
|
|
77
|
-
* @param {boolean} [options.pending] Make this message pending
|
|
78
|
-
* @param {Record<string,string>} [options.pending_message_metadata] Metadata for the pending message
|
|
79
|
-
* @param {boolean} [options.force_moderation] Apply force moderation for server-side requests
|
|
80
|
-
*
|
|
81
|
-
* @return {Promise<SendMessageAPIResponse>} The Server Response
|
|
130
|
+
* @param request - The send message request payload, including the message body and optional flags
|
|
131
|
+
* such as `skip_enrich_url`, `skip_push`, and `keep_channel_hidden`.
|
|
132
|
+
* @returns The server response.
|
|
82
133
|
*/
|
|
83
|
-
|
|
84
|
-
sendMessage(message: Message, options?: SendMessageOptions): Promise<SendMessageAPIResponse>;
|
|
134
|
+
sendMessage(request: Gen_SendMessageRequest): Promise<import("./types").StreamResponse<import(".").SendMessageResponse>>;
|
|
85
135
|
/**
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* @param uri File source: URL string, `File`, `Buffer`, or readable stream (Node).
|
|
89
|
-
* @param name File name sent in the multipart body.
|
|
90
|
-
* @param contentType MIME type; defaults are applied when omitted.
|
|
91
|
-
* @param user Optional user payload appended to the form as JSON.
|
|
92
|
-
* @param axiosRequestConfig Optional Axios per-request config, merged after upload defaults (e.g. `onUploadProgress`, `signal` from `AbortController`).
|
|
93
|
-
* @return Promise resolving to `{ file: string, ... }` with the CDN URL.
|
|
136
|
+
* Sends a message with optimistic local state update.
|
|
94
137
|
*/
|
|
95
|
-
|
|
138
|
+
sendMessageWithLocalUpdate(params: SendMessageWithStateUpdateParams): Promise<void>;
|
|
96
139
|
/**
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* @param uri Image source: URL string, `File`, or readable stream (Node). For `Buffer` uploads, use `sendFile` toward the channel file endpoint instead.
|
|
100
|
-
* @param name File name sent in the multipart body.
|
|
101
|
-
* @param contentType MIME type.
|
|
102
|
-
* @param user Optional user payload appended to the form as JSON.
|
|
103
|
-
* @param axiosRequestConfig Optional Axios per-request config, merged after upload defaults (e.g. `onUploadProgress`, `signal`).
|
|
104
|
-
* @return Promise resolving to `{ file: string, ... }` with the CDN URL.
|
|
140
|
+
* Retry sending a failed message.
|
|
105
141
|
*/
|
|
106
|
-
|
|
107
|
-
deleteFile(url: string): Promise<APIResponse>;
|
|
108
|
-
deleteImage(url: string): Promise<APIResponse>;
|
|
142
|
+
retrySendMessageWithLocalUpdate(params: Omit<SendMessageWithStateUpdateParams, 'message'>): Promise<void>;
|
|
109
143
|
/**
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
* @param {Event} event for example {type: 'message.read'}
|
|
113
|
-
*
|
|
114
|
-
* @return {Promise<EventAPIResponse>} The Server Response
|
|
144
|
+
* Updates a message with optimistic local state update.
|
|
115
145
|
*/
|
|
116
|
-
|
|
146
|
+
updateMessageWithLocalUpdate(params: UpdateMessageWithStateUpdateParams): Promise<void>;
|
|
117
147
|
/**
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
* @param {MessageFilters | string} query search query or object MongoDB style filters
|
|
121
|
-
* @param {{client_id?: string; connection_id?: string; query?: string; message_filter_conditions?: MessageFilters}} options Option object, {user_id: 'tommaso'}
|
|
122
|
-
*
|
|
123
|
-
* @return {Promise<SearchAPIResponse>} search messages response
|
|
148
|
+
* Deletes a message with local state update.
|
|
124
149
|
*/
|
|
125
|
-
|
|
126
|
-
client_id?: string;
|
|
127
|
-
connection_id?: string;
|
|
128
|
-
message_filter_conditions?: MessageFilters;
|
|
129
|
-
message_options?: MessageOptions;
|
|
130
|
-
query?: string;
|
|
131
|
-
}): Promise<SearchAPIResponse>;
|
|
150
|
+
deleteMessageWithLocalUpdate(params: DeleteMessageWithStateUpdateParams): Promise<void>;
|
|
132
151
|
/**
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
* @param {MemberFilters} filterConditions object MongoDB style filters
|
|
136
|
-
* @param {MemberSort} [sort] Sort options, for instance [{created_at: -1}].
|
|
137
|
-
* When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{name: -1}, {created_at: 1}]
|
|
138
|
-
* @param {{ limit?: number; offset?: number }} [options] Option object, {limit: 10, offset:10}
|
|
152
|
+
* Upload a file to this channel’s file endpoint (multipart). Forwards to the client’s `sendFile` implementation.
|
|
139
153
|
*
|
|
140
|
-
* @
|
|
154
|
+
* @param uri - File source: URL string, `File`, `Buffer`, or readable stream (Node).
|
|
155
|
+
* @param name - File name sent in the multipart body (optional).
|
|
156
|
+
* @param contentType - MIME type; defaults are applied when omitted (optional).
|
|
157
|
+
* @param user - User payload appended to the form as JSON (optional).
|
|
158
|
+
* @param axiosRequestConfig - Axios per-request config, merged after upload defaults, e.g. `onUploadProgress`, `signal` from `AbortController` (optional).
|
|
159
|
+
* @returns A promise resolving to `{ file: string, ... }` with the CDN URL.
|
|
141
160
|
*/
|
|
142
|
-
|
|
161
|
+
sendFile(uri: string | NodeJS.ReadableStream | Buffer | File, name?: string, contentType?: string, user?: UserResponse, axiosRequestConfig?: AxiosRequestConfig): Promise<import("./types").SendFileAPIResponse>;
|
|
143
162
|
/**
|
|
144
|
-
*
|
|
163
|
+
* Upload an image to this channel's image endpoint (multipart). Uses the same transport as `sendFile`.
|
|
145
164
|
*
|
|
146
|
-
* @param
|
|
147
|
-
* @param
|
|
148
|
-
|
|
149
|
-
* @
|
|
165
|
+
* @param uri - Image source: URL string, `File`, or readable stream (Node). For `Buffer` uploads, use `sendFile` toward the channel file endpoint instead.
|
|
166
|
+
* @param name - File name sent in the multipart body (optional).
|
|
167
|
+
* @param contentType - MIME type (optional).
|
|
168
|
+
* @param user - User payload appended to the form as JSON (optional).
|
|
169
|
+
* @param axiosRequestConfig - Axios per-request config, merged after upload defaults, e.g. `onUploadProgress`, `signal` (optional).
|
|
170
|
+
* @returns A promise resolving to `{ file: string, ... }` with the CDN URL.
|
|
150
171
|
*/
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
172
|
+
sendImage(uri: string | NodeJS.ReadableStream | File, name?: string, contentType?: string, user?: UserResponse, axiosRequestConfig?: AxiosRequestConfig): Promise<import("./types").SendFileAPIResponse>;
|
|
173
|
+
deleteFile(url: string): Promise<import("./types").StreamResponse<import(".").Response>>;
|
|
174
|
+
deleteImage(url: string): Promise<import("./types").StreamResponse<import(".").Response>>;
|
|
154
175
|
/**
|
|
155
|
-
*
|
|
156
|
-
* partialUpdateMember - Partial update a member
|
|
176
|
+
* Sends an event on this channel.
|
|
157
177
|
*
|
|
158
|
-
* @param {
|
|
159
|
-
* @
|
|
160
|
-
*
|
|
161
|
-
* @return {Promise<ChannelMemberResponse>} Updated member
|
|
178
|
+
* @param event - For example `{ type: 'message.read' }`.
|
|
179
|
+
* @returns The server response.
|
|
162
180
|
*/
|
|
163
|
-
|
|
181
|
+
sendEvent(request: {
|
|
182
|
+
event: Event;
|
|
183
|
+
}): Promise<import("./types").StreamResponse<import(".").EventResponse>>;
|
|
164
184
|
/**
|
|
165
|
-
*
|
|
166
|
-
* that sending the reaction is queued up if it fails due to bad internet conditions and executed
|
|
167
|
-
* later.
|
|
168
|
-
*
|
|
169
|
-
* @param {string} messageID the message id
|
|
170
|
-
* @param {Reaction} reaction the reaction object for instance {type: 'love'}
|
|
171
|
-
* @param {{ enforce_unique?: boolean, skip_push?: boolean }} [options] Option object, {enforce_unique: true, skip_push: true} to override any existing reaction or skip sending push notifications
|
|
185
|
+
* Queries messages.
|
|
172
186
|
*
|
|
173
|
-
* @
|
|
187
|
+
* @param request - The search request payload (optional). The inner `payload` accepts
|
|
188
|
+
* MongoDB-style filters and additional options such as `user_id`.
|
|
189
|
+
* @returns The search messages response.
|
|
174
190
|
*/
|
|
175
|
-
|
|
191
|
+
search(request?: {
|
|
192
|
+
payload?: SearchPayload;
|
|
193
|
+
}): Promise<import("./types").StreamResponse<import(".").SearchResponse>>;
|
|
176
194
|
/**
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
* @param {string} messageID the message id
|
|
180
|
-
* @param {Reaction} reaction the reaction object for instance {type: 'love'}
|
|
181
|
-
* @param {{ enforce_unique?: boolean, skip_push?: boolean }} [options] Option object, {enforce_unique: true, skip_push: true} to override any existing reaction or skip sending push notifications
|
|
195
|
+
* Queries members.
|
|
182
196
|
*
|
|
183
|
-
* @
|
|
197
|
+
* @param request - The query members request payload (optional). The inner `payload` accepts
|
|
198
|
+
* MongoDB-style filters, sort directions (e.g. `[{ field: 'created_at', direction: -1 }]`),
|
|
199
|
+
* and pagination options (`limit`, `offset`).
|
|
200
|
+
* @returns The query members response.
|
|
184
201
|
*/
|
|
185
|
-
|
|
186
|
-
|
|
202
|
+
queryMembers(request?: {
|
|
203
|
+
payload?: Partial<QueryMembersPayload>;
|
|
204
|
+
}): Promise<import("./types").StreamResponse<import(".").MembersResponse>>;
|
|
187
205
|
/**
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
* @param {string} reactionType the type of reaction that should be removed
|
|
192
|
-
* @param {string} [user_id] the id of the user (used only for server side request) default null
|
|
206
|
+
* Sends a reaction to a message. If offline support is enabled, it will make sure
|
|
207
|
+
* that sending the reaction is queued up if it fails due to bad internet conditions and executed
|
|
208
|
+
* later.
|
|
193
209
|
*
|
|
194
|
-
* @
|
|
210
|
+
* @param request - The send-reaction request payload, including the target message ID, the
|
|
211
|
+
* reaction object (e.g. `{ type: 'love' }`), and optional flags such as `enforce_unique` and
|
|
212
|
+
* `skip_push`.
|
|
213
|
+
* @returns The server response.
|
|
195
214
|
*/
|
|
196
|
-
|
|
215
|
+
sendReaction(request: Parameters<ChatApi['sendReaction']>[0]): Promise<ReactionAPIResponse>;
|
|
216
|
+
_sendReaction(request: Parameters<ChatApi['sendReaction']>[0]): Promise<import("./types").StreamResponse<import(".").SendReactionResponse>>;
|
|
217
|
+
deleteReaction(request: Parameters<ChatApi['deleteReaction']>[0]): Promise<ReactionAPIResponse>;
|
|
197
218
|
/**
|
|
198
|
-
*
|
|
219
|
+
* Deletes a reaction by user and type.
|
|
199
220
|
*
|
|
200
|
-
* @param
|
|
201
|
-
* @
|
|
202
|
-
* @param {ChannelUpdateOptions} [options] Option object, configuration to control the behavior while updating
|
|
203
|
-
* @return {Promise<UpdateChannelAPIResponse>} The server response
|
|
221
|
+
* @param request - The delete reaction request payload identifying the target message and reaction type.
|
|
222
|
+
* @returns The server response.
|
|
204
223
|
*/
|
|
205
|
-
|
|
224
|
+
_deleteReaction(request: Parameters<ChatApi['deleteReaction']>[0]): Promise<import("./types").StreamResponse<import(".").DeleteReactionResponse>>;
|
|
206
225
|
/**
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
* @param {PartialUpdateChannel} partial update request
|
|
226
|
+
* Edit the channel using the inherited `update()` from `ChannelApi`. Caches the
|
|
227
|
+
* server-returned channel onto `this.data`.
|
|
210
228
|
*
|
|
211
|
-
* @
|
|
229
|
+
* @param request - Channel update payload, e.g. `{ data: { name: 'foo' }, message }` (optional).
|
|
230
|
+
* @returns The server response.
|
|
212
231
|
*/
|
|
213
|
-
|
|
232
|
+
update(request?: Gen_UpdateChannelRequest): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
|
|
214
233
|
/**
|
|
215
|
-
*
|
|
234
|
+
* Partial update of channel properties.
|
|
216
235
|
*
|
|
217
|
-
* @param
|
|
218
|
-
* @
|
|
236
|
+
* @param update - The partial update request.
|
|
237
|
+
* @returns The server response.
|
|
219
238
|
*/
|
|
220
|
-
|
|
239
|
+
updatePartial(update: UpdateChannelPartialRequest): Promise<import("./types").StreamResponse<import(".").UpdateChannelPartialResponse>>;
|
|
221
240
|
/**
|
|
222
|
-
*
|
|
241
|
+
* Enables slow mode.
|
|
223
242
|
*
|
|
224
|
-
* @
|
|
243
|
+
* @param coolDownInterval - The cooldown interval in seconds.
|
|
244
|
+
* @returns The server response.
|
|
225
245
|
*/
|
|
226
|
-
|
|
227
|
-
sendSharedLocation(location: StaticLocationPayload | LiveLocationPayload, userId?: string): Promise<SendMessageAPIResponse>;
|
|
228
|
-
stopLiveLocationSharing(payload: UpdateLocationPayload): Promise<void>;
|
|
246
|
+
enableSlowMode(coolDownInterval: number): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
|
|
229
247
|
/**
|
|
230
|
-
*
|
|
248
|
+
* Disables slow mode.
|
|
231
249
|
*
|
|
232
|
-
* @
|
|
233
|
-
*
|
|
234
|
-
* @return {Promise<DeleteChannelAPIResponse>} The server response
|
|
235
|
-
*/
|
|
236
|
-
delete(options?: {
|
|
237
|
-
hard_delete?: boolean;
|
|
238
|
-
}): Promise<DeleteChannelAPIResponse>;
|
|
239
|
-
/**
|
|
240
|
-
* truncate - Removes all messages from the channel
|
|
241
|
-
* @param {TruncateOptions} [options] Defines truncation options
|
|
242
|
-
* @return {Promise<TruncateChannelAPIResponse>} The server response
|
|
250
|
+
* @returns The server response.
|
|
243
251
|
*/
|
|
244
|
-
|
|
252
|
+
disableSlowMode(): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
|
|
253
|
+
sendSharedLocation(location: SharedLocation & {
|
|
254
|
+
message_id?: string;
|
|
255
|
+
}): Promise<import("./types").StreamResponse<import(".").SendMessageResponse>>;
|
|
256
|
+
stopLiveLocationSharing(payload: UpdateLiveLocationRequest): Promise<void>;
|
|
245
257
|
/**
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
* @param {UpdateChannelOptions} [options] The object to update the custom properties of this channel with
|
|
258
|
+
* Accepts an invitation to the channel.
|
|
249
259
|
*
|
|
250
|
-
* @
|
|
260
|
+
* @param options - The object to update the custom properties of this channel with (optional, defaults to `{}`).
|
|
261
|
+
* @returns The server response.
|
|
251
262
|
*/
|
|
252
|
-
acceptInvite(options?:
|
|
263
|
+
acceptInvite(options?: ChannelUpdateOptions): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
|
|
253
264
|
/**
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
* @param {UpdateChannelOptions} [options] The object to update the custom properties of this channel with
|
|
265
|
+
* Rejects an invitation to the channel.
|
|
257
266
|
*
|
|
258
|
-
* @
|
|
267
|
+
* @param options - The object to update the custom properties of this channel with (optional, defaults to `{}`).
|
|
268
|
+
* @returns The server response.
|
|
259
269
|
*/
|
|
260
|
-
rejectInvite(options?:
|
|
270
|
+
rejectInvite(options?: ChannelUpdateOptions): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
|
|
261
271
|
/**
|
|
262
|
-
*
|
|
272
|
+
* Adds members to the channel.
|
|
263
273
|
*
|
|
264
|
-
* @param
|
|
265
|
-
* @param
|
|
266
|
-
* @param
|
|
267
|
-
* @
|
|
274
|
+
* @param members - An array of members to add to the channel.
|
|
275
|
+
* @param message - Message object for channel members notification (optional).
|
|
276
|
+
* @param options - Configuration to control the behavior while updating (optional, defaults to `{}`).
|
|
277
|
+
* @returns The server response.
|
|
268
278
|
*/
|
|
269
|
-
addMembers(members: string[] | Array<
|
|
279
|
+
addMembers(members: string[] | Array<Gen_ChannelMemberRequest>, message?: MessageRequest, options?: ChannelUpdateOptions): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
|
|
270
280
|
/**
|
|
271
|
-
*
|
|
281
|
+
* Adds filter tags to the channel.
|
|
272
282
|
*
|
|
273
|
-
* @param
|
|
274
|
-
* @param
|
|
275
|
-
* @param
|
|
276
|
-
* @
|
|
283
|
+
* @param tags - An array of tags to add to the channel.
|
|
284
|
+
* @param message - Message object for channel members notification (optional).
|
|
285
|
+
* @param options - Configuration to control the behavior while updating (optional, defaults to `{}`).
|
|
286
|
+
* @returns The server response.
|
|
277
287
|
*/
|
|
278
|
-
addFilterTags(tags: string[], message?:
|
|
288
|
+
addFilterTags(tags: string[], message?: MessageRequest, options?: ChannelUpdateOptions): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
|
|
279
289
|
/**
|
|
280
|
-
*
|
|
290
|
+
* Removes filter tags from the channel.
|
|
281
291
|
*
|
|
282
|
-
* @param
|
|
283
|
-
* @param
|
|
284
|
-
* @param
|
|
285
|
-
* @
|
|
292
|
+
* @param tags - An array of tags to remove from the channel.
|
|
293
|
+
* @param message - Message object for channel members notification (optional).
|
|
294
|
+
* @param options - Configuration to control the behavior while updating (optional, defaults to `{}`).
|
|
295
|
+
* @returns The server response.
|
|
286
296
|
*/
|
|
287
|
-
removeFilterTags(tags: string[], message?:
|
|
297
|
+
removeFilterTags(tags: string[], message?: MessageRequest, options?: ChannelUpdateOptions): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
|
|
288
298
|
/**
|
|
289
|
-
*
|
|
299
|
+
* Adds moderators to the channel.
|
|
290
300
|
*
|
|
291
|
-
* @param
|
|
292
|
-
* @param
|
|
293
|
-
* @param
|
|
294
|
-
* @
|
|
301
|
+
* @param members - An array of member identifiers.
|
|
302
|
+
* @param message - Message object for channel members notification (optional).
|
|
303
|
+
* @param options - Configuration to control the behavior while updating (optional, defaults to `{}`).
|
|
304
|
+
* @returns The server response.
|
|
295
305
|
*/
|
|
296
|
-
addModerators(members: string[], message?:
|
|
306
|
+
addModerators(members: string[], message?: MessageRequest, options?: ChannelUpdateOptions): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
|
|
297
307
|
/**
|
|
298
|
-
*
|
|
308
|
+
* Sets member roles in a channel.
|
|
299
309
|
*
|
|
300
|
-
* @param
|
|
301
|
-
* @param
|
|
302
|
-
* @param
|
|
303
|
-
* @
|
|
310
|
+
* @param roles - List of role assignments.
|
|
311
|
+
* @param message - Message object for channel members notification (optional).
|
|
312
|
+
* @param options - Configuration to control the behavior while updating (optional, defaults to `{}`).
|
|
313
|
+
* @returns The server response.
|
|
304
314
|
*/
|
|
305
315
|
assignRoles(roles: {
|
|
306
|
-
channel_role:
|
|
316
|
+
channel_role: RoleName;
|
|
307
317
|
user_id: string;
|
|
308
|
-
}[], message?:
|
|
318
|
+
}[], message?: MessageRequest, options?: ChannelUpdateOptions): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
|
|
309
319
|
/**
|
|
310
|
-
*
|
|
320
|
+
* Invite members to the channel.
|
|
311
321
|
*
|
|
312
|
-
* @param
|
|
313
|
-
* @param
|
|
314
|
-
* @param
|
|
315
|
-
* @
|
|
322
|
+
* @param members - An array of members to invite to the channel.
|
|
323
|
+
* @param message - Message object for channel members notification (optional).
|
|
324
|
+
* @param options - Configuration to control the behavior while updating (optional, defaults to `{}`).
|
|
325
|
+
* @returns The server response.
|
|
316
326
|
*/
|
|
317
|
-
inviteMembers(members: string[] | Required<Omit<
|
|
327
|
+
inviteMembers(members: string[] | Required<Omit<Gen_ChannelMemberRequest, 'channel_role'>>[], message?: MessageRequest, options?: ChannelUpdateOptions): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
|
|
318
328
|
/**
|
|
319
|
-
*
|
|
329
|
+
* Removes members from the channel.
|
|
320
330
|
*
|
|
321
|
-
* @param
|
|
322
|
-
* @param
|
|
323
|
-
* @param
|
|
324
|
-
* @
|
|
331
|
+
* @param members - An array of member identifiers.
|
|
332
|
+
* @param message - Message object for channel members notification (optional).
|
|
333
|
+
* @param options - Configuration to control the behavior while updating (optional, defaults to `{}`).
|
|
334
|
+
* @returns The server response.
|
|
325
335
|
*/
|
|
326
|
-
removeMembers(members: string[], message?:
|
|
336
|
+
removeMembers(members: string[], message?: MessageRequest, options?: ChannelUpdateOptions): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
|
|
327
337
|
/**
|
|
328
|
-
*
|
|
338
|
+
* Removes the moderator role from channel members.
|
|
329
339
|
*
|
|
330
|
-
* @param
|
|
331
|
-
* @param
|
|
332
|
-
* @param
|
|
333
|
-
* @
|
|
334
|
-
*/
|
|
335
|
-
demoteModerators(members: string[], message?: Message, options?: ChannelUpdateOptions): Promise<UpdateChannelAPIResponse>;
|
|
336
|
-
/**
|
|
337
|
-
* _update - executes channel update request
|
|
338
|
-
* @param payload Object Update Channel payload
|
|
339
|
-
* @return {Promise<UpdateChannelAPIResponse>} The server response
|
|
340
|
-
* TODO: introduce new type instead of Object in the next major update
|
|
340
|
+
* @param members - An array of member identifiers.
|
|
341
|
+
* @param message - Message object for channel members notification (optional).
|
|
342
|
+
* @param options - Configuration to control the behavior while updating (optional, defaults to `{}`).
|
|
343
|
+
* @returns The server response.
|
|
341
344
|
*/
|
|
342
|
-
|
|
345
|
+
demoteModerators(members: string[], message?: MessageRequest, options?: ChannelUpdateOptions): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
|
|
343
346
|
/**
|
|
344
|
-
*
|
|
345
|
-
* @param {{ user_id?: string, expiration?: string }} opts expiration in minutes or user_id
|
|
346
|
-
* @return {Promise<MuteChannelAPIResponse>} The server response
|
|
347
|
+
* Mutes the current channel.
|
|
347
348
|
*
|
|
348
|
-
* example
|
|
349
|
-
*
|
|
349
|
+
* @example
|
|
350
|
+
* // with expiration
|
|
351
|
+
* await channel.mute({ expiration: moment.duration(2, 'weeks') });
|
|
350
352
|
*
|
|
351
|
-
* example
|
|
352
|
-
*
|
|
353
|
+
* @example
|
|
354
|
+
* // server side
|
|
355
|
+
* await channel.mute({ user_id: userId });
|
|
353
356
|
*
|
|
357
|
+
* @param options - Mute options (optional, defaults to `{}`).
|
|
358
|
+
* @param options.expiration - Expiration in minutes (optional).
|
|
359
|
+
* @returns The server response.
|
|
354
360
|
*/
|
|
355
|
-
mute(
|
|
356
|
-
expiration?: number;
|
|
357
|
-
user_id?: string;
|
|
358
|
-
}): Promise<MuteChannelAPIResponse>;
|
|
361
|
+
mute(options?: Gen_MuteChannelRequest): Promise<import("./types").StreamResponse<import(".").MuteChannelResponse>>;
|
|
359
362
|
/**
|
|
360
|
-
*
|
|
361
|
-
* @param {{ user_id?: string}} opts user_id
|
|
362
|
-
* @return {Promise<APIResponse>} The server response
|
|
363
|
+
* Unmutes the current channel.
|
|
363
364
|
*
|
|
364
|
-
* example
|
|
365
|
-
*
|
|
365
|
+
* @example
|
|
366
|
+
* // server side
|
|
367
|
+
* await channel.unmute({ user_id: userId });
|
|
368
|
+
*
|
|
369
|
+
* @param options - Unmute options (optional, defaults to `{}`).
|
|
370
|
+
* @param options.user_id - User ID (optional).
|
|
371
|
+
* @returns The server response.
|
|
366
372
|
*/
|
|
367
|
-
unmute(
|
|
368
|
-
user_id?: string;
|
|
369
|
-
}): Promise<APIResponse>;
|
|
373
|
+
unmute(options?: Gen_UnmuteChannelRequest): Promise<import("./types").StreamResponse<import(".").UnmuteResponse>>;
|
|
370
374
|
/**
|
|
371
|
-
*
|
|
372
|
-
* @param {{ user_id?: string }} opts user_id if called server side
|
|
373
|
-
* @return {Promise<ChannelMemberResponse>} The server response
|
|
374
|
-
*
|
|
375
|
-
* example:
|
|
376
|
-
* await channel.archives();
|
|
375
|
+
* Archives the current channel.
|
|
377
376
|
*
|
|
378
|
-
* example
|
|
379
|
-
* await channel.archive(
|
|
377
|
+
* @example
|
|
378
|
+
* await channel.archive();
|
|
380
379
|
*
|
|
380
|
+
* @returns The server response.
|
|
381
381
|
*/
|
|
382
|
-
archive(
|
|
383
|
-
user_id?: string;
|
|
384
|
-
}): Promise<ChannelMemberResponse>;
|
|
382
|
+
archive(): Promise<import("./types").StreamResponse<import(".").UpdateMemberPartialResponse>>;
|
|
385
383
|
/**
|
|
386
|
-
*
|
|
387
|
-
* @param {{ user_id?: string }} opts user_id if called server side
|
|
388
|
-
* @return {Promise<ChannelMemberResponse>} The server response
|
|
384
|
+
* Unarchives the current channel.
|
|
389
385
|
*
|
|
390
|
-
* example
|
|
386
|
+
* @example
|
|
391
387
|
* await channel.unarchive();
|
|
392
388
|
*
|
|
393
|
-
*
|
|
394
|
-
* await channel.unarchive({user_id: userId});
|
|
395
|
-
*
|
|
389
|
+
* @returns The server response.
|
|
396
390
|
*/
|
|
397
|
-
unarchive(
|
|
398
|
-
user_id?: string;
|
|
399
|
-
}): Promise<ChannelMemberResponse>;
|
|
391
|
+
unarchive(): Promise<import("./types").StreamResponse<import(".").UpdateMemberPartialResponse>>;
|
|
400
392
|
/**
|
|
401
|
-
*
|
|
402
|
-
* @param {{ user_id?: string }} opts user_id if called server side
|
|
403
|
-
* @return {Promise<ChannelMemberResponse>} The server response
|
|
393
|
+
* Pins the current channel.
|
|
404
394
|
*
|
|
405
|
-
* example
|
|
395
|
+
* @example
|
|
406
396
|
* await channel.pin();
|
|
407
397
|
*
|
|
408
|
-
*
|
|
409
|
-
* await channel.pin({user_id: userId});
|
|
410
|
-
*
|
|
398
|
+
* @returns The server response.
|
|
411
399
|
*/
|
|
412
|
-
pin(
|
|
413
|
-
user_id?: string;
|
|
414
|
-
}): Promise<ChannelMemberResponse>;
|
|
400
|
+
pin(): Promise<import("./types").StreamResponse<import(".").UpdateMemberPartialResponse>>;
|
|
415
401
|
/**
|
|
416
|
-
*
|
|
417
|
-
* @param {{ user_id?: string }} opts user_id if called server side
|
|
418
|
-
* @return {Promise<ChannelMemberResponse>} The server response
|
|
402
|
+
* Unpins the current channel.
|
|
419
403
|
*
|
|
420
|
-
* example
|
|
404
|
+
* @example
|
|
421
405
|
* await channel.unpin();
|
|
422
406
|
*
|
|
423
|
-
*
|
|
424
|
-
* await channel.unpin({user_id: userId});
|
|
425
|
-
*
|
|
407
|
+
* @returns The server response.
|
|
426
408
|
*/
|
|
427
|
-
unpin(
|
|
428
|
-
user_id?: string;
|
|
429
|
-
}): Promise<ChannelMemberResponse>;
|
|
409
|
+
unpin(): Promise<import("./types").StreamResponse<import(".").UpdateMemberPartialResponse>>;
|
|
430
410
|
/**
|
|
431
|
-
*
|
|
432
|
-
*
|
|
411
|
+
* Returns the mute status for the current channel.
|
|
412
|
+
*
|
|
413
|
+
* @returns An object of the form `{ muted: true | false, createdAt: Date | null, expiresAt: Date | null }`.
|
|
433
414
|
*/
|
|
434
415
|
muteStatus(): {
|
|
435
|
-
|
|
416
|
+
muted: boolean;
|
|
417
|
+
createdAt: Date;
|
|
436
418
|
expiresAt: Date | null;
|
|
419
|
+
} | {
|
|
437
420
|
muted: boolean;
|
|
421
|
+
createdAt: null;
|
|
422
|
+
expiresAt: null;
|
|
438
423
|
};
|
|
439
|
-
sendAction(
|
|
424
|
+
sendAction(messageId: string, formData: Record<string, string>): Promise<import("./types").StreamResponse<import(".").MessageActionResponse>>;
|
|
440
425
|
/**
|
|
441
|
-
*
|
|
442
|
-
* Call this on every keystroke
|
|
426
|
+
* First of the `typing.start` and `typing.stop` events based on the user's keystrokes.
|
|
427
|
+
* Call this on every keystroke.
|
|
428
|
+
*
|
|
443
429
|
* @see {@link https://getstream.io/chat/docs/typing_indicators/?language=js|Docs}
|
|
444
|
-
*
|
|
430
|
+
*
|
|
431
|
+
* @param parentId - Set this field to `message.id` to indicate that the typing event is happening in a thread (optional).
|
|
432
|
+
* @param options - Optional override carrying a `user_id` (optional).
|
|
445
433
|
*/
|
|
446
|
-
keystroke(
|
|
434
|
+
keystroke(parentId?: string, options?: {
|
|
447
435
|
user_id: string;
|
|
448
436
|
}): Promise<void>;
|
|
449
437
|
/**
|
|
@@ -451,8 +439,9 @@ export declare class Channel {
|
|
|
451
439
|
* Typically used by the server connected to the AI service to notify clients of state changes.
|
|
452
440
|
*
|
|
453
441
|
* @param messageId - The ID of the message associated with the AI state.
|
|
454
|
-
* @param state - The new state of the AI process
|
|
455
|
-
* @param options -
|
|
442
|
+
* @param state - The new state of the AI process, e.g. thinking, generating.
|
|
443
|
+
* @param options - Parameters such as `ai_message` to include additional details in the event (optional, defaults to `{}`).
|
|
444
|
+
* @param options.ai_message - Additional message detail to include in the event (optional).
|
|
456
445
|
*/
|
|
457
446
|
updateAIState(messageId: string, state: AIState, options?: {
|
|
458
447
|
ai_message?: string;
|
|
@@ -468,43 +457,44 @@ export declare class Channel {
|
|
|
468
457
|
*/
|
|
469
458
|
stopAIResponse(): Promise<void>;
|
|
470
459
|
/**
|
|
471
|
-
*
|
|
460
|
+
* Sets last typing to null and sends the `typing.stop` event.
|
|
461
|
+
*
|
|
472
462
|
* @see {@link https://getstream.io/chat/docs/typing_indicators/?language=js|Docs}
|
|
473
|
-
*
|
|
463
|
+
*
|
|
464
|
+
* @param parentId - Set this field to `message.id` to indicate that the typing event is happening in a thread (optional).
|
|
465
|
+
* @param options - Optional override carrying a `user_id` (optional).
|
|
474
466
|
*/
|
|
475
|
-
stopTyping(
|
|
467
|
+
stopTyping(parentId?: string, options?: {
|
|
476
468
|
user_id: string;
|
|
477
469
|
}): Promise<void>;
|
|
478
470
|
_isTypingIndicatorsEnabled(): boolean;
|
|
479
471
|
/**
|
|
480
|
-
*
|
|
472
|
+
* Run this user's mark-read reporter for this channel. Delegates to
|
|
473
|
+
* `MessageDeliveryReporter`, which batches the underlying `markRead` request
|
|
474
|
+
* with the user's read receipts state.
|
|
481
475
|
*
|
|
482
|
-
*
|
|
483
|
-
*/
|
|
484
|
-
lastMessage(): LocalMessage | undefined;
|
|
485
|
-
/**
|
|
486
|
-
* markRead - Send the mark read event for this user, only works if the `read_events` setting is enabled. Syncs the message delivery report candidates local state.
|
|
476
|
+
* Use the inherited `markRead()` from `ChannelApi` for a direct, unbatched call.
|
|
487
477
|
*
|
|
488
|
-
* @param {
|
|
489
|
-
* @return {Promise<EventAPIResponse | null>} Description
|
|
478
|
+
* @param data - Mark read options (optional, defaults to `{}`).
|
|
490
479
|
*/
|
|
491
|
-
|
|
480
|
+
markReadViaReporter(data?: MarkReadRequest): Promise<EventAPIResponse | import("./types").StreamResponse<import(".").MarkReadResponse> | null>;
|
|
492
481
|
/**
|
|
493
|
-
*
|
|
482
|
+
* Override of the inherited `markRead()` from `ChannelApi` that requires the
|
|
483
|
+
* channel to be initialized and respects the `read_events` channel config.
|
|
494
484
|
*
|
|
495
|
-
* @param {
|
|
496
|
-
* @
|
|
485
|
+
* @param data - Mark read options (optional, defaults to `{}`).
|
|
486
|
+
* @returns The server response, or `null` if the request was skipped.
|
|
497
487
|
*/
|
|
498
|
-
|
|
488
|
+
markRead(data?: MarkReadRequest): Promise<import("./types").StreamResponse<import(".").MarkReadResponse>>;
|
|
499
489
|
/**
|
|
500
|
-
*
|
|
490
|
+
* Marks the channel as unread from `messageId`. Only works when the `read_events` setting is enabled.
|
|
501
491
|
*
|
|
502
|
-
* @param
|
|
503
|
-
* @
|
|
492
|
+
* @param data - Mark unread options.
|
|
493
|
+
* @returns An API response, or `null` if the request was skipped.
|
|
504
494
|
*/
|
|
505
|
-
markUnread(data
|
|
495
|
+
markUnread(data?: MarkUnreadRequest): Promise<import("./types").StreamResponse<import(".").Response>>;
|
|
506
496
|
/**
|
|
507
|
-
*
|
|
497
|
+
* Resets this user's unread count locally, without any backend call. Intended for
|
|
508
498
|
* channels that have read events disabled (e.g. livestreams) when the client is created with the
|
|
509
499
|
* `isLocalUnreadCountEnabled` option. Dispatches a dedicated, client-only `message.read_locally` event
|
|
510
500
|
* that runs through the same `_handleChannelEvent` read logic as a real `message.read` (minus the
|
|
@@ -512,257 +502,223 @@ export declare class Channel {
|
|
|
512
502
|
* is enabled, the offline DB persists the reset for read-events-disabled channels, so the local
|
|
513
503
|
* count stays consistent across app restarts.
|
|
514
504
|
*
|
|
515
|
-
* @
|
|
516
|
-
*/
|
|
517
|
-
markReadLocally():
|
|
505
|
+
* @returns The dispatched `message.read_locally` event, or `undefined` if there is no connected user.
|
|
506
|
+
*/
|
|
507
|
+
markReadLocally(): ({
|
|
508
|
+
type: "message.read_locally";
|
|
509
|
+
} & {
|
|
510
|
+
channel_type: string;
|
|
511
|
+
cid: string;
|
|
512
|
+
created_at: Date;
|
|
513
|
+
channel_id?: string;
|
|
514
|
+
last_read_message_id?: string;
|
|
515
|
+
team?: string;
|
|
516
|
+
user?: UserResponse;
|
|
517
|
+
} & {
|
|
518
|
+
received_at?: Date;
|
|
519
|
+
}) | undefined;
|
|
518
520
|
/**
|
|
519
|
-
*
|
|
521
|
+
* Cleans the channel state and fires stop typing if needed.
|
|
520
522
|
*/
|
|
521
523
|
clean(): void;
|
|
522
524
|
/**
|
|
523
|
-
*
|
|
524
|
-
*
|
|
525
|
-
* @param {ChannelQueryOptions} options additional options for the query endpoint
|
|
525
|
+
* Loads the initial channel state and watches for changes.
|
|
526
526
|
*
|
|
527
|
-
* @
|
|
527
|
+
* @param options - Additional options for the query endpoint (optional).
|
|
528
|
+
* @returns The server response.
|
|
528
529
|
*/
|
|
529
|
-
watch(options?:
|
|
530
|
+
watch(options?: ChannelGetOrCreateRequest): Promise<import("./types").StreamResponse<import(".").ChannelStateResponse>>;
|
|
530
531
|
/**
|
|
531
|
-
*
|
|
532
|
+
* Stops watching the channel.
|
|
532
533
|
*
|
|
533
|
-
* @
|
|
534
|
+
* @param request - The stop-watching request payload (optional).
|
|
535
|
+
* @returns The server response.
|
|
534
536
|
*/
|
|
535
|
-
stopWatching(): Promise<
|
|
537
|
+
stopWatching(request?: Gen_ChannelStopWatchingRequest): Promise<import("./types").StreamResponse<import(".").Response>>;
|
|
536
538
|
/**
|
|
537
|
-
*
|
|
538
|
-
*
|
|
539
|
-
* The recommended way of working with threads is to use the Thread class.
|
|
539
|
+
* List the message replies for a parent message.
|
|
540
540
|
*
|
|
541
|
-
*
|
|
542
|
-
* @param {MessagePaginationOptions & { user?: UserResponse; user_id?: string }} options Pagination params, ie {limit:10, id_lte: 10}
|
|
541
|
+
* The recommended way of working with threads is to use the `Thread` class.
|
|
543
542
|
*
|
|
544
|
-
* @
|
|
543
|
+
* @param request - The get-replies request payload, including the parent message ID, pagination
|
|
544
|
+
* params, and optional sort directions for `created_at`.
|
|
545
|
+
* @returns A response with a list of messages.
|
|
545
546
|
*/
|
|
546
|
-
getReplies(
|
|
547
|
-
user?: UserResponse;
|
|
548
|
-
user_id?: string;
|
|
549
|
-
}, sort?: {
|
|
550
|
-
created_at: AscDesc;
|
|
551
|
-
}[]): Promise<GetRepliesAPIResponse>;
|
|
547
|
+
getReplies(request: GetRepliesRequest): Promise<import("./types").StreamResponse<import(".").GetRepliesResponse>>;
|
|
552
548
|
/**
|
|
553
|
-
*
|
|
554
|
-
*
|
|
555
|
-
* @param {PinnedMessagePaginationOptions & { user?: UserResponse; user_id?: string }} options Pagination params, ie {limit:10, id_lte: 10}
|
|
556
|
-
* @param {PinnedMessagesSort} sort defines sorting direction of pinned messages
|
|
549
|
+
* List pinned messages of the channel.
|
|
557
550
|
*
|
|
558
|
-
* @
|
|
551
|
+
* @param options - Pagination params, e.g. `{ limit: 10, id_lte: 10 }`.
|
|
552
|
+
* @param sort - Defines sorting direction of pinned messages (optional, defaults to `[]`).
|
|
553
|
+
* @returns A response with a list of messages.
|
|
559
554
|
*/
|
|
560
|
-
getPinnedMessages(options: PinnedMessagePaginationOptions
|
|
561
|
-
user?: UserResponse;
|
|
562
|
-
user_id?: string;
|
|
563
|
-
}, sort?: PinnedMessagesSort): Promise<GetRepliesAPIResponse>;
|
|
555
|
+
getPinnedMessages(options: PinnedMessagePaginationOptions, sort?: PinnedMessagesSort): Promise<GetRepliesAPIResponse>;
|
|
564
556
|
/**
|
|
565
|
-
*
|
|
566
|
-
*
|
|
567
|
-
* @param {string} message_id The message id
|
|
568
|
-
* @param {{ limit?: number; offset?: number }} options The pagination options
|
|
557
|
+
* List the reactions; supports pagination.
|
|
569
558
|
*
|
|
570
|
-
* @
|
|
559
|
+
* @param request - The request payload, including the target message ID and
|
|
560
|
+
* pagination options (`limit`, `offset`).
|
|
561
|
+
* @returns The server response.
|
|
571
562
|
*/
|
|
572
|
-
getReactions(
|
|
573
|
-
limit?: number;
|
|
574
|
-
offset?: number;
|
|
575
|
-
}): Promise<GetReactionsAPIResponse>;
|
|
563
|
+
getReactions(request: Parameters<ChatApi['getReactions']>[0]): Promise<import("./types").StreamResponse<import(".").GetReactionsResponse>>;
|
|
576
564
|
/**
|
|
577
|
-
*
|
|
565
|
+
* Retrieves a list of messages by ID.
|
|
578
566
|
*
|
|
579
|
-
* @param
|
|
580
|
-
*
|
|
581
|
-
* @return {Promise<GetMultipleMessagesAPIResponse>} Server response
|
|
567
|
+
* @param messageIds - The IDs of the messages to retrieve from this channel.
|
|
568
|
+
* @returns Server response.
|
|
582
569
|
*/
|
|
583
|
-
getMessagesById(messageIds: string[]): Promise<
|
|
570
|
+
getMessagesById(messageIds: string[]): Promise<import("./types").StreamResponse<import(".").GetManyMessagesResponse>>;
|
|
584
571
|
/**
|
|
585
|
-
*
|
|
586
|
-
*
|
|
572
|
+
* Returns the last time the user marked the channel as read. If the user never marked the channel as read, this will return `null`.
|
|
573
|
+
*
|
|
574
|
+
* @returns The last-read `Date`, `null` if never read, or `undefined` if the user is unset.
|
|
587
575
|
*/
|
|
588
576
|
lastRead(): Date | null | undefined;
|
|
589
577
|
_countMessageAsUnread(message: LocalMessage | MessageResponse): boolean;
|
|
590
578
|
/**
|
|
591
|
-
*
|
|
579
|
+
* Count of unread messages.
|
|
592
580
|
*
|
|
593
|
-
* @param
|
|
594
|
-
*
|
|
595
|
-
* @return {number} Unread count
|
|
581
|
+
* @param lastRead - The time that the user read a message (optional, defaults to the current user's read state).
|
|
582
|
+
* @returns Unread count.
|
|
596
583
|
*/
|
|
597
584
|
countUnread(lastRead?: Date | null): number;
|
|
598
585
|
/**
|
|
599
|
-
*
|
|
586
|
+
* Count the number of unread messages mentioning the current user.
|
|
600
587
|
*
|
|
601
|
-
* @
|
|
588
|
+
* @returns Unread mentions count.
|
|
602
589
|
*/
|
|
603
590
|
countUnreadMentions(): number;
|
|
604
591
|
/**
|
|
605
|
-
*
|
|
606
|
-
*
|
|
607
|
-
* @return {Promise<QueryChannelAPIResponse>} The Server Response
|
|
592
|
+
* Creates a new channel.
|
|
608
593
|
*
|
|
594
|
+
* @param options - Channel query options (optional).
|
|
595
|
+
* @returns The server response.
|
|
609
596
|
*/
|
|
610
|
-
create: (options?:
|
|
597
|
+
create: (options?: ChannelGetOrCreateRequest) => Promise<import("./types").StreamResponse<import(".").ChannelStateResponse>>;
|
|
611
598
|
/**
|
|
612
|
-
*
|
|
613
|
-
*
|
|
614
|
-
* @param {ChannelQueryOptions} options The query options
|
|
615
|
-
* @param {MessageSetType} messageSetToAddToIfDoesNotExist It's possible to load disjunct sets of a channel's messages into state, use `current` to load the initial channel state or if you want to extend the currently displayed messages, use `latest` if you want to load/extend the latest messages, `new` is used for loading a specific message and it's surroundings
|
|
599
|
+
* Queries the API to load messages, members, or other channel fields.
|
|
616
600
|
*
|
|
617
|
-
* @
|
|
601
|
+
* @param options - The query options (optional, defaults to `{}`).
|
|
602
|
+
* @param messageSetToAddToIfDoesNotExist - It's possible to load disjunct sets of a channel's
|
|
603
|
+
* messages into state. Use `current` to load the initial channel state or to extend the
|
|
604
|
+
* currently displayed messages; use `latest` to load/extend the latest messages; `new` is
|
|
605
|
+
* used for loading a specific message and its surroundings (optional, defaults to `'current'`).
|
|
606
|
+
* @returns A query response.
|
|
618
607
|
*/
|
|
619
|
-
query(options?:
|
|
608
|
+
query(options?: ChannelGetOrCreateRequest, messageSetToAddToIfDoesNotExist?: MessageSetType): Promise<import("./types").StreamResponse<import(".").ChannelStateResponse>>;
|
|
620
609
|
/**
|
|
621
|
-
*
|
|
610
|
+
* Bans a user from a channel.
|
|
622
611
|
*
|
|
623
|
-
* @param
|
|
624
|
-
* @param
|
|
625
|
-
* @returns
|
|
612
|
+
* @param targetUserId - The user to ban.
|
|
613
|
+
* @param options - Ban options.
|
|
614
|
+
* @returns The server response.
|
|
626
615
|
*/
|
|
627
|
-
banUser(
|
|
616
|
+
banUser(targetUserId: string, options: BanUserOptions): Promise<APIResponse>;
|
|
628
617
|
/**
|
|
629
|
-
*
|
|
630
|
-
* If
|
|
618
|
+
* Hides the channel from `queryChannels` for the user until a message is added.
|
|
619
|
+
* If `clear_history` is set to `true`, all messages will be removed for the user.
|
|
631
620
|
*
|
|
632
|
-
* @param {
|
|
633
|
-
*
|
|
634
|
-
* @returns
|
|
621
|
+
* @param request - The hide channel request payload (optional). Pass `{ clear_history: true }`
|
|
622
|
+
* to clear message history for the user.
|
|
623
|
+
* @returns The server response.
|
|
635
624
|
*/
|
|
636
|
-
hide(
|
|
625
|
+
hide(request?: Gen_HideChannelRequest): Promise<import("./types").StreamResponse<import(".").HideChannelResponse>>;
|
|
637
626
|
/**
|
|
638
|
-
*
|
|
627
|
+
* Removes the hidden status for a channel. Ensures the channel is initialized first.
|
|
639
628
|
*
|
|
640
|
-
* @param
|
|
641
|
-
* @returns
|
|
629
|
+
* @param request - The show channel request payload (optional).
|
|
630
|
+
* @returns The server response.
|
|
642
631
|
*/
|
|
643
|
-
show(
|
|
632
|
+
show(request?: Gen_ShowChannelRequest): Promise<import("./types").StreamResponse<import(".").ShowChannelResponse>>;
|
|
644
633
|
/**
|
|
645
|
-
*
|
|
634
|
+
* Removes the bans for a user on a channel.
|
|
646
635
|
*
|
|
647
|
-
* @param
|
|
648
|
-
* @param
|
|
649
|
-
* @returns
|
|
636
|
+
* @param targetUserId - The user to unban.
|
|
637
|
+
* @param options - Unban options (optional).
|
|
638
|
+
* @returns The server response.
|
|
650
639
|
*/
|
|
651
|
-
unbanUser(
|
|
640
|
+
unbanUser(targetUserId: string, options?: UnBanUserOptions): Promise<APIResponse>;
|
|
652
641
|
/**
|
|
653
|
-
*
|
|
642
|
+
* Shadow bans a user from a channel.
|
|
654
643
|
*
|
|
655
|
-
* @param
|
|
656
|
-
* @param
|
|
657
|
-
* @returns
|
|
644
|
+
* @param targetUserId - The user to shadow ban.
|
|
645
|
+
* @param options - Ban options.
|
|
646
|
+
* @returns The server response.
|
|
658
647
|
*/
|
|
659
|
-
shadowBan(
|
|
648
|
+
shadowBan(targetUserId: string, options: BanUserOptions): Promise<APIResponse>;
|
|
660
649
|
/**
|
|
661
|
-
*
|
|
662
|
-
*
|
|
663
|
-
* @param {string} targetUserID
|
|
664
|
-
* @returns {Promise<APIResponse>}
|
|
665
|
-
*/
|
|
666
|
-
removeShadowBan(targetUserID: string): Promise<APIResponse>;
|
|
667
|
-
/**
|
|
668
|
-
* Cast or cancel one or more votes on a poll
|
|
669
|
-
* @param pollId string The poll id
|
|
670
|
-
* @param votes PollVoteData[] The votes that will be casted (or canceled in case of an empty array)
|
|
671
|
-
* @returns {APIResponse & PollVoteResponse} The poll votes
|
|
672
|
-
*/
|
|
673
|
-
vote(messageId: string, pollId: string, vote: PollVoteData): Promise<APIResponse & import("./types").CastVoteAPIResponse>;
|
|
674
|
-
removeVote(messageId: string, pollId: string, voteId: string): Promise<APIResponse & {
|
|
675
|
-
vote: import("./types").PollVote;
|
|
676
|
-
}>;
|
|
677
|
-
/**
|
|
678
|
-
* createDraft - Creates or updates a draft message in a channel
|
|
679
|
-
*
|
|
680
|
-
* @param {DraftMessagePayload} message The draft message to create or update
|
|
650
|
+
* Removes the shadow ban for a user on a channel.
|
|
681
651
|
*
|
|
682
|
-
* @
|
|
652
|
+
* @param targetUserId - The user to remove the shadow ban for.
|
|
653
|
+
* @returns The server response.
|
|
683
654
|
*/
|
|
684
|
-
|
|
655
|
+
removeShadowBan(targetUserId: string): Promise<APIResponse>;
|
|
685
656
|
/**
|
|
686
|
-
*
|
|
687
|
-
* enabled, it will make sure that creating the draft is queued up if it fails due to
|
|
688
|
-
* bad internet conditions and executed later.
|
|
657
|
+
* Casts or cancels one or more votes on a poll.
|
|
689
658
|
*
|
|
690
|
-
* @param
|
|
691
|
-
*
|
|
692
|
-
* @
|
|
659
|
+
* @param request - The cast-poll-vote request payload, including the target message ID, poll ID,
|
|
660
|
+
* and the vote to cast (or an empty payload to cancel).
|
|
661
|
+
* @returns The poll vote response.
|
|
693
662
|
*/
|
|
694
|
-
|
|
663
|
+
vote(request: Parameters<ChatApi['castPollVote']>[0]): Promise<import("./types").StreamResponse<import(".").PollVoteResponse>>;
|
|
664
|
+
removeVote(request: Parameters<ChatApi['deletePollVote']>[0]): Promise<import("./types").StreamResponse<import(".").PollVoteResponse>>;
|
|
665
|
+
_createDraft(request: Gen_CreateDraftRequest): Promise<import("./types").StreamResponse<CreateDraftResponse>>;
|
|
695
666
|
/**
|
|
696
|
-
*
|
|
697
|
-
*
|
|
698
|
-
* @param {Object} options
|
|
699
|
-
* @param {string} options.parent_id Optional parent message ID for drafts in threads
|
|
700
|
-
*
|
|
701
|
-
* @return {Promise<APIResponse>} API response
|
|
667
|
+
* Creates or updates a draft message in a channel. If offline support is enabled, the
|
|
668
|
+
* call is queued so it is replayed on reconnect.
|
|
702
669
|
*/
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
}): Promise<APIResponse>;
|
|
670
|
+
createDraft(request: Gen_CreateDraftRequest): Promise<import("./types").StreamResponse<CreateDraftResponse>>;
|
|
671
|
+
_deleteDraft(request?: Parameters<ChannelApi['deleteDraft']>[0]): Promise<import("./types").StreamResponse<import(".").Response>>;
|
|
706
672
|
/**
|
|
707
|
-
*
|
|
708
|
-
*
|
|
709
|
-
* bad internet conditions and executed later.
|
|
710
|
-
*
|
|
711
|
-
* @param {Object} options
|
|
712
|
-
* @param {string} options.parent_id Optional parent message ID for drafts in threads
|
|
713
|
-
*
|
|
714
|
-
* @return {Promise<APIResponse>} API response
|
|
673
|
+
* Deletes a draft message from a channel or a thread. If offline support is enabled, the
|
|
674
|
+
* call is queued so it is replayed on reconnect.
|
|
715
675
|
*/
|
|
716
|
-
deleteDraft(
|
|
717
|
-
parent_id?: string;
|
|
718
|
-
}): Promise<APIResponse>;
|
|
676
|
+
deleteDraft(request?: Parameters<ChannelApi['deleteDraft']>[0]): Promise<import("./types").StreamResponse<import(".").Response>>;
|
|
719
677
|
/**
|
|
720
|
-
*
|
|
678
|
+
* Listens to events on this channel.
|
|
721
679
|
*
|
|
722
|
-
* @
|
|
723
|
-
*
|
|
680
|
+
* @example
|
|
681
|
+
* channel.on('message.new', (event) => {
|
|
682
|
+
* console.log('my new message', event, channel.state.messages);
|
|
683
|
+
* });
|
|
724
684
|
*
|
|
725
|
-
* @
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
}): Promise<GetDraftResponse>;
|
|
730
|
-
/**
|
|
731
|
-
* on - Listen to events on this channel.
|
|
685
|
+
* @example
|
|
686
|
+
* channel.on((event) => {
|
|
687
|
+
* console.log(event.type);
|
|
688
|
+
* });
|
|
732
689
|
*
|
|
733
|
-
*
|
|
734
|
-
*
|
|
735
|
-
*
|
|
736
|
-
*
|
|
737
|
-
* @param {EventHandler | EventTypes} callbackOrString The event type to listen for (optional)
|
|
738
|
-
* @param {EventHandler} [callbackOrNothing] The callback to call
|
|
690
|
+
* @param callbackOrString - The event type to listen for, or the callback when listening to all events.
|
|
691
|
+
* @param callbackOrNothing - The callback to call when an event type was provided (optional).
|
|
692
|
+
* @returns An object with an `unsubscribe()` method.
|
|
739
693
|
*/
|
|
740
|
-
on(eventType:
|
|
694
|
+
on<T extends EventType | string>(eventType: T, callback: EventHandler<T>): {
|
|
741
695
|
unsubscribe: () => void;
|
|
742
696
|
};
|
|
743
697
|
on(callback: EventHandler): {
|
|
744
698
|
unsubscribe: () => void;
|
|
745
699
|
};
|
|
746
700
|
/**
|
|
747
|
-
*
|
|
701
|
+
* Removes the event handler.
|
|
748
702
|
*
|
|
703
|
+
* @param callbackOrString - The event type, or the callback when removing an all-events listener.
|
|
704
|
+
* @param callbackOrNothing - The callback to remove when an event type was provided (optional).
|
|
749
705
|
*/
|
|
750
|
-
off(eventType:
|
|
706
|
+
off<T extends EventType | string>(eventType: T, callback: EventHandler): void;
|
|
751
707
|
off(callback: EventHandler): void;
|
|
708
|
+
private _patchReadState;
|
|
709
|
+
private _upsertReadState;
|
|
752
710
|
_handleChannelEvent(event: Event): void;
|
|
753
|
-
_callChannelListeners: (event:
|
|
711
|
+
_callChannelListeners: (event: WSEvent) => void;
|
|
754
712
|
/**
|
|
755
|
-
*
|
|
713
|
+
* Returns the channel url.
|
|
756
714
|
*
|
|
757
|
-
* @
|
|
715
|
+
* @returns The channel url.
|
|
758
716
|
*/
|
|
759
717
|
_channelURL: () => string;
|
|
760
718
|
_checkInitialized(): void;
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
};
|
|
765
|
-
_extendEventWithOwnReactions(event: Event): void;
|
|
719
|
+
_syncStateFromChannelData(data: Channel['data'], fallbackData?: Channel['data']): void;
|
|
720
|
+
_initializeState(state: ChannelStateResponseFields): void;
|
|
721
|
+
_extendEventWithOwnReactions(event: EventPayload<'message.undeleted' | 'message.updated' | 'message.deleted'>): void;
|
|
766
722
|
_hydrateMembers({ members, overrideCurrentState, }: {
|
|
767
723
|
members: ChannelMemberResponse[];
|
|
768
724
|
/**
|