stream-chat 9.50.3 → 10.0.0-rc.2

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.
Files changed (242) hide show
  1. package/dist/cjs/index.browser.js +19798 -14472
  2. package/dist/cjs/index.browser.js.map +4 -4
  3. package/dist/cjs/index.node.js +19817 -14482
  4. package/dist/cjs/index.node.js.map +4 -4
  5. package/dist/esm/index.mjs +19795 -14469
  6. package/dist/esm/index.mjs.map +4 -4
  7. package/dist/types/ChannelManager.d.ts +221 -0
  8. package/dist/types/EventHandlerPipeline.d.ts +104 -0
  9. package/dist/types/api-client.d.ts +26 -0
  10. package/dist/types/campaign.d.ts +0 -44
  11. package/dist/types/channel.d.ts +454 -479
  12. package/dist/types/channel_batch_updater.d.ts +0 -93
  13. package/dist/types/channel_state.d.ts +53 -201
  14. package/dist/types/client.d.ts +451 -1920
  15. package/dist/types/client_state.d.ts +4 -4
  16. package/dist/types/configuration/InstanceConfigurationService.d.ts +26 -0
  17. package/dist/types/configuration/index.d.ts +1 -0
  18. package/dist/types/configuration/types.d.ts +53 -0
  19. package/dist/types/connection.d.ts +49 -41
  20. package/dist/types/connection_fallback.d.ts +6 -4
  21. package/dist/types/constants.d.ts +0 -4
  22. package/dist/types/custom_types.d.ts +2 -0
  23. package/dist/types/entityStore/EntityStore.d.ts +111 -0
  24. package/dist/types/entityStore/StoreBackedItemIndex.d.ts +60 -0
  25. package/dist/types/entityStore/applyReactionLocally.d.ts +26 -0
  26. package/dist/types/entityStore/index.d.ts +2 -0
  27. package/dist/types/errors.d.ts +10 -2
  28. package/dist/types/gen/chat/ChannelApi.d.ts +45 -0
  29. package/dist/types/gen/chat/ChatApi.d.ts +334 -0
  30. package/dist/types/gen/model-decoders/decoders.d.ts +3 -0
  31. package/dist/types/gen/model-decoders/event-decoder-mapping.d.ts +6 -0
  32. package/dist/types/gen/models/index.d.ts +8836 -0
  33. package/dist/types/gen/moderation/ModerationApi.d.ts +50 -0
  34. package/dist/types/gen-imports.d.ts +3 -0
  35. package/dist/types/index.d.ts +8 -7
  36. package/dist/types/insights.d.ts +9 -8
  37. package/dist/types/logger.d.ts +9 -0
  38. package/dist/types/messageComposer/LocationComposer.d.ts +7 -4
  39. package/dist/types/messageComposer/attachmentIdentity.d.ts +2 -2
  40. package/dist/types/messageComposer/attachmentManager.d.ts +8 -4
  41. package/dist/types/messageComposer/configuration/types.d.ts +11 -11
  42. package/dist/types/messageComposer/linkPreviewsManager.d.ts +25 -13
  43. package/dist/types/messageComposer/messageComposer.d.ts +10 -10
  44. package/dist/types/messageComposer/middleware/messageComposer/types.d.ts +3 -3
  45. package/dist/types/messageComposer/middleware/pollComposer/types.d.ts +4 -7
  46. package/dist/types/messageComposer/middleware/textComposer/commandUtils.d.ts +3 -3
  47. package/dist/types/messageComposer/middleware/textComposer/commands.d.ts +7 -7
  48. package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +218 -4
  49. package/dist/types/messageComposer/middleware/textComposer/types.d.ts +9 -4
  50. package/dist/types/messageComposer/pollComposer.d.ts +5 -4
  51. package/dist/types/messageComposer/textComposer.d.ts +8 -3
  52. package/dist/types/messageComposer/types.d.ts +6 -28
  53. package/dist/types/messageDelivery/MessageDeliveryReporter.d.ts +40 -25
  54. package/dist/types/messageDelivery/MessageReceiptsTracker.d.ts +53 -12
  55. package/dist/types/messageOperations/MessageOperationStatePolicy.d.ts +19 -0
  56. package/dist/types/messageOperations/MessageOperations.d.ts +17 -0
  57. package/dist/types/messageOperations/index.d.ts +3 -0
  58. package/dist/types/messageOperations/types.d.ts +49 -0
  59. package/dist/types/moderation.d.ts +21 -203
  60. package/dist/types/notifications/types.d.ts +8 -7
  61. package/dist/types/offline-support/offline_support_api.d.ts +111 -87
  62. package/dist/types/offline-support/offline_sync_manager.d.ts +0 -7
  63. package/dist/types/offline-support/types.d.ts +19 -23
  64. package/dist/types/offline-support/util.d.ts +4 -2
  65. package/dist/types/pagination/FilterBuilder.d.ts +1 -1
  66. package/dist/types/pagination/ItemIndex.d.ts +25 -0
  67. package/dist/types/pagination/cursorDerivation/createdAtAroundPaginationFlags.d.ts +9 -0
  68. package/dist/types/pagination/cursorDerivation/idAroundPaginationFlags.d.ts +6 -0
  69. package/dist/types/pagination/cursorDerivation/index.d.ts +1 -0
  70. package/dist/types/pagination/cursorDerivation/linearPaginationFlags.d.ts +6 -0
  71. package/dist/types/pagination/filterCompiler.d.ts +7 -0
  72. package/dist/types/pagination/index.d.ts +1 -3
  73. package/dist/types/pagination/paginators/BasePaginator.d.ts +848 -0
  74. package/dist/types/pagination/paginators/ChannelPaginator.d.ts +212 -0
  75. package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +282 -0
  76. package/dist/types/pagination/paginators/MessagePaginator.d.ts +208 -0
  77. package/dist/types/pagination/paginators/PinnedMessagePaginator.d.ts +39 -0
  78. package/dist/types/pagination/paginators/ReminderPaginator.d.ts +19 -0
  79. package/dist/types/pagination/paginators/UserGroupPaginator.d.ts +24 -0
  80. package/dist/types/pagination/paginators/index.d.ts +7 -0
  81. package/dist/types/pagination/paginators/stateThrottling.d.ts +2 -0
  82. package/dist/types/pagination/sortCompiler.d.ts +49 -0
  83. package/dist/types/pagination/types.normalization.d.ts +11 -0
  84. package/dist/types/pagination/utility.normalization.d.ts +18 -0
  85. package/dist/types/pagination/utility.queryChannel.d.ts +26 -0
  86. package/dist/types/pagination/utility.search.d.ts +13 -0
  87. package/dist/types/permissions.d.ts +1 -1
  88. package/dist/types/poll.d.ts +29 -32
  89. package/dist/types/poll_manager.d.ts +2 -2
  90. package/dist/types/reminders/Reminder.d.ts +2 -5
  91. package/dist/types/reminders/ReminderManager.d.ts +2 -9
  92. package/dist/types/search/MessageSearchSource.d.ts +4 -4
  93. package/dist/types/search/UserSearchSource.d.ts +1 -1
  94. package/dist/types/search/types.d.ts +3 -3
  95. package/dist/types/segment.d.ts +0 -34
  96. package/dist/types/signing.d.ts +105 -65
  97. package/dist/types/store.d.ts +1 -0
  98. package/dist/types/thread.d.ts +70 -34
  99. package/dist/types/thread_manager.d.ts +3 -3
  100. package/dist/types/token_manager.d.ts +15 -10
  101. package/dist/types/types.d.ts +197 -3404
  102. package/dist/types/utils/FixedSizeQueueCache.d.ts +12 -6
  103. package/dist/types/utils/WithSubscriptions.d.ts +2 -1
  104. package/dist/types/utils/concurrency.d.ts +4 -4
  105. package/dist/types/utils/mergeWith/mergeWith.d.ts +3 -3
  106. package/dist/types/utils/mergeWith/mergeWithCore.d.ts +8 -3
  107. package/dist/types/utils/retryable.d.ts +34 -0
  108. package/dist/types/utils/throttling/throttle.d.ts +36 -0
  109. package/dist/types/utils.d.ts +100 -194
  110. package/package.json +7 -3
  111. package/src/ChannelManager.ts +724 -0
  112. package/src/CooldownTimer.ts +2 -2
  113. package/src/EventHandlerPipeline.ts +228 -0
  114. package/src/LiveLocationManager.ts +12 -11
  115. package/src/api-client.ts +275 -0
  116. package/src/campaign.ts +1 -77
  117. package/src/channel.ts +1344 -1282
  118. package/src/channel_batch_updater.ts +1 -211
  119. package/src/channel_state.ts +144 -1013
  120. package/src/client.ts +936 -3995
  121. package/src/client_state.ts +4 -4
  122. package/src/configuration/InstanceConfigurationService.ts +73 -0
  123. package/src/configuration/index.ts +1 -0
  124. package/src/configuration/types.ts +81 -0
  125. package/src/connection.ts +145 -94
  126. package/src/connection_fallback.ts +29 -27
  127. package/src/constants.ts +1 -5
  128. package/src/custom_types.ts +4 -1
  129. package/src/entityStore/EntityStore.ts +208 -0
  130. package/src/entityStore/StoreBackedItemIndex.ts +115 -0
  131. package/src/entityStore/applyReactionLocally.ts +113 -0
  132. package/src/entityStore/index.ts +2 -0
  133. package/src/errors.ts +14 -2
  134. package/src/gen/chat/ChannelApi.ts +275 -0
  135. package/src/gen/chat/ChatApi.ts +2554 -0
  136. package/src/gen/model-decoders/decoders.ts +2680 -0
  137. package/src/gen/model-decoders/event-decoder-mapping.ts +198 -0
  138. package/src/gen/models/index.ts +12673 -0
  139. package/src/gen/moderation/ModerationApi.ts +607 -0
  140. package/src/gen-imports.ts +3 -0
  141. package/src/index.ts +11 -12
  142. package/src/insights.ts +6 -5
  143. package/src/logger.ts +28 -0
  144. package/src/messageComposer/LocationComposer.ts +9 -5
  145. package/src/messageComposer/MessageComposerEffectHandlers.ts +1 -0
  146. package/src/messageComposer/attachmentIdentity.ts +16 -9
  147. package/src/messageComposer/attachmentManager.ts +13 -8
  148. package/src/messageComposer/configuration/types.ts +11 -11
  149. package/src/messageComposer/linkPreviewsManager.ts +9 -10
  150. package/src/messageComposer/messageComposer.ts +57 -53
  151. package/src/messageComposer/middleware/messageComposer/attachments.ts +1 -2
  152. package/src/messageComposer/middleware/messageComposer/cleanData.ts +1 -1
  153. package/src/messageComposer/middleware/messageComposer/compositionValidation.ts +2 -2
  154. package/src/messageComposer/middleware/messageComposer/messageComposerState.ts +2 -2
  155. package/src/messageComposer/middleware/messageComposer/sharedLocation.ts +4 -3
  156. package/src/messageComposer/middleware/messageComposer/textComposer.ts +2 -2
  157. package/src/messageComposer/middleware/messageComposer/types.ts +3 -4
  158. package/src/messageComposer/middleware/messageComposer/userDataInjection.ts +9 -5
  159. package/src/messageComposer/middleware/pollComposer/state.ts +0 -2
  160. package/src/messageComposer/middleware/pollComposer/types.ts +4 -7
  161. package/src/messageComposer/middleware/textComposer/TextComposerMiddlewareExecutor.ts +10 -1
  162. package/src/messageComposer/middleware/textComposer/commandEffects.ts +4 -4
  163. package/src/messageComposer/middleware/textComposer/commandUtils.ts +3 -6
  164. package/src/messageComposer/middleware/textComposer/commands.ts +3 -3
  165. package/src/messageComposer/middleware/textComposer/mentionUtils.ts +1 -1
  166. package/src/messageComposer/middleware/textComposer/mentions.ts +31 -15
  167. package/src/messageComposer/middleware/textComposer/types.ts +9 -4
  168. package/src/messageComposer/pollComposer.ts +6 -8
  169. package/src/messageComposer/textComposer.ts +27 -2
  170. package/src/messageComposer/types.ts +6 -28
  171. package/src/messageDelivery/MessageDeliveryReporter.ts +101 -45
  172. package/src/messageDelivery/MessageReceiptsTracker.ts +294 -21
  173. package/src/messageOperations/MessageOperationStatePolicy.ts +77 -0
  174. package/src/messageOperations/MessageOperations.ts +212 -0
  175. package/src/messageOperations/index.ts +10 -0
  176. package/src/messageOperations/types.ts +64 -0
  177. package/src/moderation.ts +38 -431
  178. package/src/notifications/types.ts +8 -7
  179. package/src/offline-support/offline_support_api.ts +200 -133
  180. package/src/offline-support/offline_sync_manager.ts +23 -44
  181. package/src/offline-support/types.ts +23 -26
  182. package/src/offline-support/util.ts +5 -4
  183. package/src/pagination/FilterBuilder.ts +4 -1
  184. package/src/pagination/ItemIndex.ts +25 -0
  185. package/src/pagination/cursorDerivation/createdAtAroundPaginationFlags.ts +73 -0
  186. package/src/pagination/cursorDerivation/idAroundPaginationFlags.ts +53 -0
  187. package/src/pagination/cursorDerivation/index.ts +1 -0
  188. package/src/pagination/cursorDerivation/linearPaginationFlags.ts +86 -0
  189. package/src/pagination/filterCompiler.ts +196 -0
  190. package/src/pagination/index.ts +1 -3
  191. package/src/pagination/paginators/BasePaginator.ts +2859 -0
  192. package/src/pagination/paginators/ChannelPaginator.ts +729 -0
  193. package/src/pagination/paginators/MessageIntervalPaginator.ts +1116 -0
  194. package/src/pagination/paginators/MessagePaginator.ts +508 -0
  195. package/src/pagination/paginators/PinnedMessagePaginator.ts +108 -0
  196. package/src/pagination/paginators/ReminderPaginator.ts +107 -0
  197. package/src/pagination/paginators/UserGroupPaginator.ts +127 -0
  198. package/src/pagination/paginators/index.ts +7 -0
  199. package/src/pagination/paginators/stateThrottling.ts +31 -0
  200. package/src/pagination/sortCompiler.ts +193 -0
  201. package/src/pagination/types.normalization.ts +14 -0
  202. package/src/pagination/utility.normalization.ts +106 -0
  203. package/src/pagination/utility.queryChannel.ts +84 -0
  204. package/src/pagination/utility.search.ts +80 -0
  205. package/src/permissions.ts +7 -8
  206. package/src/poll.ts +101 -110
  207. package/src/poll_manager.ts +14 -8
  208. package/src/reminders/Reminder.ts +2 -5
  209. package/src/reminders/ReminderManager.ts +19 -21
  210. package/src/search/BaseSearchSource.ts +0 -3
  211. package/src/search/ChannelMemberSearchSource.ts +7 -1
  212. package/src/search/ChannelSearchSource.ts +10 -3
  213. package/src/search/MessageSearchSource.ts +29 -30
  214. package/src/search/UserSearchSource.ts +12 -8
  215. package/src/search/types.ts +3 -4
  216. package/src/segment.ts +1 -95
  217. package/src/signing.ts +107 -67
  218. package/src/store.ts +2 -1
  219. package/src/thread.ts +562 -238
  220. package/src/thread_manager.ts +37 -16
  221. package/src/token_manager.ts +21 -10
  222. package/src/types.ts +364 -4533
  223. package/src/uploadManager.ts +8 -0
  224. package/src/utils/FixedSizeQueueCache.ts +12 -6
  225. package/src/utils/WithSubscriptions.ts +2 -1
  226. package/src/utils/concurrency.ts +4 -4
  227. package/src/utils/mergeWith/mergeWith.ts +3 -3
  228. package/src/utils/mergeWith/mergeWithCore.ts +140 -164
  229. package/src/utils/mergeWith/mergeWithDiff.ts +3 -3
  230. package/src/utils/retryable.ts +117 -0
  231. package/src/utils/throttling/throttle.ts +130 -0
  232. package/src/utils.ts +208 -754
  233. package/dist/types/channel_manager.d.ts +0 -122
  234. package/dist/types/events.d.ts +0 -72
  235. package/dist/types/pagination/BasePaginator.d.ts +0 -69
  236. package/dist/types/pagination/ReminderPaginator.d.ts +0 -16
  237. package/dist/types/pagination/UserGroupPaginator.d.ts +0 -21
  238. package/src/channel_manager.ts +0 -830
  239. package/src/events.ts +0 -75
  240. package/src/pagination/BasePaginator.ts +0 -184
  241. package/src/pagination/ReminderPaginator.ts +0 -56
  242. package/src/pagination/UserGroupPaginator.ts +0 -93
@@ -1,189 +1,26 @@
1
- import type { EVENT_MAP } from './events';
2
- import type { Channel } from './channel';
3
1
  import type { AxiosRequestConfig, AxiosResponse } from 'axios';
4
2
  import type { StableWSConnection } from './connection';
5
- import type { Role } from './permissions';
6
- import type { CustomAttachmentData, CustomChannelData, CustomCommandData, CustomEventData, CustomEventTypes, CustomMemberData, CustomMessageData, CustomPollData, CustomPollOptionData, CustomReactionData, CustomThreadData, CustomUserData } from './custom_types';
3
+ import type { CustomChannelData, CustomCommandData, CustomEventTypes } from './custom_types';
7
4
  import type { NotificationManager } from './notifications';
8
5
  import type { RESERVED_UPDATED_MESSAGE_FIELDS } from './constants';
6
+ import type { APIError, Attachment, AutomodDetailsResponse, ChannelConfigWithInfo, ChannelInput, ChannelMemberResponse, ChannelMute, ChannelOwnCapability, ChannelResponse, ChannelStateResponseFields, CreateDeviceRequest, DraftPayloadResponse, Images, MessageResponse, ModerationPayload, OwnUserResponse, PollResponseData, PollVoteResponseData, PrivacySettingsResponse, PushPreferencesResponse, QueryChannelsRequest, QueryFilters, QueryMembersPayload, QueryThreadsRequest, QueryUsersPayload, ReactionResponse, ReminderResponseData, RequireAtLeastOne, SearchPayload, SearchWarning, SendMessageRequest, SendMessageResponse, SharedLocation, SharedLocationResponseData, SortParamRequest, TranslateMessageRequest, UpdateChannelRequest, UpdateMessageRequest, UpdateMessageResponse, UpdatePollOptionRequest, UpdatePollRequest, UserMuteResponse, UserResponse, WSEvent } from './gen/models';
7
+ import type { ChatApi } from './gen-imports';
9
8
  /**
10
9
  * Utility Types
11
10
  */
12
- export type Readable<T> = {
13
- [key in keyof T]: T[key];
14
- } & {};
15
- export type ArrayOneOrMore<T> = {
16
- 0: T;
17
- } & Array<T>;
18
- export type ArrayTwoOrMore<T> = {
19
- 0: T;
20
- 1: T;
21
- } & Array<T>;
22
- export type KnownKeys<T> = {
23
- [K in keyof T]: string extends K ? never : number extends K ? never : K;
24
- } extends {
25
- [_ in keyof T]: infer U;
26
- } ? U : never;
27
- export type RequireAtLeastOne<T> = {
28
- [K in keyof T]-?: Required<Pick<T, K>> & Partial<Omit<T, K>>;
29
- }[keyof T];
30
11
  export type RequireOnlyOne<T, Keys extends keyof T = keyof T> = Omit<T, Keys> & {
31
12
  [K in Keys]-?: Required<Pick<T, K>> & Partial<Record<Exclude<Keys, K>, undefined>>;
32
13
  }[Keys];
33
- export type PartializeKeys<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T, K>;
34
14
  export type UR = Record<string, unknown>;
35
- export type UnknownType = UR;
36
15
  export type Unpacked<T> = T extends (infer U)[] ? U : T extends (...args: any[]) => infer U ? U : T extends Promise<infer U> ? U : T;
37
16
  /**
38
17
  * Response Types
39
18
  */
40
19
  export type APIResponse = {
41
20
  duration: string;
42
- blocklist?: BlockListResponse;
43
- };
44
- export type TranslateResponse = {
45
- language: string;
46
- translated_text: string;
47
- };
48
- export type AppSettingsAPIResponse = APIResponse & {
49
- app?: {
50
- id?: string | number;
51
- allow_multi_user_devices?: boolean;
52
- feed_audit_logs_enabled?: boolean;
53
- moderation_onboarding_complete?: boolean | null;
54
- call_types: any;
55
- channel_configs: Record<string, {
56
- reminders: boolean;
57
- automod?: ChannelConfigAutomod;
58
- automod_behavior?: ChannelConfigAutomodBehavior;
59
- automod_thresholds?: ChannelConfigAutomodThresholds;
60
- blocklist_behavior?: ChannelConfigAutomodBehavior;
61
- commands?: CommandVariants[];
62
- connect_events?: boolean;
63
- created_at?: string;
64
- custom_events?: boolean;
65
- delivery_events?: boolean;
66
- mark_messages_pending?: boolean;
67
- max_message_length?: number;
68
- message_retention?: string;
69
- mutes?: boolean;
70
- name?: string;
71
- polls?: boolean;
72
- push_notifications?: boolean;
73
- quotes?: boolean;
74
- reactions?: boolean;
75
- read_events?: boolean;
76
- replies?: boolean;
77
- search?: boolean;
78
- shared_locations?: boolean;
79
- skip_last_msg_update_for_system_msgs?: boolean;
80
- count_messages?: boolean;
81
- typing_events?: boolean;
82
- updated_at?: string;
83
- uploads?: boolean;
84
- url_enrichment?: boolean;
85
- user_message_reminders?: boolean;
86
- push_level?: 'all' | 'all_mentions' | 'direct_mentions' | 'mentions' | 'none' | '';
87
- }>;
88
- reminders_interval: number;
89
- async_moderation_config?: AsyncModerationOptions;
90
- async_url_enrich_enabled?: boolean;
91
- auto_translation_enabled?: boolean;
92
- before_message_send_hook_url?: string;
93
- before_message_send_hook_attempt_timeout_ms?: number;
94
- campaign_enabled?: boolean;
95
- cdn_expiration_seconds?: number;
96
- custom_action_handler_url?: string;
97
- datadog_info?: {
98
- api_key: string;
99
- site: string;
100
- enabled?: boolean;
101
- };
102
- disable_auth_checks?: boolean;
103
- disable_permissions_checks?: boolean;
104
- enforce_unique_usernames?: 'no' | 'app' | 'team';
105
- event_hooks?: Array<EventHook>;
106
- file_upload_config?: FileUploadConfig;
107
- geofences?: Array<{
108
- country_codes: Array<string>;
109
- description: string;
110
- name: string;
111
- type: string;
112
- }>;
113
- grants?: Record<string, string[]>;
114
- guest_user_creation_disabled?: boolean;
115
- image_moderation_enabled?: boolean;
116
- image_moderation_labels?: string[];
117
- image_upload_config?: FileUploadConfig;
118
- allowed_flag_reasons?: string[];
119
- max_aggregated_activities_length?: number;
120
- moderation_bulk_submit_action_enabled?: boolean;
121
- moderation_dashboard_preferences?: Record<string, unknown> | null;
122
- moderation_audio_call_moderation_enabled?: boolean;
123
- moderation_enabled?: boolean;
124
- moderation_flood_rules_enabled?: boolean;
125
- moderation_llm_configurability_enabled?: boolean;
126
- moderation_multitenant_blocklist_enabled?: boolean;
127
- moderation_video_call_moderation_enabled?: boolean;
128
- moderation_webhook_url?: string;
129
- multi_tenant_enabled?: boolean;
130
- name?: string;
131
- organization?: string;
132
- permission_version?: string;
133
- /**
134
- * The placement of the app in the form of `${region}.${shard}`.
135
- * Examples: "us-east.c1", "dublin.c3", "singapore.c2"
136
- * Note: The backend may add/remove regions or shards occasionally.
137
- */
138
- placement?: string;
139
- policies?: Record<string, Policy[]>;
140
- poll_enabled?: boolean;
141
- push_notifications?: {
142
- offline_only: boolean;
143
- version: string;
144
- apn?: APNConfig;
145
- firebase?: FirebaseConfig;
146
- huawei?: HuaweiConfig;
147
- providers?: PushProviderConfig[];
148
- xiaomi?: XiaomiConfig;
149
- };
150
- revoke_tokens_issued_before?: string | null;
151
- search_backend?: 'disabled' | 'elasticsearch' | 'postgres';
152
- sns_key?: string;
153
- sns_secret?: string;
154
- sns_topic_arn?: string;
155
- sqs_key?: string;
156
- sqs_secret?: string;
157
- sqs_url?: string;
158
- suspended?: boolean;
159
- suspended_explanation?: string;
160
- use_hook_v2?: boolean;
161
- user_response_time_enabled?: boolean;
162
- user_search_disallowed_roles?: string[] | null;
163
- video_provider?: string;
164
- webhook_events?: Array<string>;
165
- webhook_url?: string;
166
- };
167
- };
168
- export type ModerationResult = {
169
- action: string;
170
- created_at: string;
171
- message_id: string;
172
- updated_at: string;
173
- user_bad_karma: boolean;
174
- user_karma: number;
175
- blocked_word?: string;
176
- blocklist_name?: string;
177
- moderated_by?: string;
178
- };
179
- export type AutomodDetails = {
180
- action?: string;
181
- image_labels?: Array<string>;
182
- original_message_type?: string;
183
- result?: ModerationResult;
184
21
  };
185
22
  export type FlagDetails = {
186
- automod?: AutomodDetails;
23
+ automod?: AutomodDetailsResponse;
187
24
  };
188
25
  export type Flag = {
189
26
  created_at: string;
@@ -194,231 +31,8 @@ export type Flag = {
194
31
  target_user?: UserResponse;
195
32
  user?: UserResponse;
196
33
  };
197
- export type FlagsResponse = APIResponse & {
198
- flags?: Array<Flag>;
199
- };
200
- export type MessageFlagsResponse = APIResponse & {
201
- flags?: Array<{
202
- message: MessageResponse;
203
- user: UserResponse;
204
- approved_at?: string;
205
- created_at?: string;
206
- created_by_automod?: boolean;
207
- moderation_result?: ModerationResult;
208
- rejected_at?: string;
209
- reviewed_at?: string;
210
- reviewed_by?: UserResponse;
211
- updated_at?: string;
212
- }>;
213
- };
214
- export type FlagReport = {
215
- flags_count: number;
216
- id: string;
217
- message: MessageResponse;
218
- user: UserResponse;
219
- created_at?: string;
220
- details?: FlagDetails;
221
- first_reporter?: UserResponse;
222
- review_result?: string;
223
- reviewed_at?: string;
224
- reviewed_by?: UserResponse;
225
- updated_at?: string;
226
- };
227
- export type FlagReportsResponse = APIResponse & {
228
- flag_reports: Array<FlagReport>;
229
- };
230
- export type ReviewFlagReportResponse = APIResponse & {
231
- flag_report: FlagReport;
232
- };
233
- export type BannedUsersResponse = APIResponse & {
234
- bans?: Array<{
235
- user: UserResponse;
236
- banned_by?: UserResponse;
237
- channel?: ChannelResponse;
238
- expires?: string;
239
- ip_ban?: boolean;
240
- reason?: string;
241
- timeout?: number;
242
- }>;
243
- };
244
- export type FutureChannelBan = {
245
- user: UserResponse;
246
- expires?: string;
247
- reason?: string;
248
- shadow?: boolean;
249
- created_at: string;
250
- };
251
- export type FutureChannelBansResponse = APIResponse & {
252
- bans: FutureChannelBan[];
253
- };
254
- export type QueryFutureChannelBansOptions = {
255
- user_id?: string;
256
- target_user_id?: string;
257
- exclude_expired_bans?: boolean;
258
- limit?: number;
259
- offset?: number;
260
- };
261
- export type BlockListResponse = BlockList & {
262
- created_at?: string;
263
- id?: string;
264
- owner_user_id?: string;
265
- type?: string;
266
- updated_at?: string;
267
- };
268
- export type ChannelResponse = CustomChannelData & {
269
- cid: string;
270
- disabled: boolean;
271
- frozen: boolean;
272
- id: string;
273
- type: string;
274
- blocked?: boolean;
275
- auto_translation_enabled?: boolean;
276
- auto_translation_language?: TranslationLanguages;
277
- hide_messages_before?: string;
278
- config?: ChannelConfigWithInfo;
279
- cooldown?: number;
280
- created_at?: string;
281
- created_by?: UserResponse | null;
282
- created_by_id?: string;
283
- deleted_at?: string;
284
- filter_tags?: string[];
285
- hidden?: boolean;
286
- invites?: string[];
287
- joined?: boolean;
288
- last_message_at?: string;
289
- member_count?: number;
290
- members?: ChannelMemberResponse[];
291
- message_count?: number;
292
- muted?: boolean;
293
- mute_expires_at?: string;
294
- own_capabilities?: string[];
295
- team?: string;
296
- truncated_at?: string;
297
- truncated_by?: UserResponse;
298
- truncated_by_id?: string;
299
- updated_at?: string;
300
- };
301
- export type QueryReactionsOptions = Pager;
302
- export type QueryReactionsAPIResponse = APIResponse & {
303
- reactions: ReactionResponse[];
304
- next?: string;
305
- };
306
- export type QueryChannelsAPIResponse = APIResponse & {
307
- channels: Omit<ChannelAPIResponse, keyof APIResponse>[];
308
- predefined_filter?: ParsedPredefinedFilterResponse;
309
- };
310
- export type QueryChannelAPIResponse = APIResponse & ChannelAPIResponse;
311
- export type ChannelAPIResponse = {
312
- channel: ChannelResponse;
313
- members: ChannelMemberResponse[];
314
- messages: MessageResponse[];
315
- pinned_messages: MessageResponse[];
316
- draft?: DraftResponse;
317
- hidden?: boolean;
318
- membership?: ChannelMemberResponse | null;
319
- pending_messages?: PendingMessageResponse[];
320
- push_preferences?: ChannelPushPreference;
321
- read?: ReadResponse[];
322
- threads?: ThreadResponse[];
323
- watcher_count?: number;
324
- watchers?: UserResponse[];
325
- active_live_locations?: SharedLocationResponse[];
326
- };
327
- export type ChannelUpdateOptions = {
328
- hide_history?: boolean;
329
- hide_history_before?: string | Date;
330
- skip_push?: boolean;
331
- };
332
- export type ChannelMemberAPIResponse = APIResponse & {
333
- members: ChannelMemberResponse[];
334
- };
335
- export type ChannelMemberUpdates = CustomMemberData & {
336
- archived?: boolean;
337
- channel_role?: Role;
338
- pinned?: boolean;
339
- };
340
- export type ChannelMemberResponse = CustomMemberData & {
341
- archived_at?: string | null;
342
- ban_expires?: string;
343
- banned?: boolean;
344
- channel_role?: Role;
345
- created_at?: string;
346
- invite_accepted_at?: string;
347
- invite_rejected_at?: string;
348
- invited?: boolean;
349
- is_moderator?: boolean;
350
- notifications_muted?: boolean;
351
- pinned_at?: string | null;
352
- role?: string;
353
- shadow_banned?: boolean;
354
- status?: InviteStatus;
355
- updated_at?: string;
356
- user?: UserResponse;
357
- user_id?: string;
358
- };
359
- export type PartialUpdateMemberAPIResponse = APIResponse & {
360
- channel_member: ChannelMemberResponse;
361
- };
362
- export type CheckPushResponse = APIResponse & {
363
- device_errors?: {
364
- [deviceID: string]: {
365
- error_message?: string;
366
- provider?: PushProvider;
367
- provider_name?: string;
368
- };
369
- };
370
- general_errors?: string[];
371
- rendered_apn_template?: string;
372
- rendered_firebase_template?: string;
373
- rendered_message?: {};
374
- skip_devices?: boolean;
375
- };
376
- export type CheckSQSResponse = APIResponse & {
377
- status: string;
378
- data?: {};
379
- error?: string;
380
- };
381
- export type CheckSNSResponse = APIResponse & {
382
- status: string;
383
- data?: {};
384
- error?: string;
385
- };
386
- export type CommandResponse = Partial<CreatedAtUpdatedAt> & {
387
- args?: string;
388
- description?: string;
389
- name?: CommandVariants;
390
- set?: CommandVariants;
391
- };
34
+ export type ChannelUpdateOptions = Omit<UpdateChannelRequest, 'message' | 'members'>;
392
35
  export type ConnectAPIResponse = Promise<void | ConnectionOpen>;
393
- export type CreateChannelResponse = APIResponse & Omit<CreateChannelOptions, 'client_id' | 'connection_id'> & {
394
- created_at: string;
395
- updated_at: string;
396
- grants?: Record<string, string[]>;
397
- };
398
- export type CreateCommandResponse = APIResponse & {
399
- command: CreateCommandOptions & CreatedAtUpdatedAt;
400
- };
401
- export type DeleteChannelAPIResponse = APIResponse & {
402
- channel: ChannelResponse;
403
- };
404
- export type DeleteCommandResponse = APIResponse & {
405
- name?: CommandVariants;
406
- };
407
- export type EventAPIResponse = APIResponse & {
408
- event: Event;
409
- };
410
- export type ExportChannelResponse = {
411
- task_id: string;
412
- };
413
- export type ExportUsersResponse = {
414
- task_id: string;
415
- };
416
- export type ExportChannelStatusResponse = {
417
- created_at?: string;
418
- error?: {};
419
- result?: {};
420
- updated_at?: string;
421
- };
422
36
  export type FlagMessageResponse = APIResponse & {
423
37
  flag: {
424
38
  created_at: string;
@@ -451,351 +65,52 @@ export type FlagUserResponse = APIResponse & {
451
65
  };
452
66
  review_queue_item_id?: string;
453
67
  };
454
- export type LocalMessageBase = Omit<MessageResponseBase, 'created_at' | 'deleted_at' | 'pinned_at' | 'status' | 'updated_at'> & {
455
- created_at: Date;
456
- deleted_at: Date | null;
457
- pinned_at: Date | null;
68
+ export type LocalMessage = MessageResponse & {
458
69
  status: string;
459
- updated_at: Date;
460
- };
461
- export type LocalMessage = LocalMessageBase & {
462
- error?: ErrorFromResponse<APIErrorResponse> | null;
463
- quoted_message?: LocalMessageBase | null;
70
+ error?: StreamAPIError;
71
+ user_id?: string;
464
72
  };
465
- /**
466
- * @deprecated in favor of LocalMessage
467
- */
468
- export type FormatMessageResponse = LocalMessage;
469
- export type GetCommandResponse = APIResponse & CreateCommandOptions & CreatedAtUpdatedAt;
470
- export type GetMessageAPIResponse = SendMessageAPIResponse;
471
- export interface ThreadResponse extends CustomThreadData {
472
- channel: ChannelResponse;
473
- channel_cid: string;
474
- created_at: string;
475
- created_by_user_id: string;
476
- latest_replies: Array<MessageResponse>;
477
- parent_message: MessageResponse;
478
- parent_message_id: string;
479
- title: string;
480
- updated_at: string;
481
- active_participant_count?: number;
482
- created_by?: UserResponse;
483
- deleted_at?: string;
484
- draft?: DraftResponse;
485
- last_message_at?: string;
486
- participant_count?: number;
487
- read?: Array<ReadResponse>;
488
- reply_count?: number;
489
- thread_participants?: Array<{
490
- channel_cid: string;
491
- created_at: string;
492
- last_read_at: string;
493
- last_thread_message_at?: string;
494
- left_thread_at?: string;
495
- thread_id?: string;
496
- user?: UserResponse;
497
- user_id?: string;
498
- }>;
499
- }
500
73
  export type PartialThreadUpdate = {
501
74
  set?: Partial<Record<string, unknown>>;
502
75
  unset?: Array<string>;
503
76
  };
504
- export type QueryThreadsOptions = {
505
- filter?: ThreadFilters;
506
- limit?: number;
507
- member_limit?: number;
508
- next?: string;
509
- participant_limit?: number;
510
- reply_limit?: number;
511
- sort?: ThreadSort;
512
- watch?: boolean;
513
- };
514
- export type QueryThreadsAPIResponse = APIResponse & {
515
- threads: ThreadResponse[];
516
- next?: string;
517
- };
518
- export type GetThreadOptions = {
519
- member_limit?: number;
520
- participant_limit?: number;
521
- reply_limit?: number;
522
- watch?: boolean;
523
- };
524
- export type GetThreadAPIResponse = APIResponse & {
525
- thread: ThreadResponse;
526
- };
527
- export type GetMultipleMessagesAPIResponse = APIResponse & {
528
- messages: MessageResponse[];
529
- };
530
- export type GetRateLimitsResponse = APIResponse & {
531
- android?: RateLimitsMap;
532
- ios?: RateLimitsMap;
533
- server_side?: RateLimitsMap;
534
- web?: RateLimitsMap;
535
- };
77
+ export type GetThreadOptions = Omit<Parameters<ChatApi['getThread']>[0], 'message_id'>;
536
78
  export declare enum Product {
537
79
  Chat = "chat",
538
80
  Video = "video",
539
81
  Moderation = "moderation",
540
82
  Feeds = "feeds"
541
83
  }
542
- export type HookEvent = {
543
- name: string;
544
- description: string;
545
- products: Product[];
546
- };
547
- export type GetHookEventsResponse = APIResponse & {
548
- events: HookEvent[];
549
- };
550
- export type GetReactionsAPIResponse = APIResponse & {
551
- reactions: ReactionResponse[];
552
- };
553
84
  export type GetRepliesAPIResponse = APIResponse & {
554
85
  messages: MessageResponse[];
555
86
  };
556
- export type GetUnreadCountAPIResponse = APIResponse & {
557
- channel_type: {
558
- channel_count: number;
559
- channel_type: string;
560
- unread_count: number;
561
- }[];
562
- channels: {
563
- channel_id: string;
564
- last_read: string;
565
- unread_count: number;
566
- }[];
567
- threads: {
568
- last_read: string;
569
- last_read_message_id: string;
570
- parent_message_id: string;
571
- unread_count: number;
572
- }[];
573
- total_unread_count: number;
574
- total_unread_threads_count: number;
575
- total_unread_count_by_team?: Record<string, number>;
576
- };
577
- export type ChatLevelPushPreference = 'all' | 'mentions' | 'direct_mentions' | 'all_mentions' | 'none' | 'default' | (string & {});
578
- export type CallLevelPushPreference = 'all' | 'none' | 'default' | (string & {});
579
- /** Granular all/none toggle used by the chat sub-preferences. */
580
- export type PushPreferenceLevel = 'all' | 'none' | (string & {});
581
- /** Per-mention-type chat push preferences (matches OpenAPI `ChatPreferencesInput`). */
582
- export type ChatPreferences = {
583
- channel_mentions?: PushPreferenceLevel;
584
- default_preference?: PushPreferenceLevel;
585
- direct_mentions?: PushPreferenceLevel;
586
- group_mentions?: PushPreferenceLevel;
587
- here_mentions?: PushPreferenceLevel;
588
- role_mentions?: PushPreferenceLevel;
589
- thread_replies?: PushPreferenceLevel;
590
- };
591
- /**
592
- * Input accepted by {@link StreamChat.setPushPreferences} (matches OpenAPI `PushPreferenceInput`).
593
- *
594
- * Set `channel_cid` to scope the preference to a single channel; leave it empty to
595
- * set the user-level default. `user_id` is required for server-side auth and
596
- * defaults to the connected user for client-side auth.
597
- */
598
- export type PushPreference = {
599
- call_level?: CallLevelPushPreference;
600
- channel_cid?: string;
601
- chat_level?: ChatLevelPushPreference;
602
- chat_preferences?: ChatPreferences;
603
- disabled_until?: string;
604
- remove_disable?: boolean;
605
- user_id?: string;
606
- };
607
- /** Per-user push preferences returned by the API (matches OpenAPI `PushPreferencesResponse`). */
608
- export type PushPreferencesResponse = {
609
- call_level?: CallLevelPushPreference;
610
- chat_level?: ChatLevelPushPreference;
611
- chat_preferences?: ChatPreferences;
612
- disabled_until?: string;
613
- };
614
- /** Per-channel push preferences returned by the API (matches OpenAPI `ChannelPushPreferencesResponse`). */
615
- export type ChannelPushPreference = {
616
- chat_level?: ChatLevelPushPreference;
617
- disabled_until?: string;
618
- };
619
- export type UpsertPushPreferencesResponse = APIResponse & {
620
- user_channel_preferences: Record<string, Record<string, ChannelPushPreference>>;
621
- user_preferences: Record<string, PushPreferencesResponse>;
622
- };
623
- export type GetUnreadCountBatchAPIResponse = APIResponse & {
624
- counts_by_user: {
625
- [userId: string]: GetUnreadCountAPIResponse;
626
- };
627
- };
628
- export type ListChannelResponse = APIResponse & {
629
- channel_types: Record<string, Omit<CreateChannelOptions, 'client_id' | 'connection_id' | 'commands'> & {
630
- commands: CommandResponse[];
631
- created_at: string;
632
- updated_at: string;
633
- grants?: Record<string, string[]>;
634
- }>;
635
- };
636
- export type ListChannelTypesAPIResponse = ListChannelResponse;
637
- export type ListCommandsResponse = APIResponse & {
638
- commands: Array<CreateCommandOptions & Partial<CreatedAtUpdatedAt>>;
639
- };
640
- export type MuteChannelAPIResponse = APIResponse & {
641
- channel_mute: ChannelMute;
642
- own_user: OwnUserResponse;
643
- channel_mutes?: ChannelMute[];
644
- mute?: MuteResponse;
645
- };
646
- export type MessageResponse = MessageResponseBase & {
647
- quoted_message?: MessageResponseBase;
648
- };
649
- export type MessageResponseBase = MessageBase & {
650
- type: MessageLabel;
651
- args?: string;
652
- before_message_send_failed?: boolean;
653
- channel?: ChannelResponse;
654
- cid?: string;
655
- command?: string;
656
- command_info?: {
657
- name?: string;
658
- };
659
- created_at?: string;
660
- deleted_at?: string;
661
- deleted_reply_count?: number;
662
- i18n?: RequireAtLeastOne<Record<`${TranslationLanguages}_text`, string>> & {
663
- language: TranslationLanguages;
664
- };
665
- latest_reactions?: ReactionResponse[];
666
- member?: ChannelMemberResponse;
667
- mentioned_users?: UserResponse[];
668
- mentioned_channel?: boolean;
669
- mentioned_here?: boolean;
670
- mentioned_group_ids?: string[];
671
- mentioned_groups?: UserGroupResponse[];
672
- mentioned_roles?: string[];
673
- message_text_updated_at?: string;
674
- moderation?: ModerationResponse;
675
- moderation_details?: ModerationDetailsResponse;
676
- own_reactions?: ReactionResponse[] | null;
677
- pin_expires?: string | null;
678
- pinned_at?: string | null;
679
- pinned_by?: UserResponse | null;
680
- poll?: PollResponse;
681
- reaction_counts?: {
682
- [key: string]: number;
683
- } | null;
684
- reaction_groups?: {
685
- [key: string]: ReactionGroupResponse;
686
- } | null;
687
- reaction_scores?: {
688
- [key: string]: number;
689
- } | null;
690
- reminder?: ReminderResponseBase;
691
- reply_count?: number;
692
- shadowed?: boolean;
693
- shared_location?: SharedLocationResponse;
694
- status?: string;
695
- thread_participants?: UserResponse[];
696
- updated_at?: string;
697
- deleted_for_me?: boolean;
698
- };
699
- export type ReactionGroupResponse = {
700
- count: number;
701
- sum_scores: number;
702
- first_reaction_at?: string;
703
- last_reaction_at?: string;
704
- latest_reactions_by?: ReactionGroupUserResponse[];
705
- };
706
- export type ReactionGroupUserResponse = {
707
- created_at: string;
708
- user_id: string;
709
- user?: UserResponse;
710
- };
711
- export type ModerationDetailsResponse = {
712
- action: 'MESSAGE_RESPONSE_ACTION_BOUNCE' | (string & {});
713
- error_msg: string;
714
- harms: ModerationHarmResponse[];
715
- original_text: string;
716
- };
717
- export type ModerationHarmResponse = {
718
- name: string;
719
- phrase_list_ids: number[];
720
- };
721
- export type ModerationAction = 'bounce' | 'flag' | 'remove' | 'shadow';
722
- export type ModerationResponse = {
723
- action: ModerationAction;
724
- original_text: string;
725
- };
726
- export type MuteResponse = {
727
- user: UserResponse;
728
- created_at?: string;
729
- expires?: string;
730
- target?: UserResponse;
731
- updated_at?: string;
732
- };
733
87
  export type MuteUserResponse = APIResponse & {
734
- mute?: MuteResponse;
735
- mutes?: Array<Mute>;
88
+ mute?: UserMuteResponse;
89
+ mutes?: Array<UserMuteResponse>;
736
90
  own_user?: OwnUserResponse;
737
91
  non_existing_users?: string[];
738
92
  };
739
93
  export type UnmuteUserResponse = APIResponse & {
740
94
  non_existing_users?: string[];
741
95
  };
742
- export type BlockUserAPIResponse = APIResponse & {
743
- blocked_at: string;
744
- blocked_by_user_id: string;
745
- blocked_user_id: string;
746
- };
747
- export type GetBlockedUsersAPIResponse = APIResponse & {
748
- blocks: BlockedUserDetails[];
749
- };
750
- export type BlockedUserDetails = APIResponse & {
751
- blocked_user: UserResponse;
752
- blocked_user_id: string;
753
- created_at: string;
754
- user: UserResponse;
755
- user_id: string;
756
- };
757
96
  export type OwnUserBase = {
758
97
  channel_mutes: ChannelMute[];
759
98
  devices: Device[];
760
- mutes: Mute[];
99
+ mutes: UserMuteResponse[];
761
100
  total_unread_count: number;
762
101
  unread_channels: number;
763
102
  unread_count: number;
764
103
  unread_threads: number;
765
104
  invisible?: boolean;
766
- privacy_settings?: PrivacySettings;
105
+ privacy_settings?: PrivacySettingsResponse;
767
106
  push_preferences?: PushPreferencesResponse;
768
107
  roles?: string[];
769
108
  total_unread_count_by_team?: Record<string, number> | null;
770
109
  };
771
- export type OwnUserResponse = UserResponse & OwnUserBase;
772
- export type PartialUpdateChannelAPIResponse = APIResponse & {
773
- channel: ChannelResponse;
774
- members: ChannelMemberResponse[];
775
- };
776
- export type PermissionAPIResponse = APIResponse & {
777
- permission?: PermissionAPIObject;
778
- };
779
- export type PermissionsAPIResponse = APIResponse & {
780
- permissions?: PermissionAPIObject[];
781
- };
782
110
  export type ReactionAPIResponse = APIResponse & {
783
111
  message: MessageResponse;
784
112
  reaction: ReactionResponse;
785
113
  };
786
- export type ReactionResponse = Reaction & {
787
- created_at: string;
788
- message_id: string;
789
- updated_at: string;
790
- };
791
- export type ReadResponse = {
792
- last_read: string;
793
- user: UserResponse;
794
- last_read_message_id?: string;
795
- unread_messages?: number;
796
- last_delivered_at?: string;
797
- last_delivered_message_id?: string;
798
- };
799
114
  export type SearchAPIResponse = APIResponse & {
800
115
  results: {
801
116
  message: MessageResponse;
@@ -804,145 +119,19 @@ export type SearchAPIResponse = APIResponse & {
804
119
  previous?: string;
805
120
  results_warning?: SearchWarning | null;
806
121
  };
807
- export type RoleResponse = {
808
- name: Role;
809
- custom: boolean;
810
- scopes: string[];
811
- created_at: string;
812
- updated_at: string;
813
- };
814
- export type CreateRoleAPIResponse = APIResponse & {
815
- role: RoleResponse;
816
- };
817
- export type ListRolesAPIResponse = APIResponse & {
818
- roles: RoleResponse[];
819
- };
820
- export type SearchRolesAPIResponse = APIResponse & {
821
- roles: RoleResponse[];
822
- };
823
- export type SearchRolesOptions = {
824
- query: string;
825
- include_global_roles?: boolean;
826
- limit?: number;
827
- name_gt?: string;
828
- role_type?: 'user' | 'channel';
829
- };
830
- export type SearchWarning = {
831
- channel_search_cids: string[];
832
- channel_search_count: number;
833
- warning_code: number;
834
- warning_description: string;
835
- };
836
122
  export type SendFileAPIResponse = APIResponse & {
837
123
  file: string;
838
124
  thumb_url?: string;
839
125
  };
840
- export type SendMessageAPIResponse = APIResponse & {
841
- message: MessageResponse;
842
- pending_message_metadata?: Record<string, string> | null;
843
- };
844
- export type SyncResponse = APIResponse & {
845
- events: Event[];
846
- inaccessible_cids?: string[];
847
- };
848
- export type TruncateChannelAPIResponse = APIResponse & {
849
- channel: ChannelResponse;
850
- message?: MessageResponse;
851
- };
852
126
  export type UpdateChannelAPIResponse = APIResponse & {
853
127
  channel: ChannelResponse;
854
128
  members: ChannelMemberResponse[];
855
129
  message?: MessageResponse;
856
130
  };
857
- export type UpdateChannelResponse = APIResponse & Omit<CreateChannelOptions, 'client_id' | 'connection_id'> & {
858
- created_at: string;
859
- updated_at: string;
860
- };
861
- export type UpdateCommandResponse = APIResponse & {
862
- command: UpdateCommandOptions & CreatedAtUpdatedAt & {
863
- name: CommandVariants;
864
- };
865
- };
866
- export type UpdateMessageAPIResponse = APIResponse & {
867
- message: MessageResponse;
868
- };
869
131
  export type UsersAPIResponse = APIResponse & {
870
132
  users: Array<UserResponse>;
871
133
  membership_deletion_task_id?: string;
872
134
  };
873
- export type UpdateUsersAPIResponse = APIResponse & {
874
- users: {
875
- [key: string]: UserResponse;
876
- };
877
- membership_deletion_task_id?: string;
878
- };
879
- export type UserResponse = CustomUserData & {
880
- id: string;
881
- anon?: boolean;
882
- banned?: boolean;
883
- blocked_user_ids?: string[];
884
- /** Set on the user of a read event, marking when they last read the event's channel. */
885
- channel_last_read_at?: string;
886
- created_at?: string;
887
- deactivated_at?: string;
888
- deleted_at?: string;
889
- image?: string;
890
- language?: TranslationLanguages | '';
891
- last_active?: string;
892
- name?: string;
893
- notifications_muted?: boolean;
894
- online?: boolean;
895
- privacy_settings?: PrivacySettings;
896
- push_notifications?: PushNotificationSettings;
897
- revoke_tokens_issued_before?: string;
898
- role?: string;
899
- shadow_banned?: boolean;
900
- teams?: string[];
901
- teams_role?: TeamsRole | null;
902
- updated_at?: string;
903
- username?: string;
904
- avg_response_time?: number;
905
- };
906
- export type TeamsRole = {
907
- [team: string]: string;
908
- };
909
- export type PrivacySettings = {
910
- read_receipts?: {
911
- enabled?: boolean;
912
- };
913
- typing_indicators?: {
914
- enabled?: boolean;
915
- };
916
- delivery_receipts?: {
917
- enabled?: boolean;
918
- };
919
- };
920
- export type PushNotificationSettings = {
921
- disabled?: boolean;
922
- disabled_until?: string | null;
923
- };
924
- /**
925
- * Option Types
926
- */
927
- export type MessageFlagsPaginationOptions = {
928
- limit?: number;
929
- offset?: number;
930
- };
931
- export type FlagsPaginationOptions = {
932
- limit?: number;
933
- offset?: number;
934
- };
935
- export type FlagReportsPaginationOptions = {
936
- limit?: number;
937
- offset?: number;
938
- };
939
- export type ReviewFlagReportOptions = {
940
- review_details?: object;
941
- user_id?: string;
942
- };
943
- export type BannedUsersPaginationOptions = Omit<PaginationOptions, 'id_gt' | 'id_gte' | 'id_lt' | 'id_lte'> & {
944
- exclude_expired_bans?: boolean;
945
- };
946
135
  export type BanUserOptions = UnBanUserOptions & {
947
136
  ban_from_future_channels?: boolean;
948
137
  banned_by?: UserResponse;
@@ -994,20 +183,6 @@ export type ChannelOptions = {
994
183
  */
995
184
  sort_values?: Record<string, unknown>;
996
185
  };
997
- export type ChannelQueryOptions = {
998
- client_id?: string;
999
- connection_id?: string;
1000
- created_by?: UserResponse | null;
1001
- created_by_id?: UserResponse['id'];
1002
- data?: ChannelResponse;
1003
- hide_for_creator?: boolean;
1004
- members?: PaginationOptions;
1005
- messages?: MessagePaginationOptions;
1006
- presence?: boolean;
1007
- state?: boolean;
1008
- watch?: boolean;
1009
- watchers?: PaginationOptions;
1010
- };
1011
186
  export type ChannelStateOptions = {
1012
187
  offlineMode?: boolean;
1013
188
  skipInitialization?: string[];
@@ -1022,70 +197,6 @@ export type ChannelStateOptions = {
1022
197
  */
1023
198
  withResponse?: boolean;
1024
199
  };
1025
- export type CreateChannelOptions = {
1026
- automod?: ChannelConfigAutomod;
1027
- automod_behavior?: ChannelConfigAutomodBehavior;
1028
- automod_thresholds?: ChannelConfigAutomodThresholds;
1029
- blocklist?: string;
1030
- blocklist_behavior?: ChannelConfigAutomodBehavior;
1031
- client_id?: string;
1032
- commands?: CommandVariants[];
1033
- connect_events?: boolean;
1034
- connection_id?: string;
1035
- custom_events?: boolean;
1036
- delivery_events?: boolean;
1037
- grants?: Record<string, string[]>;
1038
- mark_messages_pending?: boolean;
1039
- max_message_length?: number;
1040
- message_retention?: string;
1041
- mutes?: boolean;
1042
- name?: string;
1043
- permissions?: PermissionObject[];
1044
- polls?: boolean;
1045
- push_notifications?: boolean;
1046
- quotes?: boolean;
1047
- reactions?: boolean;
1048
- read_events?: boolean;
1049
- reminders?: boolean;
1050
- replies?: boolean;
1051
- search?: boolean;
1052
- shared_locations?: boolean;
1053
- skip_last_msg_update_for_system_msgs?: boolean;
1054
- typing_events?: boolean;
1055
- uploads?: boolean;
1056
- url_enrichment?: boolean;
1057
- user_message_reminders?: boolean;
1058
- count_messages?: boolean;
1059
- push_level?: 'all' | 'all_mentions' | 'direct_mentions' | 'mentions' | 'none';
1060
- };
1061
- export type CreateCommandOptions = {
1062
- description: string;
1063
- name: CommandVariants;
1064
- args?: string;
1065
- set?: CommandVariants;
1066
- };
1067
- export type CustomPermissionOptions = {
1068
- action: string;
1069
- condition: object;
1070
- id: string;
1071
- name: string;
1072
- description?: string;
1073
- owner?: boolean;
1074
- same_team?: boolean;
1075
- };
1076
- export type DeactivateUsersOptions = {
1077
- created_by_id?: string;
1078
- mark_messages_deleted?: boolean;
1079
- };
1080
- export type NewMemberPayload = CustomMemberData & Pick<ChannelMemberResponse, 'user_id' | 'channel_role'>;
1081
- export type Thresholds = Partial<Record<'explicit' | 'spam' | 'toxic', Partial<{
1082
- block: number;
1083
- flag: number;
1084
- }>>>;
1085
- export type BlockListOptions = {
1086
- behavior: BlocklistBehavior;
1087
- blocklist: string;
1088
- };
1089
200
  export type PolicyRequest = {
1090
201
  action: 'Deny' | 'Allow' | (string & {});
1091
202
  /**
@@ -1108,191 +219,14 @@ export type PolicyRequest = {
1108
219
  };
1109
220
  export type Automod = 'disabled' | 'simple' | 'AI' | (string & {});
1110
221
  export type AutomodBehavior = 'flag' | 'block' | 'shadow_block' | (string & {});
1111
- export type BlocklistBehavior = AutomodBehavior;
1112
- export type Command = {
1113
- args: string;
1114
- description: string;
1115
- name: string;
1116
- set: string;
1117
- created_at?: string;
1118
- updated_at?: string;
1119
- };
1120
- export type UpdateChannelTypeRequest = Partial<{
1121
- automod: Automod;
1122
- automod_behavior: AutomodBehavior;
1123
- max_message_length: number;
1124
- }> & {
1125
- allowed_flag_reasons?: string[];
1126
- automod_thresholds?: Thresholds;
1127
- blocklist?: string;
1128
- blocklist_behavior?: BlocklistBehavior;
1129
- blocklists?: BlockListOptions[];
1130
- commands?: CommandVariants[];
1131
- connect_events?: boolean;
1132
- custom_events?: boolean;
1133
- delivery_events?: boolean;
1134
- grants?: Record<string, string[]>;
1135
- mark_messages_pending?: boolean;
1136
- mutes?: boolean;
1137
- partition_size?: number;
1138
- /**
1139
- * @example 24h
1140
- */
1141
- partition_ttl?: string | null;
1142
- permissions?: PolicyRequest[];
1143
- polls?: boolean;
1144
- push_notifications?: boolean;
1145
- quotes?: boolean;
1146
- reactions?: boolean;
1147
- read_events?: boolean;
1148
- reminders?: boolean;
1149
- replies?: boolean;
1150
- search?: boolean;
1151
- skip_last_msg_update_for_system_msgs?: boolean;
1152
- typing_events?: boolean;
1153
- uploads?: boolean;
1154
- url_enrichment?: boolean;
1155
- count_messages?: boolean;
1156
- push_level?: 'all' | 'all_mentions' | 'direct_mentions' | 'mentions' | 'none';
1157
- };
1158
- export type UpdateChannelTypeResponse = {
1159
- automod: Automod;
1160
- automod_behavior: AutomodBehavior;
1161
- commands: CommandVariants[];
1162
- connect_events: boolean;
1163
- created_at: string;
1164
- custom_events: boolean;
1165
- delivery_events: boolean;
1166
- duration: string;
1167
- grants: Record<string, string[]>;
1168
- mark_messages_pending: boolean;
1169
- max_message_length: number;
1170
- mutes: boolean;
1171
- name: string;
1172
- permissions: PolicyRequest[];
1173
- polls: boolean;
1174
- push_notifications: boolean;
1175
- quotes: boolean;
1176
- reactions: boolean;
1177
- read_events: boolean;
1178
- reminders: boolean;
1179
- replies: boolean;
1180
- search: boolean;
1181
- shared_locations: boolean;
1182
- skip_last_msg_update_for_system_msgs: boolean;
1183
- typing_events: boolean;
1184
- updated_at: string;
1185
- uploads: boolean;
1186
- url_enrichment: boolean;
1187
- allowed_flag_reasons?: string[];
1188
- automod_thresholds?: Thresholds;
1189
- blocklist?: string;
1190
- blocklist_behavior?: BlocklistBehavior;
1191
- blocklists?: BlockListOptions[];
1192
- message_retention?: string;
1193
- partition_size?: number;
1194
- partition_ttl?: string;
1195
- count_messages?: boolean;
1196
- user_message_reminders?: boolean;
1197
- push_level?: string;
1198
- };
1199
- export type GetChannelTypeResponse = {
1200
- automod: Automod;
1201
- automod_behavior: AutomodBehavior;
1202
- commands: Command[];
1203
- connect_events: boolean;
1204
- created_at: string;
1205
- custom_events: boolean;
1206
- delivery_events: boolean;
1207
- duration: string;
1208
- grants: Record<string, string[]>;
1209
- mark_messages_pending: boolean;
1210
- max_message_length: number;
1211
- mutes: boolean;
1212
- name: string;
1213
- permissions: PolicyRequest[];
1214
- polls: boolean;
1215
- push_notifications: boolean;
1216
- quotes: boolean;
1217
- reactions: boolean;
1218
- read_events: boolean;
1219
- reminders: boolean;
1220
- replies: boolean;
1221
- search: boolean;
1222
- shared_locations: boolean;
1223
- skip_last_msg_update_for_system_msgs: boolean;
1224
- typing_events: boolean;
1225
- updated_at: string;
1226
- uploads: boolean;
1227
- url_enrichment: boolean;
1228
- allowed_flag_reasons?: string[];
1229
- automod_thresholds?: Thresholds;
1230
- blocklist?: string;
1231
- blocklist_behavior?: BlocklistBehavior;
1232
- blocklists?: BlockListOptions[];
1233
- message_retention?: string;
1234
- partition_size?: number;
1235
- partition_ttl?: string;
1236
- count_messages?: boolean;
1237
- user_message_reminders?: boolean;
1238
- push_level?: string;
1239
- };
1240
- export type UpdateChannelOptions = Partial<{
1241
- accept_invite: boolean;
1242
- add_members: string[];
1243
- add_moderators: string[];
1244
- client_id: string;
1245
- connection_id: string;
1246
- data: Omit<ChannelResponse, 'id' | 'cid'>;
1247
- demote_moderators: string[];
1248
- invites: string[];
1249
- message: MessageResponse;
1250
- reject_invite: boolean;
1251
- remove_members: string[];
1252
- user: UserResponse;
1253
- user_id: string;
1254
- }>;
1255
- export type MarkChannelsReadOptions = {
1256
- client_id?: string;
1257
- connection_id?: string;
1258
- read_by_channel?: Record<string, string>;
1259
- user?: UserResponse;
1260
- user_id?: string;
1261
- };
1262
- export type MarkReadOptions = {
222
+ export type MuteUserOptions = {
1263
223
  client_id?: string;
1264
224
  connection_id?: string;
1265
- thread_id?: string;
1266
- user?: UserResponse;
1267
- user_id?: string;
1268
- };
1269
- export type MarkUnreadOptions = {
1270
- client_id?: string;
1271
- connection_id?: string;
1272
- message_id?: string;
1273
- thread_id?: string;
1274
- message_timestamp?: string | Date;
1275
- user?: UserResponse;
1276
- user_id?: string;
1277
- };
1278
- export type DeliveredMessageConfirmation = {
1279
- cid: string;
1280
- id: string;
1281
- parent_id?: string;
1282
- };
1283
- export type MarkDeliveredOptions = {
1284
- latest_delivered_messages: DeliveredMessageConfirmation[];
1285
- user?: UserResponse;
1286
- user_id?: string;
1287
- };
1288
- export type MuteUserOptions = {
1289
- client_id?: string;
1290
- connection_id?: string;
1291
- id?: string;
1292
- reason?: string;
1293
- target_user_id?: string;
1294
- timeout?: number;
1295
- type?: string;
225
+ id?: string;
226
+ reason?: string;
227
+ target_user_id?: string;
228
+ timeout?: number;
229
+ type?: string;
1296
230
  user?: UserResponse;
1297
231
  user_id?: string;
1298
232
  };
@@ -1326,34 +260,9 @@ export type PinnedMessagePaginationOptions = {
1326
260
  pinned_at_before?: string | Date;
1327
261
  pinned_at_before_or_equal?: string | Date;
1328
262
  };
1329
- export type QueryMembersOptions = {
1330
- created_at_after?: string;
1331
- created_at_after_or_equal?: string;
1332
- created_at_before?: string;
1333
- created_at_before_or_equal?: string;
1334
- limit?: number;
1335
- offset?: number;
1336
- user_id_gt?: string;
1337
- user_id_gte?: string;
1338
- user_id_lt?: string;
1339
- user_id_lte?: string;
1340
- };
1341
- export type ReactivateUserOptions = {
1342
- created_by_id?: string;
1343
- name?: string;
1344
- restore_messages?: boolean;
1345
- };
1346
- export type ReactivateUsersOptions = {
1347
- created_by_id?: string;
1348
- restore_messages?: boolean;
1349
- };
1350
- export type SearchOptions = {
1351
- limit?: number;
1352
- next?: string;
1353
- offset?: number;
1354
- sort?: SearchMessageSort;
1355
- };
1356
- export type StreamChatOptions = AxiosRequestConfig & {
263
+ export type GetRepliesRequest = Parameters<ChatApi['getReplies']>[0];
264
+ export type QueryMembersOptions = Partial<Omit<QueryMembersPayload, 'filter_conditions'>>;
265
+ export type StreamChatOptions = {
1357
266
  /**
1358
267
  * Used to disable warnings that are triggered by using connectUser or connectAnonymousUser server-side.
1359
268
  */
@@ -1384,7 +293,6 @@ export type StreamChatOptions = AxiosRequestConfig & {
1384
293
  isLocalUnreadCountEnabled?: boolean;
1385
294
  /** experimental feature, please contact support if you want this feature enabled for you */
1386
295
  enableWSFallback?: boolean;
1387
- logger?: Logger;
1388
296
  /**
1389
297
  * Custom notification manager service to use for the client.
1390
298
  * If not provided, a default notification manager will be created.
@@ -1410,8 +318,8 @@ export type StreamChatOptions = AxiosRequestConfig & {
1410
318
  recoverStateOnReconnect?: boolean;
1411
319
  warmUp?: boolean;
1412
320
  /**
1413
- * Set the instance of StableWSConnection on chat client. Its purely for testing purpose and should
1414
- * not be used in production apps.
321
+ * Sets the instance of `StableWSConnection` on the chat client. Intended purely for testing and
322
+ * should not be used in production apps.
1415
323
  */
1416
324
  wsConnection?: StableWSConnection;
1417
325
  /**
@@ -1420,18 +328,6 @@ export type StreamChatOptions = AxiosRequestConfig & {
1420
328
  */
1421
329
  wsUrlParams?: URLSearchParams;
1422
330
  };
1423
- export type SyncOptions = {
1424
- /**
1425
- * This will behave as queryChannels option.
1426
- */
1427
- watch?: boolean;
1428
- /**
1429
- * Return channels from request that user does not have access to in a separate
1430
- * field in the response called 'inaccessible_cids' instead of
1431
- * adding them as 'notification.removed_from_channel' events.
1432
- */
1433
- with_inaccessible_cids?: boolean;
1434
- };
1435
331
  export type UnBanUserOptions = {
1436
332
  client_id?: string;
1437
333
  connection_id?: string;
@@ -1441,206 +337,70 @@ export type UnBanUserOptions = {
1441
337
  target_user_id?: string;
1442
338
  type?: string;
1443
339
  };
1444
- export type UpdateCommandOptions = {
1445
- description: string;
1446
- args?: string;
1447
- set?: CommandVariants;
1448
- };
1449
340
  export type UserOptions = {
1450
341
  include_deactivated_users?: boolean;
1451
342
  limit?: number;
1452
343
  offset?: number;
1453
344
  presence?: boolean;
1454
345
  };
1455
- /**
1456
- * Event Types
1457
- */
1458
- export type ConnectionChangeEvent = {
1459
- type: EventTypes;
1460
- online?: boolean;
1461
- };
1462
- export type Event = CustomEventData & {
1463
- type: EventTypes;
1464
- ai_message?: string;
1465
- ai_state?: AIState;
1466
- channel?: ChannelResponse;
1467
- channel_custom?: CustomChannelData;
1468
- channel_id?: string;
1469
- channel_member_count?: number;
1470
- channel_type?: string;
1471
- cid?: string;
1472
- clear_history?: boolean;
1473
- connection_id?: string;
1474
- created_at?: string;
1475
- deleted_for_me?: boolean;
1476
- draft?: DraftResponse;
1477
- first_unread_message_id?: string;
1478
- hard_delete?: boolean;
1479
- last_delivered_at?: string;
1480
- last_delivered_message_id?: string;
1481
- last_read_at?: string;
1482
- last_read_message_id?: string;
1483
- live_location?: SharedLocationResponse;
1484
- mark_messages_deleted?: boolean;
1485
- me?: OwnUserResponse;
1486
- member?: ChannelMemberResponse;
1487
- message?: MessageResponse;
1488
- message_id?: string;
1489
- mode?: string;
1490
- online?: boolean;
1491
- own_capabilities?: string[];
1492
- parent_id?: string;
1493
- poll?: PollResponse;
1494
- poll_vote?: PollVote | PollAnswer;
1495
- queriedChannels?: {
1496
- channels: ChannelAPIResponse[];
1497
- isLatestMessageSet?: boolean;
1498
- };
1499
- offlineReactions?: ReactionResponse[];
1500
- reaction?: ReactionResponse;
1501
- received_at?: string | Date;
1502
- reminder?: ReminderResponse;
1503
- shadow?: boolean;
1504
- team?: string;
1505
- thread?: ThreadResponse;
1506
- total_unread_count?: number;
1507
- unread_channels?: number;
1508
- unread_count?: number;
1509
- unread_messages?: number;
1510
- unread_thread_messages?: number;
1511
- unread_threads?: number;
1512
- user?: UserResponse;
1513
- user_id?: string;
1514
- watcher_count?: number;
1515
- channel_last_message_at?: string;
1516
- app?: Record<string, unknown>;
1517
- thread_id?: string;
1518
- };
1519
- export type UserCustomEvent = CustomEventData & {
1520
- type: string;
1521
- };
1522
- export type EventHandler = (event: Event) => void;
1523
- export type EventTypes = 'all' | keyof typeof EVENT_MAP | keyof CustomEventTypes;
1524
- /**
1525
- * Filter Types
1526
- */
1527
- export type AscDesc = 1 | -1;
1528
- export type MessageFlagsFiltersOptions = {
1529
- channel_cid?: string;
1530
- is_reviewed?: boolean;
1531
- team?: string;
1532
- user_id?: string;
1533
- };
1534
- export type MessageFlagsFilters = QueryFilters<{
1535
- channel_cid?: RequireOnlyOne<Pick<QueryFilter<MessageFlagsFiltersOptions['channel_cid']>, '$eq' | '$in'>> | PrimitiveFilter<MessageFlagsFiltersOptions['channel_cid']>;
346
+ type LocalEvent = (({
347
+ type: 'live_location_sharing.started';
1536
348
  } & {
1537
- team?: RequireOnlyOne<Pick<QueryFilter<MessageFlagsFiltersOptions['team']>, '$eq' | '$in'>> | PrimitiveFilter<MessageFlagsFiltersOptions['team']>;
349
+ message: MessageResponse;
350
+ }) | ({
351
+ type: 'live_location_sharing.stopped';
1538
352
  } & {
1539
- user_id?: RequireOnlyOne<Pick<QueryFilter<MessageFlagsFiltersOptions['user_id']>, '$eq' | '$in'>> | PrimitiveFilter<MessageFlagsFiltersOptions['user_id']>;
353
+ live_location?: SharedLocationResponseData;
354
+ }) | ({
355
+ type: 'channels.queried';
1540
356
  } & {
1541
- [Key in keyof Omit<MessageFlagsFiltersOptions, 'channel_cid' | 'user_id' | 'is_reviewed'>]: RequireOnlyOne<QueryFilter<MessageFlagsFiltersOptions[Key]>> | PrimitiveFilter<MessageFlagsFiltersOptions[Key]>;
1542
- }>;
1543
- export type FlagsFiltersOptions = {
1544
- channel_cid?: string;
1545
- message_id?: string;
1546
- message_user_id?: string;
1547
- reporter_id?: string;
1548
- team?: string;
1549
- user_id?: string;
1550
- };
1551
- export type FlagsFilters = QueryFilters<{
1552
- user_id?: RequireOnlyOne<Pick<QueryFilter<FlagsFiltersOptions['user_id']>, '$eq' | '$in'>> | PrimitiveFilter<FlagsFiltersOptions['user_id']>;
357
+ queriedChannels: {
358
+ channels: ChannelStateResponseFields[];
359
+ isLatestMessageSet: boolean;
360
+ };
361
+ }) | ({
362
+ type: 'transport.changed';
1553
363
  } & {
1554
- message_id?: RequireOnlyOne<Pick<QueryFilter<FlagsFiltersOptions['message_id']>, '$eq' | '$in'>> | PrimitiveFilter<FlagsFiltersOptions['message_id']>;
364
+ mode: string;
365
+ }) | ({
366
+ type: 'connection.changed';
1555
367
  } & {
1556
- message_user_id?: RequireOnlyOne<Pick<QueryFilter<FlagsFiltersOptions['message_user_id']>, '$eq' | '$in'>> | PrimitiveFilter<FlagsFiltersOptions['message_user_id']>;
368
+ online: boolean;
369
+ }) | {
370
+ type: 'connection.recovered';
371
+ } | ({
372
+ type: 'offline_reactions.queried';
1557
373
  } & {
1558
- channel_cid?: RequireOnlyOne<Pick<QueryFilter<FlagsFiltersOptions['channel_cid']>, '$eq' | '$in'>> | PrimitiveFilter<FlagsFiltersOptions['channel_cid']>;
374
+ offlineReactions: ReactionResponse[];
375
+ }) | ({
376
+ type: 'capabilities.changed';
1559
377
  } & {
1560
- reporter_id?: RequireOnlyOne<Pick<QueryFilter<FlagsFiltersOptions['reporter_id']>, '$eq' | '$in'>> | PrimitiveFilter<FlagsFiltersOptions['reporter_id']>;
378
+ cid: string;
379
+ own_capabilities: ChannelOwnCapability[];
380
+ }) | ({
381
+ type: 'message.read_locally';
1561
382
  } & {
1562
- team?: RequireOnlyOne<Pick<QueryFilter<FlagsFiltersOptions['team']>, '$eq' | '$in'>> | PrimitiveFilter<FlagsFiltersOptions['team']>;
1563
- }>;
1564
- export type FlagReportsFiltersOptions = {
1565
- channel_cid?: string;
1566
- is_reviewed?: boolean;
1567
- message_id?: string;
1568
- message_user_id?: string;
1569
- report_id?: string;
1570
- review_result?: string;
1571
- reviewed_by?: string;
383
+ channel_type: string;
384
+ cid: string;
385
+ created_at: Date;
386
+ channel_id?: string;
387
+ last_read_message_id?: string;
1572
388
  team?: string;
1573
- user_id?: string;
1574
- };
1575
- export type FlagReportsFilters = QueryFilters<{
1576
- report_id?: RequireOnlyOne<Pick<QueryFilter<FlagReportsFiltersOptions['report_id']>, '$eq' | '$in'>> | PrimitiveFilter<FlagReportsFiltersOptions['report_id']>;
1577
- } & {
1578
- review_result?: RequireOnlyOne<Pick<QueryFilter<FlagReportsFiltersOptions['review_result']>, '$eq' | '$in'>> | PrimitiveFilter<FlagReportsFiltersOptions['review_result']>;
1579
- } & {
1580
- reviewed_by?: RequireOnlyOne<Pick<QueryFilter<FlagReportsFiltersOptions['reviewed_by']>, '$eq' | '$in'>> | PrimitiveFilter<FlagReportsFiltersOptions['reviewed_by']>;
1581
- } & {
1582
- user_id?: RequireOnlyOne<Pick<QueryFilter<FlagReportsFiltersOptions['user_id']>, '$eq' | '$in'>> | PrimitiveFilter<FlagReportsFiltersOptions['user_id']>;
1583
- } & {
1584
- message_id?: RequireOnlyOne<Pick<QueryFilter<FlagReportsFiltersOptions['message_id']>, '$eq' | '$in'>> | PrimitiveFilter<FlagReportsFiltersOptions['message_id']>;
1585
- } & {
1586
- message_user_id?: RequireOnlyOne<Pick<QueryFilter<FlagReportsFiltersOptions['message_user_id']>, '$eq' | '$in'>> | PrimitiveFilter<FlagReportsFiltersOptions['message_user_id']>;
1587
- } & {
1588
- channel_cid?: RequireOnlyOne<Pick<QueryFilter<FlagReportsFiltersOptions['channel_cid']>, '$eq' | '$in'>> | PrimitiveFilter<FlagReportsFiltersOptions['channel_cid']>;
1589
- } & {
1590
- team?: RequireOnlyOne<Pick<QueryFilter<FlagReportsFiltersOptions['team']>, '$eq' | '$in'>> | PrimitiveFilter<FlagReportsFiltersOptions['team']>;
1591
- } & {
1592
- [Key in keyof Omit<FlagReportsFiltersOptions, 'report_id' | 'user_id' | 'message_id' | 'review_result' | 'reviewed_by'>]: RequireOnlyOne<QueryFilter<FlagReportsFiltersOptions[Key]>> | PrimitiveFilter<FlagReportsFiltersOptions[Key]>;
1593
- }>;
1594
- export type BannedUsersFilterOptions = {
1595
- banned_by_id?: string;
1596
- channel_cid?: string;
1597
- created_at?: string;
1598
- reason?: string;
1599
- user_id?: string;
1600
- };
1601
- export type BannedUsersFilters = QueryFilters<{
1602
- channel_cid?: RequireOnlyOne<Pick<QueryFilter<BannedUsersFilterOptions['channel_cid']>, '$eq' | '$in'>> | PrimitiveFilter<BannedUsersFilterOptions['channel_cid']>;
1603
- } & {
1604
- reason?: RequireOnlyOne<{
1605
- $autocomplete?: BannedUsersFilterOptions['reason'];
1606
- } & QueryFilter<BannedUsersFilterOptions['reason']>> | PrimitiveFilter<BannedUsersFilterOptions['reason']>;
1607
- } & {
1608
- [Key in keyof Omit<BannedUsersFilterOptions, 'channel_cid' | 'reason'>]: RequireOnlyOne<QueryFilter<BannedUsersFilterOptions[Key]>> | PrimitiveFilter<BannedUsersFilterOptions[Key]>;
1609
- }>;
1610
- export type ReactionFilters = QueryFilters<{
1611
- user_id?: RequireOnlyOne<Pick<QueryFilter<ReactionResponse['user_id']>, '$eq' | '$in'>> | PrimitiveFilter<ReactionResponse['user_id']>;
1612
- } & {
1613
- type?: RequireOnlyOne<Pick<QueryFilter<ReactionResponse['type']>, '$eq'>> | PrimitiveFilter<ReactionResponse['type']>;
1614
- } & {
1615
- created_at?: RequireOnlyOne<Pick<QueryFilter<PollResponse['created_at']>, '$eq' | '$gt' | '$lt' | '$gte' | '$lte'>> | PrimitiveFilter<PollResponse['created_at']>;
1616
- }>;
1617
- export type ChannelFilters = QueryFilters<ContainsOperator<Omit<CustomChannelData, 'name'>> & {
1618
- app_banned?: 'only' | 'excluded';
1619
- has_unread?: boolean;
1620
- archived?: boolean;
1621
- 'member.user.name'?: RequireOnlyOne<{
1622
- $autocomplete?: string;
1623
- $eq?: string;
1624
- }> | string;
1625
- members?: RequireOnlyOne<Pick<QueryFilter<string>, '$in'>> | RequireOnlyOne<Pick<QueryFilter<string[]>, '$eq'>> | PrimitiveFilter<string[]>;
1626
- name?: RequireOnlyOne<{
1627
- $autocomplete?: string;
1628
- } & QueryFilter<string>> | PrimitiveFilter<string>;
1629
- pinned?: boolean;
1630
- last_updated?: RequireOnlyOne<Pick<QueryFilter<string>, '$eq' | '$gt' | '$gte' | '$lt' | '$lte'>> | PrimitiveFilter<string>;
1631
- } & {
1632
- [Key in keyof Omit<ChannelResponse, 'name' | 'members' | keyof CustomChannelData>]: RequireOnlyOne<QueryFilter<ChannelResponse[Key]>> | PrimitiveFilter<ChannelResponse[Key]>;
1633
- }>;
1634
- export type DraftFilters = {
1635
- channel_cid?: RequireOnlyOne<Pick<QueryFilter<DraftResponse['channel_cid']>, '$in' | '$eq'>> | PrimitiveFilter<DraftResponse['channel_cid']>;
1636
- created_at?: RequireOnlyOne<Pick<QueryFilter<DraftResponse['created_at']>, '$eq' | '$gt' | '$lt' | '$gte' | '$lte'>> | PrimitiveFilter<DraftResponse['created_at']>;
1637
- parent_id?: RequireOnlyOne<Pick<QueryFilter<DraftResponse['created_at']>, '$in' | '$eq' | '$exists'>> | PrimitiveFilter<DraftResponse['parent_id']>;
1638
- };
1639
- export type QueryPollsParams = {
1640
- filter?: QueryPollsFilters;
1641
- options?: QueryPollsOptions;
1642
- sort?: PollSort;
1643
- };
389
+ user?: UserResponse;
390
+ })) & {
391
+ received_at?: Date;
392
+ };
393
+ export type Event = WSEvent | LocalEvent | keyof CustomEventTypes;
394
+ export type EventType = Event['type'] | 'all';
395
+ export type EventHandler<T = string> = (event: Extract<Event, {
396
+ type: T;
397
+ }>) => void;
398
+ /**
399
+ * Filter Types
400
+ */
401
+ export type ReactionFilters = NonNullable<QueryReactionsRequestWithId['filter']>;
402
+ export type QueryReactionsRequestWithId = Parameters<ChatApi['queryReactions']>[0];
403
+ export type ChannelFilters = NonNullable<QueryChannelsRequest['filter_conditions']>;
1644
404
  export type QueryPollsOptions = Pager;
1645
405
  export type VotesFiltersOptions = {
1646
406
  is_answer?: boolean;
@@ -1649,30 +409,30 @@ export type VotesFiltersOptions = {
1649
409
  };
1650
410
  export type QueryVotesOptions = Pager;
1651
411
  export type QueryPollsFilters = QueryFilters<{
1652
- id?: RequireOnlyOne<Pick<QueryFilter<PollResponse['id']>, '$eq' | '$in'>> | PrimitiveFilter<PollResponse['id']>;
412
+ id?: RequireOnlyOne<Pick<QueryFilter<PollResponse_old['id']>, '$eq' | '$in'>> | PrimitiveFilter<PollResponse_old['id']>;
1653
413
  } & {
1654
414
  user_id?: RequireOnlyOne<Pick<QueryFilter<VotesFiltersOptions['user_id']>, '$eq' | '$in'>> | PrimitiveFilter<VotesFiltersOptions['user_id']>;
1655
415
  } & {
1656
- is_closed?: RequireOnlyOne<Pick<QueryFilter<PollResponse['is_closed']>, '$eq'>> | PrimitiveFilter<PollResponse['is_closed']>;
416
+ is_closed?: RequireOnlyOne<Pick<QueryFilter<PollResponse_old['is_closed']>, '$eq'>> | PrimitiveFilter<PollResponse_old['is_closed']>;
1657
417
  } & {
1658
- max_votes_allowed?: RequireOnlyOne<Pick<QueryFilter<PollResponse['max_votes_allowed']>, '$eq' | '$gt' | '$lt' | '$gte' | '$lte'>> | PrimitiveFilter<PollResponse['max_votes_allowed']>;
418
+ max_votes_allowed?: RequireOnlyOne<Pick<QueryFilter<PollResponse_old['max_votes_allowed']>, '$eq' | '$gt' | '$lt' | '$gte' | '$lte'>> | PrimitiveFilter<PollResponse_old['max_votes_allowed']>;
1659
419
  } & {
1660
- allow_answers?: RequireOnlyOne<Pick<QueryFilter<PollResponse['allow_answers']>, '$eq'>> | PrimitiveFilter<PollResponse['allow_answers']>;
420
+ allow_answers?: RequireOnlyOne<Pick<QueryFilter<PollResponse_old['allow_answers']>, '$eq'>> | PrimitiveFilter<PollResponse_old['allow_answers']>;
1661
421
  } & {
1662
- allow_user_suggested_options?: RequireOnlyOne<Pick<QueryFilter<PollResponse['allow_user_suggested_options']>, '$eq'>> | PrimitiveFilter<PollResponse['allow_user_suggested_options']>;
422
+ allow_user_suggested_options?: RequireOnlyOne<Pick<QueryFilter<PollResponse_old['allow_user_suggested_options']>, '$eq'>> | PrimitiveFilter<PollResponse_old['allow_user_suggested_options']>;
1663
423
  } & {
1664
- voting_visibility?: RequireOnlyOne<Pick<QueryFilter<PollResponse['voting_visibility']>, '$eq'>> | PrimitiveFilter<PollResponse['voting_visibility']>;
424
+ voting_visibility?: RequireOnlyOne<Pick<QueryFilter<PollResponse_old['voting_visibility']>, '$eq'>> | PrimitiveFilter<PollResponse_old['voting_visibility']>;
1665
425
  } & {
1666
- created_at?: RequireOnlyOne<Pick<QueryFilter<PollResponse['created_at']>, '$eq' | '$gt' | '$lt' | '$gte' | '$lte'>> | PrimitiveFilter<PollResponse['created_at']>;
426
+ created_at?: RequireOnlyOne<Pick<QueryFilter<PollResponse_old['created_at']>, '$eq' | '$gt' | '$lt' | '$gte' | '$lte'>> | PrimitiveFilter<PollResponse_old['created_at']>;
1667
427
  } & {
1668
- created_by_id?: RequireOnlyOne<Pick<QueryFilter<PollResponse['created_by_id']>, '$eq' | '$in'>> | PrimitiveFilter<PollResponse['created_by_id']>;
428
+ created_by_id?: RequireOnlyOne<Pick<QueryFilter<PollResponse_old['created_by_id']>, '$eq' | '$in'>> | PrimitiveFilter<PollResponse_old['created_by_id']>;
1669
429
  } & {
1670
- updated_at?: RequireOnlyOne<Pick<QueryFilter<PollResponse['updated_at']>, '$eq' | '$gt' | '$lt' | '$gte' | '$lte'>> | PrimitiveFilter<PollResponse['updated_at']>;
430
+ updated_at?: RequireOnlyOne<Pick<QueryFilter<PollResponse_old['updated_at']>, '$eq' | '$gt' | '$lt' | '$gte' | '$lte'>> | PrimitiveFilter<PollResponse_old['updated_at']>;
1671
431
  } & {
1672
- name?: RequireOnlyOne<Pick<QueryFilter<PollResponse['name']>, '$eq' | '$in'>> | PrimitiveFilter<PollResponse['name']>;
432
+ name?: RequireOnlyOne<Pick<QueryFilter<PollResponse_old['name']>, '$eq' | '$in'>> | PrimitiveFilter<PollResponse_old['name']>;
1673
433
  }>;
1674
434
  export type QueryVotesFilters = QueryFilters<{
1675
- id?: RequireOnlyOne<Pick<QueryFilter<PollResponse['id']>, '$eq' | '$in'>> | PrimitiveFilter<PollResponse['id']>;
435
+ id?: RequireOnlyOne<Pick<QueryFilter<PollResponse_old['id']>, '$eq' | '$in'>> | PrimitiveFilter<PollResponse_old['id']>;
1676
436
  } & {
1677
437
  option_id?: RequireOnlyOne<Pick<QueryFilter<VotesFiltersOptions['option_id']>, '$eq' | '$in'>> | PrimitiveFilter<VotesFiltersOptions['option_id']>;
1678
438
  } & {
@@ -1680,40 +440,15 @@ export type QueryVotesFilters = QueryFilters<{
1680
440
  } & {
1681
441
  user_id?: RequireOnlyOne<Pick<QueryFilter<VotesFiltersOptions['user_id']>, '$eq' | '$in'>> | PrimitiveFilter<VotesFiltersOptions['user_id']>;
1682
442
  } & {
1683
- created_at?: RequireOnlyOne<Pick<QueryFilter<PollResponse['created_at']>, '$eq' | '$gt' | '$lt' | '$gte' | '$lte'>> | PrimitiveFilter<PollResponse['created_at']>;
443
+ created_at?: RequireOnlyOne<Pick<QueryFilter<PollResponse_old['created_at']>, '$eq' | '$gt' | '$lt' | '$gte' | '$lte'>> | PrimitiveFilter<PollResponse_old['created_at']>;
1684
444
  } & {
1685
- created_by_id?: RequireOnlyOne<Pick<QueryFilter<PollResponse['created_by_id']>, '$eq' | '$in'>> | PrimitiveFilter<PollResponse['created_by_id']>;
1686
- } & {
1687
- updated_at?: RequireOnlyOne<Pick<QueryFilter<PollResponse['updated_at']>, '$eq' | '$gt' | '$lt' | '$gte' | '$lte'>> | PrimitiveFilter<PollResponse['updated_at']>;
1688
- }>;
1689
- export type ContainsOperator<CustomType = {}> = {
1690
- [Key in keyof CustomType]?: CustomType[Key] extends (infer ContainType)[] ? RequireOnlyOne<{
1691
- $contains?: ContainType extends object ? PrimitiveFilter<RequireAtLeastOne<ContainType>> : PrimitiveFilter<ContainType>;
1692
- } & QueryFilter<PrimitiveFilter<ContainType>[]>> | PrimitiveFilter<PrimitiveFilter<ContainType>[]> : RequireOnlyOne<QueryFilter<CustomType[Key]>> | PrimitiveFilter<CustomType[Key]>;
1693
- };
1694
- export type MessageFilters = QueryFilters<ContainsOperator<CustomMessageData> & {
1695
- 'attachments.type'?: RequireOnlyOne<{
1696
- $eq: PrimitiveFilter<Attachment['type']>;
1697
- $in: PrimitiveFilter<Attachment['type']>[];
1698
- }> | PrimitiveFilter<Attachment['type']>;
1699
- 'mentioned_users.id'?: RequireOnlyOne<{
1700
- $contains: PrimitiveFilter<UserResponse['id']>;
1701
- }>;
1702
- text?: RequireOnlyOne<{
1703
- $autocomplete?: MessageResponse['text'];
1704
- $q?: MessageResponse['text'];
1705
- } & QueryFilter<MessageResponse['text']>> | PrimitiveFilter<MessageResponse['text']>;
1706
- 'user.id'?: RequireOnlyOne<{
1707
- $autocomplete?: UserResponse['id'];
1708
- } & QueryFilter<UserResponse['id']>> | PrimitiveFilter<UserResponse['id']>;
445
+ created_by_id?: RequireOnlyOne<Pick<QueryFilter<PollResponse_old['created_by_id']>, '$eq' | '$in'>> | PrimitiveFilter<PollResponse_old['created_by_id']>;
1709
446
  } & {
1710
- [Key in keyof Omit<MessageResponse, 'text' | keyof CustomMessageData>]?: RequireOnlyOne<QueryFilter<MessageResponse[Key]>> | PrimitiveFilter<MessageResponse[Key]>;
447
+ updated_at?: RequireOnlyOne<Pick<QueryFilter<PollResponse_old['updated_at']>, '$eq' | '$gt' | '$lt' | '$gte' | '$lte'>> | PrimitiveFilter<PollResponse_old['updated_at']>;
1711
448
  }>;
1712
- export type MessageOptions = {
1713
- include_thread_participants?: boolean;
1714
- };
449
+ export type MessageFilters = NonNullable<SearchPayload['message_filter_conditions']>;
1715
450
  export type PrimitiveFilter<ObjectType> = ObjectType | null;
1716
- export type QueryFilter<ObjectType = string> = NonNullable<ObjectType> extends string | number | boolean ? {
451
+ export type QueryFilter<ObjectType = string> = NonNullable<ObjectType> extends string | number | boolean | Date ? {
1717
452
  $eq?: PrimitiveFilter<ObjectType>;
1718
453
  $exists?: boolean;
1719
454
  $gt?: PrimitiveFilter<ObjectType>;
@@ -1726,184 +461,24 @@ export type QueryFilter<ObjectType = string> = NonNullable<ObjectType> extends s
1726
461
  $exists?: boolean;
1727
462
  $in?: PrimitiveFilter<Unpacked<ObjectType>>[];
1728
463
  };
1729
- export type QueryFilters<Operators = {}> = {
1730
- [Key in keyof Operators]?: Operators[Key];
1731
- } & QueryLogicalOperators<Operators>;
1732
- export type QueryLogicalOperators<Operators> = {
1733
- $and?: ArrayOneOrMore<QueryFilters<Operators>>;
1734
- $nor?: ArrayOneOrMore<QueryFilters<Operators>>;
1735
- $or?: ArrayTwoOrMore<QueryFilters<Operators>>;
1736
- };
1737
- export type UserFilters = QueryFilters<ContainsOperator<CustomUserData> & {
1738
- id?: RequireOnlyOne<{
1739
- $autocomplete?: UserResponse['id'];
1740
- } & QueryFilter<UserResponse['id']>> | PrimitiveFilter<UserResponse['id']>;
1741
- name?: RequireOnlyOne<{
1742
- $autocomplete?: UserResponse['name'];
1743
- } & QueryFilter<UserResponse['name']>> | PrimitiveFilter<UserResponse['name']>;
1744
- notifications_muted?: RequireOnlyOne<{
1745
- $eq?: PrimitiveFilter<UserResponse['notifications_muted']>;
1746
- }> | boolean;
1747
- teams?: RequireOnlyOne<{
1748
- $contains?: PrimitiveFilter<string>;
1749
- $eq?: PrimitiveFilter<UserResponse['teams']>;
1750
- $in?: PrimitiveFilter<UserResponse['teams']>;
1751
- }> | PrimitiveFilter<UserResponse['teams']>;
1752
- username?: RequireOnlyOne<{
1753
- $autocomplete?: UserResponse['username'];
1754
- } & QueryFilter<UserResponse['username']>> | PrimitiveFilter<UserResponse['username']>;
1755
- } & {
1756
- [Key in keyof Omit<UserResponse, 'id' | 'name' | 'teams' | 'username' | keyof CustomUserData>]?: RequireOnlyOne<QueryFilter<UserResponse[Key]>> | PrimitiveFilter<UserResponse[Key]>;
1757
- }>;
1758
- export type InviteStatus = 'pending' | 'accepted' | 'rejected' | 'member';
1759
- export type MemberFilters = QueryFilters<{
1760
- banned?: {
1761
- $eq?: ChannelMemberResponse['banned'];
1762
- } | ChannelMemberResponse['banned'];
1763
- channel_role?: {
1764
- $eq?: ChannelMemberResponse['channel_role'];
1765
- } | ChannelMemberResponse['channel_role'];
1766
- cid?: {
1767
- $eq?: ChannelResponse['cid'];
1768
- } | ChannelResponse['cid'];
1769
- created_at?: {
1770
- $eq?: ChannelMemberResponse['created_at'];
1771
- $gt?: ChannelMemberResponse['created_at'];
1772
- $gte?: ChannelMemberResponse['created_at'];
1773
- $lt?: ChannelMemberResponse['created_at'];
1774
- $lte?: ChannelMemberResponse['created_at'];
1775
- } | ChannelMemberResponse['created_at'];
1776
- id?: RequireOnlyOne<{
1777
- $eq?: UserResponse['id'];
1778
- $in?: UserResponse['id'][];
1779
- }> | UserResponse['id'];
1780
- invite?: {
1781
- $eq?: ChannelMemberResponse['status'];
1782
- } | ChannelMemberResponse['status'];
1783
- is_moderator?: RequireOnlyOne<{
1784
- $eq?: ChannelMemberResponse['is_moderator'];
1785
- }> | ChannelMemberResponse['is_moderator'];
1786
- joined?: {
1787
- $eq?: boolean;
1788
- } | boolean;
1789
- last_active?: {
1790
- $eq?: UserResponse['last_active'];
1791
- $gt?: UserResponse['last_active'];
1792
- $gte?: UserResponse['last_active'];
1793
- $lt?: UserResponse['last_active'];
1794
- $lte?: UserResponse['last_active'];
1795
- } | UserResponse['last_active'];
1796
- name?: RequireOnlyOne<{
1797
- $autocomplete?: NonNullable<ChannelMemberResponse['user']>['name'];
1798
- $eq?: NonNullable<ChannelMemberResponse['user']>['name'];
1799
- $in?: NonNullable<ChannelMemberResponse['user']>['name'][];
1800
- $q?: NonNullable<ChannelMemberResponse['user']>['name'];
1801
- }> | PrimitiveFilter<NonNullable<ChannelMemberResponse['user']>['name']>;
1802
- notifications_muted?: RequireOnlyOne<{
1803
- $eq?: ChannelMemberResponse['notifications_muted'];
1804
- }> | ChannelMemberResponse['notifications_muted'];
1805
- updated_at?: {
1806
- $eq?: ChannelMemberResponse['updated_at'];
1807
- $gt?: ChannelMemberResponse['updated_at'];
1808
- $gte?: ChannelMemberResponse['updated_at'];
1809
- $lt?: ChannelMemberResponse['updated_at'];
1810
- $lte?: ChannelMemberResponse['updated_at'];
1811
- } | ChannelMemberResponse['updated_at'];
1812
- 'user.email'?: RequireOnlyOne<{
1813
- $autocomplete?: string;
1814
- $eq?: string;
1815
- $in?: string;
1816
- }> | string;
1817
- user_id?: RequireOnlyOne<{
1818
- $eq?: ChannelMemberResponse['user_id'];
1819
- $in?: ChannelMemberResponse['user_id'][];
1820
- }> | PrimitiveFilter<ChannelMemberResponse['user_id']>;
1821
- } & {
1822
- [Key in keyof ContainsOperator<CustomMemberData>]?: RequireOnlyOne<QueryFilter<ContainsOperator<CustomMemberData>[Key]>> | PrimitiveFilter<ContainsOperator<CustomMemberData>[Key]>;
1823
- }>;
464
+ export type UserFilters = QueryUsersPayload['filter_conditions'];
465
+ export type MemberFilters = QueryMembersPayload['filter_conditions'];
1824
466
  /**
1825
467
  * Sort Types
1826
468
  */
1827
- export type BannedUsersSort = BannedUsersSortBase | Array<BannedUsersSortBase>;
1828
- export type BannedUsersSortBase = {
1829
- created_at?: AscDesc;
1830
- };
1831
- export type ReactionSort = ReactionSortBase | Array<ReactionSortBase>;
1832
- export type ReactionSortBase = Sort<CustomReactionData> & {
1833
- created_at?: AscDesc;
1834
- };
1835
- export type ChannelSort = ChannelSortBase | Array<ChannelSortBase>;
1836
- export type ChannelSortBase = Sort<CustomChannelData> & {
1837
- created_at?: AscDesc;
1838
- has_unread?: AscDesc;
1839
- last_message_at?: AscDesc;
1840
- last_updated?: AscDesc;
1841
- member_count?: AscDesc;
1842
- pinned_at?: AscDesc;
1843
- unread_count?: AscDesc;
1844
- updated_at?: AscDesc;
1845
- };
1846
- export type PinnedMessagesSort = PinnedMessagesSortBase | Array<PinnedMessagesSortBase>;
1847
- export type PinnedMessagesSortBase = {
1848
- pinned_at?: AscDesc;
1849
- };
1850
- export type Sort<T> = {
1851
- [P in keyof T]?: AscDesc;
1852
- };
1853
- export type UserSort = Sort<UserResponse> | Array<Sort<UserResponse>>;
1854
- export type MemberSort = Sort<Pick<UserResponse, 'created_at' | 'last_active' | 'name' | 'updated_at'> & {
1855
- user_id?: string;
1856
- }> | Array<Sort<Pick<UserResponse, 'created_at' | 'last_active' | 'name' | 'updated_at'> & {
1857
- user_id?: string;
1858
- }>>;
1859
- export type SearchMessageSortBase = Sort<CustomMessageData> & {
1860
- attachments?: AscDesc;
1861
- 'attachments.type'?: AscDesc;
1862
- created_at?: AscDesc;
1863
- id?: AscDesc;
1864
- 'mentioned_users.id'?: AscDesc;
1865
- parent_id?: AscDesc;
1866
- pinned?: AscDesc;
1867
- relevance?: AscDesc;
1868
- reply_count?: AscDesc;
1869
- text?: AscDesc;
1870
- type?: AscDesc;
1871
- updated_at?: AscDesc;
1872
- 'user.id'?: AscDesc;
1873
- };
1874
- export type SearchMessageSort = SearchMessageSortBase | Array<SearchMessageSortBase>;
1875
- export type QuerySort = BannedUsersSort | ChannelSort | SearchMessageSort | UserSort;
1876
- export type DraftSortBase = {
1877
- created_at?: AscDesc;
1878
- };
1879
- export type DraftSort = DraftSortBase | Array<DraftSortBase>;
1880
- export type PollSort = PollSortBase | Array<PollSortBase>;
1881
- export type PollSortBase = {
1882
- created_at?: AscDesc;
1883
- id?: AscDesc;
1884
- is_closed?: AscDesc;
1885
- name?: AscDesc;
1886
- updated_at?: AscDesc;
1887
- };
1888
- export type VoteSort = VoteSortBase | Array<VoteSortBase>;
1889
- export type VoteSortBase = {
1890
- created_at?: AscDesc;
1891
- id?: AscDesc;
1892
- is_closed?: AscDesc;
1893
- name?: AscDesc;
1894
- updated_at?: AscDesc;
1895
- };
469
+ export type BannedUsersSort = SortParamRequest[];
470
+ export type ReactionSort = SortParamRequest[];
471
+ export type ChannelSort = SortParamRequest[];
472
+ export type PinnedMessagesSort = SortParamRequest[];
473
+ export type UserSort = SortParamRequest[];
474
+ export type MemberSort = SortParamRequest[];
475
+ export type SearchMessageSort = SortParamRequest[];
476
+ export type DraftSort = SortParamRequest[];
477
+ export type PollSort = SortParamRequest[];
478
+ export type VoteSort = SortParamRequest[];
1896
479
  /**
1897
480
  * Base Types
1898
481
  */
1899
- export type Action = {
1900
- name?: string;
1901
- style?: string;
1902
- text?: string;
1903
- type?: string;
1904
- value?: string;
1905
- };
1906
- export type AnonUserType = {};
1907
482
  export type APNConfig = {
1908
483
  auth_key?: string;
1909
484
  auth_type?: string;
@@ -1923,111 +498,7 @@ export type AsyncModerationOptions = {
1923
498
  };
1924
499
  timeout_ms?: number;
1925
500
  };
1926
- export type AppSettings = {
1927
- allowed_flag_reasons?: string[];
1928
- apn_config?: {
1929
- auth_key?: string;
1930
- auth_type?: string;
1931
- bundle_id?: string;
1932
- development?: boolean;
1933
- host?: string;
1934
- key_id?: string;
1935
- notification_template?: string;
1936
- p12_cert?: string;
1937
- team_id?: string;
1938
- };
1939
- async_moderation_config?: AsyncModerationOptions;
1940
- async_url_enrich_enabled?: boolean;
1941
- auto_translation_enabled?: boolean;
1942
- before_message_send_hook_url?: string;
1943
- before_message_send_hook_attempt_timeout_ms?: number;
1944
- cdn_expiration_seconds?: number;
1945
- custom_action_handler_url?: string;
1946
- disable_auth_checks?: boolean;
1947
- disable_permissions_checks?: boolean;
1948
- enforce_unique_usernames?: 'no' | 'app' | 'team';
1949
- event_hooks?: Array<EventHook> | null;
1950
- explicit_event_hooks_deletion?: boolean;
1951
- file_upload_config?: FileUploadConfig;
1952
- firebase_config?: {
1953
- apn_template?: string;
1954
- credentials_json?: string;
1955
- data_template?: string;
1956
- notification_template?: string;
1957
- server_key?: string;
1958
- };
1959
- grants?: Record<string, string[]>;
1960
- huawei_config?: {
1961
- id: string;
1962
- secret: string;
1963
- };
1964
- image_moderation_enabled?: boolean;
1965
- image_upload_config?: FileUploadConfig;
1966
- migrate_permissions_to_v2?: boolean;
1967
- multi_tenant_enabled?: boolean;
1968
- permission_version?: 'v1' | 'v2';
1969
- push_config?: {
1970
- offline_only?: boolean;
1971
- version?: string;
1972
- };
1973
- reminders_interval?: number;
1974
- revoke_tokens_issued_before?: string | null;
1975
- sns_key?: string;
1976
- sns_secret?: string;
1977
- sns_topic_arn?: string;
1978
- sqs_key?: string;
1979
- sqs_secret?: string;
1980
- sqs_url?: string;
1981
- user_response_time_enabled?: boolean;
1982
- video_provider?: string;
1983
- webhook_events?: Array<string> | null;
1984
- webhook_url?: string;
1985
- xiaomi_config?: {
1986
- package_name: string;
1987
- secret: string;
1988
- };
1989
- };
1990
- export type Attachment = CustomAttachmentData & {
1991
- actions?: Action[];
1992
- asset_url?: string;
1993
- author_icon?: string;
1994
- author_link?: string;
1995
- author_name?: string;
1996
- color?: string;
1997
- duration?: number;
1998
- fallback?: string;
1999
- fields?: Field[];
2000
- file_size?: number | string;
2001
- footer?: string;
2002
- footer_icon?: string;
2003
- giphy?: GiphyData;
2004
- image_url?: string;
2005
- latitude?: number;
2006
- longitude?: number;
2007
- mime_type?: string;
2008
- og_scrape_url?: string;
2009
- original_height?: number;
2010
- original_width?: number;
2011
- pretext?: string;
2012
- text?: string;
2013
- thumb_url?: string;
2014
- title?: string;
2015
- title_link?: string;
2016
- type?: string;
2017
- waveform_data?: Array<number>;
2018
- };
2019
- export type OGAttachment = {
2020
- og_scrape_url: string;
2021
- asset_url?: string;
2022
- author_link?: string;
2023
- author_name?: string;
2024
- image_url?: string;
2025
- text?: string;
2026
- thumb_url?: string;
2027
- title?: string;
2028
- title_link?: string;
2029
- type?: string | 'video' | 'audio' | 'image';
2030
- };
501
+ export type OGAttachment = RequireLiteral<Attachment, 'og_scrape_url'>;
2031
502
  export type BlockList = {
2032
503
  name: string;
2033
504
  words: string[];
@@ -2037,82 +508,11 @@ export type BlockList = {
2037
508
  is_confusable_folding_enabled?: boolean;
2038
509
  is_leet_check_enabled?: boolean;
2039
510
  is_plural_check_enabled?: boolean;
2040
- is_substring_matching_enabled?: boolean;
2041
- };
2042
- export type ChannelConfig = ChannelConfigFields & CreatedAtUpdatedAt & {
2043
- commands?: CommandVariants[];
2044
- };
2045
- export type ChannelConfigAutomod = Automod;
2046
- export type ChannelConfigAutomodBehavior = AutomodBehavior;
2047
- export type ChannelConfigAutomodThresholds = null | Thresholds;
2048
- export type ChannelConfigFields = {
2049
- reminders: boolean;
2050
- automod?: ChannelConfigAutomod;
2051
- automod_behavior?: ChannelConfigAutomodBehavior;
2052
- automod_thresholds?: ChannelConfigAutomodThresholds;
2053
- blocklist_behavior?: ChannelConfigAutomodBehavior;
2054
- connect_events?: boolean;
2055
- custom_events?: boolean;
2056
- delivery_events?: boolean;
2057
- mark_messages_pending?: boolean;
2058
- max_message_length?: number;
2059
- message_retention?: string;
2060
- mutes?: boolean;
2061
- name?: string;
2062
- polls?: boolean;
2063
- push_notifications?: boolean;
2064
- quotes?: boolean;
2065
- reactions?: boolean;
2066
- read_events?: boolean;
2067
- replies?: boolean;
2068
- search?: boolean;
2069
- shared_locations?: boolean;
2070
- skip_last_msg_update_for_system_msgs?: boolean;
2071
- count_messages?: boolean;
2072
- typing_events?: boolean;
2073
- uploads?: boolean;
2074
- url_enrichment?: boolean;
2075
- user_message_reminders?: boolean;
2076
- push_level?: 'all' | 'all_mentions' | 'direct_mentions' | 'mentions' | 'none' | '';
2077
- };
2078
- export type ChannelConfigWithInfo = ChannelConfigFields & CreatedAtUpdatedAt & {
2079
- commands?: CommandResponse[];
2080
- };
2081
- export type ChannelData = CustomChannelData & Partial<{
2082
- blocked: boolean;
2083
- created_by: UserResponse | null;
2084
- created_by_id: UserResponse['id'];
2085
- members: string[] | Array<NewMemberPayload>;
2086
- blocklist_behavior: AutomodBehavior;
2087
- automod: Automod;
2088
- filter_tags: string[];
2089
- team?: string;
2090
- }>;
2091
- export type ChannelMute = {
2092
- user: UserResponse;
2093
- channel?: ChannelResponse;
2094
- created_at?: string;
2095
- expires?: string;
2096
- updated_at?: string;
2097
- };
2098
- export type ChannelRole = {
2099
- custom?: boolean;
2100
- name?: string;
2101
- owner?: boolean;
2102
- resource?: string;
2103
- same_team?: boolean;
2104
- };
2105
- export type CheckPushInput = {
2106
- apn_template?: string;
2107
- client_id?: string;
2108
- connection_id?: string;
2109
- firebase_data_template?: string;
2110
- firebase_template?: string;
2111
- message_id?: string;
2112
- user?: UserResponse;
2113
- user_id?: string;
2114
511
  };
2115
- export type PushProvider = 'apn' | 'firebase' | 'huawei' | 'xiaomi';
512
+ export type ChannelData = ReplacePropertyTypes<ChannelInput, {
513
+ custom: CustomChannelData;
514
+ }>;
515
+ export type PushProvider = CreateDeviceRequest['push_provider'];
2116
516
  export type PushProviderConfig = PushProviderCommon & PushProviderID & PushProviderAPN & PushProviderFirebase & PushProviderHuawei & PushProviderXiaomi;
2117
517
  export type PushProviderID = {
2118
518
  name: string;
@@ -2153,18 +553,7 @@ export type PushProviderXiaomi = {
2153
553
  };
2154
554
  export type CommandVariants = 'all' | 'ban' | 'fun_set' | 'giphy' | 'moderation_set' | 'mute' | 'unban' | 'unmute' | keyof CustomCommandData;
2155
555
  export type Configs = Record<string, ChannelConfigWithInfo | undefined>;
2156
- export type ConnectionOpen = {
2157
- connection_id: string;
2158
- cid?: string;
2159
- created_at?: string;
2160
- received_at?: string;
2161
- me?: OwnUserResponse;
2162
- type?: string;
2163
- };
2164
- export type CreatedAtUpdatedAt = {
2165
- created_at: string;
2166
- updated_at: string;
2167
- };
556
+ export type ConnectionOpen = EventPayload<'health.check'>;
2168
557
  export type Device = DeviceFields & {
2169
558
  provider?: string;
2170
559
  user?: UserResponse;
@@ -2180,38 +569,6 @@ export type DeviceFields = BaseDeviceFields & {
2180
569
  disabled?: boolean;
2181
570
  disabled_reason?: string;
2182
571
  };
2183
- export type EndpointName = 'Connect' | 'LongPoll' | 'DeleteFile' | 'DeleteImage' | 'DeleteMessage' | 'DeleteUser' | 'DeleteUsers' | 'DeactivateUser' | 'ExportUser' | 'DeleteReaction' | 'UpdateChannel' | 'UpdateChannelPartial' | 'UpdateMessage' | 'UpdateMessagePartial' | 'GetMessage' | 'GetManyMessages' | 'UpdateUsers' | 'UpdateUsersPartial' | 'CreateGuest' | 'GetOrCreateChannel' | 'StopWatchingChannel' | 'QueryChannels' | 'Search' | 'QueryUsers' | 'QueryMembers' | 'QueryBannedUsers' | 'QueryFlags' | 'QueryMessageFlags' | 'GetReactions' | 'GetReplies' | 'GetPinnedMessages' | 'Ban' | 'Unban' | 'MuteUser' | 'MuteChannel' | 'UnmuteChannel' | 'UnmuteUser' | 'RunMessageAction' | 'SendEvent' | 'SendUserCustomEvent' | 'MarkRead' | 'MarkChannelsRead' | 'SendMessage' | 'ImportChannelMessages' | 'UploadFile' | 'UploadImage' | 'UpdateApp' | 'GetApp' | 'CreateDevice' | 'DeleteDevice' | 'SendReaction' | 'Flag' | 'Unflag' | 'Unblock' | 'QueryFlagReports' | 'FlagReportReview' | 'CreateChannelType' | 'DeleteChannel' | 'DeleteChannels' | 'DBDeleteChannelType' | 'GetChannelType' | 'ListChannelTypes' | 'ListDevices' | 'TruncateChannel' | 'UpdateChannelType' | 'CheckPush' | 'PrivateSubmitModeration' | 'ReactivateUser' | 'HideChannel' | 'ShowChannel' | 'CreatePermission' | 'UpdatePermission' | 'GetPermission' | 'DeletePermission' | 'ListPermissions' | 'CreateRole' | 'DeleteRole' | 'ListRoles' | 'ListCustomRoles' | 'Sync' | 'TranslateMessage' | 'CreateCommand' | 'GetCommand' | 'UpdateCommand' | 'DeleteCommand' | 'ListCommands' | 'CreateBlockList' | 'UpdateBlockList' | 'GetBlockList' | 'ListBlockLists' | 'DeleteBlockList' | 'ExportChannels' | 'GetExportChannelsStatus' | 'CheckSQS' | 'GetRateLimits' | 'CreateSegment' | 'GetSegment' | 'QuerySegments' | 'UpdateSegment' | 'DeleteSegment' | 'CreateCampaign' | 'GetCampaign' | 'ListCampaigns' | 'UpdateCampaign' | 'DeleteCampaign' | 'ScheduleCampaign' | 'StopCampaign' | 'ResumeCampaign' | 'TestCampaign' | 'GetOG' | 'GetTask' | 'ExportUsers' | 'CreateImport' | 'CreateImportURL' | 'GetImport' | 'ListImports' | 'UpsertPushProvider' | 'DeletePushProvider' | 'ListPushProviders' | 'CreatePoll';
2184
- export type ExportChannelRequest = ({
2185
- id: string;
2186
- type: string;
2187
- } | {
2188
- cid: string;
2189
- }) & {
2190
- messages_since?: Date;
2191
- messages_until?: Date;
2192
- };
2193
- export type ExportChannelOptions = {
2194
- clear_deleted_message_text?: boolean;
2195
- export_users?: boolean;
2196
- include_soft_deleted_channels?: boolean;
2197
- include_truncated_messages?: boolean;
2198
- version?: string;
2199
- };
2200
- export type ExportUsersRequest = {
2201
- user_ids: string[];
2202
- };
2203
- export type Field = {
2204
- short?: boolean;
2205
- title?: string;
2206
- value?: string;
2207
- };
2208
- export type FileUploadConfig = {
2209
- allowed_file_extensions?: string[] | null;
2210
- allowed_mime_types?: string[] | null;
2211
- blocked_file_extensions?: string[] | null;
2212
- blocked_mime_types?: string[] | null;
2213
- size_limit?: number | null;
2214
- };
2215
572
  export type FirebaseConfig = {
2216
573
  apn_template?: string;
2217
574
  credentials_json?: string;
@@ -2220,17 +577,6 @@ export type FirebaseConfig = {
2220
577
  notification_template?: string;
2221
578
  server_key?: string;
2222
579
  };
2223
- type GiphyVersionInfo = {
2224
- height: string;
2225
- url: string;
2226
- width: string;
2227
- frames?: string;
2228
- size?: string;
2229
- };
2230
- export type GiphyVersions = 'original' | 'fixed_height' | 'fixed_height_still' | 'fixed_height_downsampled' | 'fixed_width' | 'fixed_width_still' | 'fixed_width_downsampled';
2231
- export type GiphyData = {
2232
- [key in GiphyVersions]: GiphyVersionInfo;
2233
- };
2234
580
  export type HuaweiConfig = {
2235
581
  enabled?: boolean;
2236
582
  id?: string;
@@ -2241,102 +587,8 @@ export type XiaomiConfig = {
2241
587
  package_name?: string;
2242
588
  secret?: string;
2243
589
  };
2244
- export type LiteralStringForUnion = string & {};
2245
- export type LogLevel = 'info' | 'error' | 'warn';
2246
- export type Logger = (logLevel: LogLevel, message: string, extraData?: Record<string, unknown>) => void;
2247
- export type Message = Partial<MessageBase & {
2248
- mentioned_users: string[];
2249
- shared_location?: StaticLocationPayload | LiveLocationPayload;
2250
- mentioned_channel?: boolean;
2251
- mentioned_here?: boolean;
2252
- mentioned_group_ids?: string[];
2253
- mentioned_roles?: string[];
2254
- }>;
2255
- export type MessageBase = CustomMessageData & {
2256
- id: string;
2257
- attachments?: Attachment[];
2258
- html?: string;
2259
- mml?: string;
2260
- parent_id?: string;
2261
- pin_expires?: string | null;
2262
- pinned?: boolean;
2263
- pinned_at?: string | null;
2264
- poll_id?: string;
2265
- quoted_message_id?: string;
2266
- restricted_visibility?: string[];
2267
- show_in_channel?: boolean;
2268
- silent?: boolean;
2269
- text?: string;
2270
- type?: MessageLabel;
2271
- user?: UserResponse | null;
2272
- user_id?: string;
2273
- };
2274
590
  export type MessageLabel = 'deleted' | 'ephemeral' | 'error' | 'regular' | 'reply' | 'system';
2275
- export type SendMessageOptions = {
2276
- force_moderation?: boolean;
2277
- is_pending_message?: boolean;
2278
- keep_channel_hidden?: boolean;
2279
- pending?: boolean;
2280
- pending_message_metadata?: Record<string, string>;
2281
- skip_enrich_url?: boolean;
2282
- skip_push?: boolean;
2283
- };
2284
- export type UpdateMessageOptions = {
2285
- skip_enrich_url?: boolean;
2286
- skip_push?: boolean;
2287
- };
2288
- export type SendReactionOptions = {
2289
- enforce_unique?: boolean;
2290
- skip_push?: boolean;
2291
- };
2292
- export type GetMessageOptions = {
2293
- show_deleted_message?: boolean;
2294
- };
2295
- export type Mute = {
2296
- created_at: string;
2297
- target: UserResponse;
2298
- updated_at: string;
2299
- user: UserResponse;
2300
- };
2301
- export type PartialUpdateChannelFields = Partial<ChannelResponse> & {
2302
- config_overrides?: Partial<ChannelConfigFields>;
2303
- };
2304
- export type PartialUpdateChannel = {
2305
- set?: PartialUpdateChannelFields;
2306
- unset?: Array<keyof PartialUpdateChannelFields>;
2307
- };
2308
- export type PartialUpdateMember = {
2309
- set?: ChannelMemberUpdates;
2310
- unset?: Array<keyof ChannelMemberUpdates>;
2311
- };
2312
- export type PartialUserUpdate = {
2313
- id: string;
2314
- set?: Partial<UserResponse>;
2315
- unset?: Array<keyof UserResponse>;
2316
- };
2317
- export type MessageUpdatableFields = Omit<MessageResponse, 'cid' | 'created_at' | 'updated_at' | 'deleted_at' | 'user' | 'user_id'>;
2318
- export type PartialMessageUpdate = {
2319
- set?: Partial<MessageUpdatableFields>;
2320
- unset?: Array<keyof MessageUpdatableFields>;
2321
- };
2322
- export type PendingMessageResponse = {
2323
- message: MessageResponse;
2324
- pending_message_metadata?: Record<string, string>;
2325
- };
2326
- export type PermissionAPIObject = {
2327
- action?: string;
2328
- condition?: object;
2329
- custom?: boolean;
2330
- description?: string;
2331
- id?: string;
2332
- level?: string;
2333
- name?: string;
2334
- owner?: boolean;
2335
- /** Resource type that defines ownership for this permission's action, e.g. 'Channel' for CreateMessage. */
2336
- owner_resource?: string;
2337
- same_team?: boolean;
2338
- tags?: string[];
2339
- };
591
+ export type SendMessageOptions = Omit<SendMessageRequest, 'message'>;
2340
592
  export type PermissionObject = {
2341
593
  action?: 'Deny' | 'Allow';
2342
594
  name?: string;
@@ -2355,56 +607,8 @@ export type Policy = {
2355
607
  roles?: string[] | null;
2356
608
  updated_at?: string;
2357
609
  };
2358
- export type RateLimitsInfo = {
2359
- limit: number;
2360
- remaining: number;
2361
- reset: number;
2362
- };
2363
- export type RateLimitsMap = Record<EndpointName, RateLimitsInfo>;
2364
- export type Reaction = CustomReactionData & {
2365
- type: string;
2366
- message_id?: string;
2367
- score?: number;
2368
- user?: UserResponse | null;
2369
- user_id?: string;
2370
- emoji_code?: string;
2371
- };
2372
- export type Resource = 'AddLinks' | 'BanUser' | 'CreateChannel' | 'CreateMessage' | 'CreateReaction' | 'DeleteAttachment' | 'DeleteChannel' | 'DeleteMessage' | 'DeleteReaction' | 'EditUser' | 'MuteUser' | 'ReadChannel' | 'RunMessageAction' | 'UpdateChannel' | 'UpdateChannelMembers' | 'UpdateMessage' | 'UpdateUser' | 'UploadAttachment';
2373
- export type SearchPayload = Omit<SearchOptions, 'sort'> & {
2374
- client_id?: string;
2375
- connection_id?: string;
2376
- filter_conditions?: ChannelFilters;
2377
- message_filter_conditions?: MessageFilters;
2378
- message_options?: MessageOptions;
2379
- query?: string;
2380
- sort?: Array<{
2381
- direction: AscDesc;
2382
- field: keyof SearchMessageSortBase;
2383
- }>;
2384
- };
2385
- export type TestPushDataInput = {
2386
- apnTemplate?: string;
2387
- firebaseDataTemplate?: string;
2388
- firebaseTemplate?: string;
2389
- messageID?: string;
2390
- pushProviderName?: string;
2391
- pushProviderType?: PushProvider;
2392
- skipDevices?: boolean;
2393
- };
2394
- export type TestSQSDataInput = {
2395
- sqs_key?: string;
2396
- sqs_secret?: string;
2397
- sqs_url?: string;
2398
- };
2399
- export type TestSNSDataInput = {
2400
- sns_key?: string;
2401
- sns_secret?: string;
2402
- sns_topic_arn?: string;
2403
- };
2404
610
  export type TokenOrProvider = null | string | TokenProvider | undefined;
2405
611
  export type TokenProvider = () => Promise<string>;
2406
- export type TranslationLanguages = 'af' | 'am' | 'ar' | 'az' | 'bg' | 'bn' | 'bs' | 'cs' | 'da' | 'de' | 'el' | 'en' | 'es' | 'es-MX' | 'et' | 'fa' | 'fa-AF' | 'fi' | 'fr' | 'fr-CA' | 'ha' | 'he' | 'hi' | 'hr' | 'hu' | 'id' | 'it' | 'ja' | 'ka' | 'ko' | 'lt' | 'lv' | 'ms' | 'nl' | 'no' | 'pl' | 'ps' | 'pt' | 'ro' | 'ru' | 'sk' | 'sl' | 'so' | 'sq' | 'sr' | 'sv' | 'sw' | 'ta' | 'th' | 'tl' | 'tr' | 'uk' | 'ur' | 'vi' | 'zh' | 'zh-TW' | (string & {});
2407
- export type TypingStartEvent = Event;
2408
612
  export type ReservedUpdatedMessageFields = keyof typeof RESERVED_UPDATED_MESSAGE_FIELDS;
2409
613
  export type UpdatedMessage = Omit<MessageResponse, ReservedUpdatedMessageFields | 'mentioned_groups'> & {
2410
614
  mentioned_users?: string[];
@@ -2414,979 +618,67 @@ export type UpdatedMessage = Omit<MessageResponse, ReservedUpdatedMessageFields
2414
618
  mentioned_roles?: string[];
2415
619
  type?: MessageLabel;
2416
620
  };
2417
- /**
2418
- * @description type alias for UserResponse
2419
- */
2420
- export type User = UserResponse;
2421
621
  export type TaskResponse = {
2422
622
  task_id: string;
2423
623
  };
2424
- export type DeleteChannelsResponse = {
2425
- result: Record<string, string>;
2426
- } & Partial<TaskResponse>;
2427
- export type DeleteType = 'soft' | 'hard' | 'pruning';
2428
- export type DeleteUserOptions = {
2429
- conversations?: Exclude<DeleteType, 'pruning'>;
2430
- messages?: DeleteType;
2431
- new_channel_owner_id?: string;
2432
- user?: DeleteType;
2433
- };
2434
- export type SegmentType = 'channel' | 'user';
2435
- export type SegmentData = {
2436
- all_sender_channels?: boolean;
2437
- all_users?: boolean;
2438
- description?: string;
2439
- filter?: {};
2440
- name?: string;
2441
- };
2442
- export type SegmentResponse = {
2443
- created_at: string;
2444
- deleted_at: string;
2445
- id: string;
2446
- locked: boolean;
2447
- size: number;
2448
- task_id: string;
2449
- type: SegmentType;
2450
- updated_at: string;
2451
- } & SegmentData;
2452
- export type UpdateSegmentData = {
2453
- name: string;
2454
- } & SegmentData;
2455
- export type SegmentTargetsResponse = {
2456
- created_at: string;
2457
- segment_id: string;
2458
- target_id: string;
2459
- };
2460
- export type SortParam = {
2461
- field: string;
2462
- direction?: AscDesc;
2463
- };
2464
624
  export type Pager = {
2465
625
  limit?: number;
2466
626
  next?: string;
2467
627
  prev?: string;
2468
628
  };
2469
- export type QuerySegmentsOptions = Pager;
2470
- export type QuerySegmentTargetsFilter = {
2471
- target_id?: {
2472
- $eq?: string;
2473
- $gte?: string;
2474
- $in?: string[];
2475
- $lte?: string;
2476
- };
2477
- };
2478
- export type QuerySegmentTargetsOptions = Pick<Pager, 'next' | 'limit'>;
2479
- export type GetCampaignOptions = {
2480
- users?: {
2481
- limit?: number;
2482
- next?: string;
2483
- prev?: string;
2484
- };
2485
- };
2486
- export type CampaignSort = {
2487
- field: string;
2488
- direction?: number;
2489
- }[];
2490
- export type CampaignQueryOptions = {
2491
- limit?: number;
2492
- next?: string;
2493
- prev?: string;
2494
- sort?: CampaignSort;
2495
- user_limit?: number;
2496
- };
2497
- export type SegmentQueryOptions = CampaignQueryOptions;
2498
- export type CampaignFilters = {};
2499
- export type CampaignData = {
2500
- channel_template?: {
2501
- type: string;
2502
- custom?: {};
2503
- id?: string;
2504
- members?: string[];
2505
- members_template?: Array<{
2506
- user_id: string;
2507
- channel_role?: string;
2508
- custom?: Record<string, unknown>;
2509
- }>;
2510
- team?: string;
2511
- };
2512
- create_channels?: boolean;
2513
- deleted_at?: string;
2514
- description?: string;
2515
- id?: string | null;
2516
- message_template?: {
2517
- text: string;
2518
- attachments?: Attachment[];
2519
- custom?: {};
2520
- poll_id?: string;
2521
- };
2522
- name?: string;
2523
- segment_ids?: string[];
2524
- sender_id?: string;
2525
- sender_mode?: 'exclude' | 'include' | null;
2526
- sender_visibility?: 'hidden' | 'archived' | null;
2527
- show_channels?: boolean;
2528
- skip_push?: boolean;
2529
- skip_webhook?: boolean;
2530
- user_ids?: string[];
2531
- };
2532
- export type CampaignStats = {
2533
- progress?: number;
2534
- stats_channels_created?: number;
2535
- stats_completed_at?: string;
2536
- stats_messages_sent?: number;
2537
- stats_started_at?: string;
2538
- stats_users_read?: number;
2539
- stats_users_sent?: number;
2540
- };
2541
- export type CampaignResponse = {
2542
- created_at: string;
2543
- id: string;
2544
- segments: SegmentResponse[];
2545
- sender: UserResponse;
2546
- stats: CampaignStats;
2547
- status: 'draft' | 'scheduled' | 'in_progress' | 'completed' | 'stopped';
2548
- updated_at: string;
2549
- users: UserResponse[];
2550
- scheduled_for?: string;
2551
- } & CampaignData;
2552
- export type DeleteCampaignOptions = {};
2553
- export type TaskStatus = {
2554
- created_at: string;
2555
- status: string;
2556
- task_id: string;
2557
- updated_at: string;
2558
- error?: {
2559
- description: string;
2560
- type: string;
2561
- };
2562
- result?: UR;
2563
- };
2564
- export type TruncateOptions = {
2565
- hard_delete?: boolean;
2566
- message?: Message;
2567
- skip_push?: boolean;
2568
- truncated_at?: Date;
2569
- user?: UserResponse;
2570
- user_id?: string;
2571
- };
2572
- export type CreateImportURLResponse = {
2573
- path: string;
2574
- upload_url: string;
2575
- };
2576
- export type CreateImportResponse = {
2577
- import_task: ImportTask;
2578
- };
2579
- export type GetImportResponse = {
2580
- import_task: ImportTask;
2581
- };
2582
- export type CreateImportOptions = {
2583
- mode: 'insert' | 'upsert';
2584
- };
2585
- export type ListImportsPaginationOptions = {
2586
- limit?: number;
2587
- offset?: number;
2588
- };
2589
- export type ListImportsResponse = {
2590
- import_tasks: ImportTask[];
2591
- };
2592
- export type ImportTaskHistory = {
2593
- created_at: string;
2594
- next_state: string;
2595
- prev_state: string;
2596
- };
2597
- export type ImportTask = {
2598
- created_at: string;
2599
- history: ImportTaskHistory[];
2600
- id: string;
2601
- path: string;
2602
- state: string;
2603
- updated_at: string;
2604
- result?: UR;
2605
- size?: number;
2606
- };
2607
629
  export type MessageSetType = 'latest' | 'current' | 'new';
2608
- export type MessageSet = {
2609
- isCurrent: boolean;
2610
- isLatest: boolean;
2611
- messages: LocalMessage[];
2612
- pagination: {
2613
- hasNext: boolean;
2614
- hasPrev: boolean;
2615
- };
2616
- };
2617
- export type PushProviderUpsertResponse = {
2618
- push_provider: PushProvider;
2619
- };
2620
- export type PushProviderListResponse = {
2621
- push_providers: PushProvider[];
2622
- };
2623
- type ErrorResponseDetails = {
2624
- code: number;
2625
- messages: string[];
2626
- };
2627
- export type APIErrorResponse = {
2628
- duration: string;
2629
- message: string;
2630
- more_info: string;
2631
- StatusCode: number;
2632
- code?: number;
2633
- details?: ErrorResponseDetails;
2634
- };
2635
- export declare class ErrorFromResponse<T> extends Error {
2636
- code: number | null;
2637
- status: number;
2638
- response: AxiosResponse<T>;
2639
- name: string;
630
+ export declare class StreamAPIError<T = APIError> extends Error {
631
+ code: number | undefined;
632
+ status: number | undefined;
633
+ response: AxiosResponse<T> | undefined;
2640
634
  constructor(message: string, { code, status, response, }: {
2641
- code: ErrorFromResponse<T>['code'];
2642
- response: ErrorFromResponse<T>['response'];
2643
- status: ErrorFromResponse<T>['status'];
635
+ /**
636
+ * Stream error code (`APIError.code`)
637
+ */
638
+ code: StreamAPIError<T>['code'];
639
+ /**
640
+ * HTTP status code
641
+ */
642
+ status: StreamAPIError<T>['status'];
643
+ response: StreamAPIError<T>['response'];
2644
644
  });
645
+ get name(): string;
646
+ static withMetadata(metadata: Record<string, any>): string;
2645
647
  toJSON(): {
2646
- readonly message: `(${string}) - ${string}`;
648
+ readonly message: string;
2647
649
  readonly stack: string | undefined;
2648
650
  readonly name: string;
2649
- readonly code: number | null;
2650
- readonly status: number;
651
+ readonly code: number | undefined;
652
+ readonly status: number | undefined;
2651
653
  };
2652
654
  }
2653
- export type QueryPollsResponse = {
2654
- polls: PollResponse[];
2655
- next?: string;
2656
- };
2657
- export type CreatePollAPIResponse = {
2658
- poll: PollResponse;
2659
- };
2660
- export type GetPollAPIResponse = {
2661
- poll: PollResponse;
2662
- };
2663
- export type UpdatePollAPIResponse = {
2664
- poll: PollResponse;
2665
- };
2666
- export type PollResponse = CustomPollData & PollEnrichData & {
2667
- created_at: string;
2668
- created_by: UserResponse | null;
2669
- created_by_id: string;
2670
- enforce_unique_vote: boolean;
2671
- id: string;
2672
- max_votes_allowed: number;
2673
- name: string;
2674
- options: PollOption[];
2675
- updated_at: string;
2676
- allow_answers?: boolean;
2677
- allow_user_suggested_options?: boolean;
2678
- description?: string;
2679
- is_closed?: boolean;
2680
- voting_visibility?: VotingVisibility;
2681
- };
2682
- export type PollOption = {
2683
- created_at: string;
2684
- id: string;
2685
- poll_id: string;
2686
- text: string;
2687
- updated_at: string;
2688
- vote_count: number;
2689
- votes?: PollVote[];
2690
- };
655
+ export type PollResponse_old = PollResponseData & PollEnrichData;
2691
656
  export declare enum VotingVisibility {
2692
657
  anonymous = "anonymous",
2693
658
  public = "public"
2694
659
  }
2695
660
  export type PollEnrichData = {
2696
661
  answers_count: number;
2697
- latest_answers: PollAnswer[];
2698
- latest_votes_by_option: Record<string, PollVote[]>;
662
+ latest_answers: PollVoteResponseData[];
663
+ latest_votes_by_option: Record<string, PollVoteResponseData[]>;
2699
664
  vote_count: number;
2700
665
  vote_counts_by_option: Record<string, number>;
2701
- own_votes?: (PollVote | PollAnswer)[];
2702
- };
2703
- export type PollData = CustomPollData & {
2704
- id: string;
2705
- name: string;
2706
- allow_answers?: boolean;
2707
- allow_user_suggested_options?: boolean;
2708
- description?: string;
2709
- enforce_unique_vote?: boolean;
2710
- is_closed?: boolean;
2711
- max_votes_allowed?: number;
2712
- options?: PollOptionData[];
2713
- user_id?: string;
2714
- voting_visibility?: VotingVisibility;
666
+ own_votes?: PollVoteResponseData[];
2715
667
  };
2716
- export type CreatePollData = Partial<PollData> & Pick<PollData, 'name'>;
2717
668
  export type PartialPollUpdate = {
2718
- set?: Partial<PollData>;
2719
- unset?: Array<keyof PollData>;
669
+ set?: Partial<UpdatePollRequest>;
670
+ unset?: Array<keyof UpdatePollRequest>;
2720
671
  };
2721
- export type PollOptionData = CustomPollOptionData & {
2722
- text: string;
2723
- id?: string;
672
+ export type PollOptionData = UpdatePollOptionRequest & {
2724
673
  position?: number;
2725
674
  };
2726
- export type PartialPollOptionUpdate = {
2727
- set?: Partial<PollOptionResponse>;
2728
- unset?: Array<keyof PollOptionResponse>;
2729
- };
2730
- export type PollVoteData = {
2731
- answer_text?: string;
2732
- is_answer?: boolean;
2733
- option_id?: string;
2734
- };
2735
- export type PollPaginationOptions = {
2736
- limit?: number;
2737
- next?: string;
2738
- };
2739
- export type CreatePollOptionAPIResponse = {
2740
- poll_option: PollOptionResponse;
2741
- };
2742
- export type GetPollOptionAPIResponse = CreatePollOptionAPIResponse;
2743
- export type UpdatePollOptionAPIResponse = CreatePollOptionAPIResponse;
2744
- export type PollOptionResponse = CustomPollData & {
2745
- created_at: string;
2746
- id: string;
2747
- poll_id: string;
2748
- position: number;
2749
- text: string;
2750
- updated_at: string;
2751
- vote_count: number;
2752
- votes?: PollVote[];
2753
- };
2754
- export type PollVote = {
2755
- created_at: string;
2756
- id: string;
2757
- poll_id: string;
2758
- updated_at: string;
2759
- option_id?: string;
2760
- user?: UserResponse;
2761
- user_id?: string;
2762
- };
2763
- export type PollAnswer = Exclude<PollVote, 'option_id'> & {
2764
- answer_text: string;
2765
- is_answer: boolean;
2766
- };
2767
- export type PollVotesAPIResponse = {
2768
- votes: (PollVote | PollAnswer)[];
2769
- next?: string;
2770
- };
2771
- export type PollAnswersAPIResponse = {
2772
- votes: PollAnswer[];
2773
- next?: string;
2774
- };
2775
- export type CastVoteAPIResponse = {
2776
- vote: PollVote | PollAnswer;
2777
- };
2778
- export type QueryMessageHistoryFilters = QueryFilters<{
2779
- message_id?: RequireOnlyOne<Pick<QueryFilter<MessageHistoryEntry['message_id']>, '$eq' | '$in'>> | PrimitiveFilter<MessageHistoryEntry['message_id']>;
2780
- } & {
2781
- user_id?: RequireOnlyOne<Pick<QueryFilter<MessageHistoryEntry['message_updated_by_id']>, '$eq' | '$in'>> | PrimitiveFilter<MessageHistoryEntry['message_updated_by_id']>;
2782
- } & {
2783
- created_at?: RequireOnlyOne<Pick<QueryFilter<MessageHistoryEntry['message_updated_at']>, '$eq' | '$gt' | '$lt' | '$gte' | '$lte'>> | PrimitiveFilter<MessageHistoryEntry['message_updated_at']>;
2784
- }>;
2785
- export type QueryMessageHistorySort = QueryMessageHistorySortBase | Array<QueryMessageHistorySortBase>;
2786
- export type QueryMessageHistorySortBase = {
2787
- message_updated_at?: AscDesc;
2788
- message_updated_by_id?: AscDesc;
2789
- };
2790
- export type QueryMessageHistoryOptions = Pager;
2791
- export type MessageHistoryEntry = {
2792
- message_id: string;
2793
- message_updated_at: string;
2794
- attachments?: Attachment[];
2795
- message_updated_by_id?: string;
2796
- text?: string;
2797
- };
2798
- export type QueryMessageHistoryResponse = {
2799
- message_history: MessageHistoryEntry[];
2800
- next?: string;
2801
- prev?: string;
2802
- };
2803
- export type ModerationPayload = {
2804
- created_at: string;
2805
- custom?: Record<string, any>;
2806
- images?: string[];
2807
- texts?: string[];
2808
- videos?: string[];
2809
- };
2810
- export type ModV2ReviewStatus = 'complete' | 'flagged' | 'partial';
2811
- export type ModerationFlag = {
2812
- created_at: string;
2813
- custom: Record<string, any>;
2814
- entity_creator_id: string;
2815
- entity_id: string;
2816
- entity_type: string;
2817
- id: string;
2818
- reason: string;
2819
- result: Record<string, any>[];
2820
- review_queue_item_id: string;
2821
- updated_at: string;
2822
- user: UserResponse;
2823
- moderation_payload?: ModerationPayload;
2824
- moderation_payload_hash?: string;
2825
- };
2826
- export type ReviewQueueItem = {
2827
- actions_taken: any[];
2828
- appealed_by: string;
2829
- assigned_to: string;
2830
- completed_at: string;
2831
- config_key: string;
2832
- context: any[];
2833
- created_at: string;
2834
- created_by: string;
2835
- entity_id: string;
2836
- entity_type: string;
2837
- entity_creator_id?: string;
2838
- flags: ModerationFlag[];
2839
- has_image: boolean;
2840
- has_text: boolean;
2841
- has_video: boolean;
2842
- id: string;
2843
- moderation_payload: ModerationPayload;
2844
- moderation_payload_hash: string;
2845
- options: any;
2846
- recommended_action: string;
2847
- results: any;
2848
- reviewed_at: string;
2849
- status: string;
2850
- updated_at: string;
2851
- latest_moderator_action?: string;
2852
- };
2853
- export type CustomCheckFlag = {
2854
- type: string;
2855
- custom?: Record<string, any>[];
2856
- labels?: string[];
2857
- reason?: string;
2858
- };
2859
675
  export type MessageDeletionStrategy = 'soft' | 'hard' | 'pruning';
2860
- export type DeleteMessagesOptions = MessageDeletionStrategy;
2861
- export type DeleteMessageOptions = {
2862
- deleteForMe?: boolean;
2863
- hardDelete?: boolean;
2864
- };
2865
- export type SubmitActionOptions = {
2866
- appeal_id?: string;
2867
- ban?: {
2868
- target_user_id?: string;
2869
- shadow?: boolean;
2870
- reason?: string;
2871
- channel_ban_only?: boolean;
2872
- channel_cid?: string;
2873
- ip_ban?: boolean;
2874
- delete_messages?: MessageDeletionStrategy;
2875
- delete_reactions?: boolean;
2876
- timeout?: number;
2877
- };
2878
- block?: {
2879
- reason?: string;
2880
- };
2881
- custom?: {
2882
- id: string;
2883
- options?: Record<string, any>;
2884
- };
2885
- delete_activity?: {
2886
- hard_delete?: boolean;
2887
- reason?: string;
2888
- entity_id?: string;
2889
- entity_type?: string;
2890
- };
2891
- delete_comment?: {
2892
- hard_delete?: boolean;
2893
- reason?: string;
2894
- entity_id?: string;
2895
- entity_type?: string;
2896
- };
2897
- delete_message?: {
2898
- hard_delete?: boolean;
2899
- reason?: string;
2900
- entity_id?: string;
2901
- entity_type?: string;
2902
- };
2903
- delete_reaction?: {
2904
- hard_delete?: boolean;
2905
- reason?: string;
2906
- entity_id?: string;
2907
- entity_type?: string;
2908
- };
2909
- delete_user?: {
2910
- hard_delete?: boolean;
2911
- reason?: string;
2912
- mark_messages_deleted?: boolean;
2913
- delete_conversation_channels?: boolean;
2914
- delete_feeds_content?: boolean;
2915
- entity_id?: string;
2916
- entity_type?: string;
2917
- };
2918
- end_call?: Record<string, never>;
2919
- escalate?: {
2920
- reason: string;
2921
- category: string;
2922
- priority: string;
2923
- };
2924
- flag?: {
2925
- entity_type: string;
2926
- entity_id: string;
2927
- entity_creator_id?: string;
2928
- reason?: string;
2929
- moderation_payload?: ModerationPayload;
2930
- custom?: Record<string, any>;
2931
- };
2932
- kick_user?: Record<string, never>;
2933
- mark_reviewed?: {
2934
- disable_marking_content_as_reviewed?: boolean;
2935
- content_to_mark_as_reviewed_limit?: number;
2936
- decision_reason?: string;
2937
- };
2938
- reject_appeal?: {
2939
- decision_reason: string;
2940
- };
2941
- restore?: {
2942
- decision_reason?: string;
2943
- };
2944
- shadow_block?: {
2945
- reason?: string;
2946
- };
2947
- unban?: {
2948
- channel_cid?: string;
2949
- decision_reason?: string;
2950
- };
2951
- unblock?: {
2952
- decision_reason?: string;
2953
- };
2954
- user_id?: string;
2955
- };
2956
- export type SubmitActionResponse = APIResponse & {
2957
- item?: ReviewQueueItem;
2958
- };
2959
- export type GetUserModerationReportResponse = {
2960
- user: UserResponse;
2961
- user_blocks?: Array<{
2962
- blocked_at: string;
2963
- blocked_by_user_id: string;
2964
- blocked_user_id: string;
2965
- }>;
2966
- user_mutes?: Mute[];
2967
- };
2968
- export type CheckResponse = APIResponse & {
2969
- status: string;
2970
- task_id?: string;
2971
- recommended_action: string;
2972
- item?: ReviewQueueItem;
2973
- };
2974
- export type CustomCheckResponse = APIResponse & {
2975
- id: string;
2976
- item: ReviewQueueItem;
2977
- status: string;
2978
- };
2979
- export type QueryModerationConfigsFilters = QueryFilters<{
2980
- key?: string;
2981
- } & {
2982
- created_at?: PrimitiveFilter<string>;
2983
- } & {
2984
- updated_at?: PrimitiveFilter<string>;
2985
- } & {
2986
- team?: string;
2987
- }>;
2988
- export type ReviewQueueFilters = QueryFilters<{
2989
- assigned_to?: RequireOnlyOne<Pick<QueryFilter<ReviewQueueItem['assigned_to']>, '$eq' | '$in'>> | PrimitiveFilter<ReviewQueueItem['assigned_to']>;
2990
- } & {
2991
- completed_at?: RequireOnlyOne<Pick<QueryFilter<ReviewQueueItem['completed_at']>, '$eq' | '$gt' | '$lt' | '$gte' | '$lte'>> | PrimitiveFilter<ReviewQueueItem['completed_at']>;
2992
- } & {
2993
- config_key?: RequireOnlyOne<Pick<QueryFilter<ReviewQueueItem['config_key']>, '$eq' | '$in'>> | PrimitiveFilter<ReviewQueueItem['config_key']>;
2994
- } & {
2995
- entity_type?: RequireOnlyOne<Pick<QueryFilter<ReviewQueueItem['entity_type']>, '$eq' | '$in'>> | PrimitiveFilter<ReviewQueueItem['entity_type']>;
2996
- } & {
2997
- created_at?: RequireOnlyOne<Pick<QueryFilter<ReviewQueueItem['created_at']>, '$eq' | '$gt' | '$lt' | '$gte' | '$lte'>> | PrimitiveFilter<ReviewQueueItem['created_at']>;
2998
- } & {
2999
- id?: RequireOnlyOne<Pick<QueryFilter<ReviewQueueItem['id']>, '$eq' | '$in'>> | PrimitiveFilter<ReviewQueueItem['id']>;
3000
- } & {
3001
- entity_id?: RequireOnlyOne<Pick<QueryFilter<ReviewQueueItem['entity_id']>, '$eq' | '$in'>> | PrimitiveFilter<ReviewQueueItem['entity_id']>;
3002
- } & {
3003
- entity_creator_id?: RequireOnlyOne<Pick<QueryFilter<ReviewQueueItem['entity_creator_id']>, '$eq' | '$in'>> | PrimitiveFilter<ReviewQueueItem['entity_creator_id']>;
3004
- } & {
3005
- reviewed?: boolean;
3006
- } & {
3007
- reviewed_at?: RequireOnlyOne<Pick<QueryFilter<ReviewQueueItem['reviewed_at']>, '$eq' | '$gt' | '$lt' | '$gte' | '$lte'>> | PrimitiveFilter<ReviewQueueItem['reviewed_at']>;
3008
- } & {
3009
- status?: RequireOnlyOne<Pick<QueryFilter<ReviewQueueItem['status']>, '$eq' | '$in'>> | PrimitiveFilter<ReviewQueueItem['status']>;
3010
- } & {
3011
- updated_at?: RequireOnlyOne<Pick<QueryFilter<ReviewQueueItem['updated_at']>, '$eq' | '$gt' | '$lt' | '$gte' | '$lte'>> | PrimitiveFilter<ReviewQueueItem['updated_at']>;
3012
- } & {
3013
- has_image?: boolean;
3014
- } & {
3015
- has_text?: boolean;
3016
- } & {
3017
- has_video?: boolean;
3018
- } & {
3019
- has_media?: boolean;
3020
- } & {
3021
- language?: RequireOnlyOne<{
3022
- $contains?: string;
3023
- $eq?: string;
3024
- $in?: string[];
3025
- }>;
3026
- } & {
3027
- teams?: RequireOnlyOne<{
3028
- $contains?: PrimitiveFilter<string>;
3029
- $eq?: PrimitiveFilter<string>;
3030
- $in?: PrimitiveFilter<string>;
3031
- }> | PrimitiveFilter<string>;
3032
- } & {
3033
- user_report_reason?: RequireOnlyOne<{
3034
- $eq?: string;
3035
- }>;
3036
- } & {
3037
- recommended_action?: RequireOnlyOne<{
3038
- $eq?: string;
3039
- $in?: string[];
3040
- }>;
3041
- } & {
3042
- flagged_user_id?: RequireOnlyOne<{
3043
- $eq?: string;
3044
- }>;
3045
- } & {
3046
- category?: RequireOnlyOne<{
3047
- $eq?: string;
3048
- }>;
3049
- } & {
3050
- label?: RequireOnlyOne<{
3051
- $eq?: string;
3052
- $in?: string[];
3053
- }>;
3054
- } & {
3055
- reporter_type?: RequireOnlyOne<{
3056
- $eq?: 'automod' | 'user' | 'moderator' | 'admin' | 'velocity_filter';
3057
- }>;
3058
- } & {
3059
- reporter_id?: RequireOnlyOne<{
3060
- $eq?: string;
3061
- $in?: string[];
3062
- }>;
3063
- } & {
3064
- date_range?: RequireOnlyOne<{
3065
- $eq?: string;
3066
- }>;
3067
- } & {
3068
- latest_moderator_action?: RequireOnlyOne<Pick<QueryFilter<ReviewQueueItem['latest_moderator_action']>, '$eq' | '$in'>> | PrimitiveFilter<ReviewQueueItem['latest_moderator_action']>;
3069
- } & {
3070
- flags_count?: RequireOnlyOne<{
3071
- $eq?: number;
3072
- }>;
3073
- } & {
3074
- ai_text_severity?: RequireOnlyOne<{
3075
- $eq?: string;
3076
- }>;
3077
- } & {
3078
- channel_cid?: RequireOnlyOne<{
3079
- $eq?: string;
3080
- }>;
3081
- }>;
3082
- export type ReviewQueueSort = Sort<Pick<ReviewQueueItem, 'id' | 'created_at' | 'updated_at'>> | Array<Sort<Pick<ReviewQueueItem, 'id' | 'created_at' | 'updated_at'>>>;
3083
- export type QueryModerationConfigsSort = Array<Sort<'key' | 'created_at' | 'updated_at'>>;
3084
- export type ReviewQueuePaginationOptions = Pager;
3085
- export type FilterConfigResponse = {
3086
- llm_labels: string[];
3087
- ai_text_labels?: string[];
3088
- };
3089
- export type ModerationActionConfig = {
3090
- entity_type: string;
3091
- order: number;
3092
- action: string;
3093
- icon: string;
3094
- description: string;
3095
- custom?: Record<string, unknown>;
3096
- };
3097
- export type ReviewQueueResponse = {
3098
- items: ReviewQueueItem[];
3099
- action_config?: Record<string, ModerationActionConfig[]>;
3100
- filter_config?: FilterConfigResponse;
3101
- stats?: Record<string, unknown>;
3102
- next?: string;
3103
- prev?: string;
3104
- };
3105
- export type ModerationConfig = {
3106
- key: string;
3107
- ai_image_config?: AIImageConfig;
3108
- ai_text_config?: AITextConfig;
3109
- ai_video_config?: AIVideoConfig;
3110
- automod_platform_circumvention_config?: AutomodPlatformCircumventionConfig;
3111
- automod_semantic_filters_config?: AutomodSemanticFiltersConfig;
3112
- automod_toxicity_config?: AutomodToxicityConfig;
3113
- block_list_config?: BlockListConfig;
3114
- llm_config?: LLMConfig;
3115
- team?: string;
3116
- };
3117
- export type ModerationConfigResponse = ModerationConfig & {
3118
- created_at: string;
3119
- updated_at: string;
3120
- };
3121
- export type GetConfigResponse = {
3122
- config: ModerationConfigResponse;
3123
- };
3124
- export type QueryConfigsResponse = {
3125
- configs: ModerationConfigResponse[];
3126
- next?: string;
3127
- prev?: string;
3128
- };
3129
- export type UpsertConfigResponse = {
3130
- config: ModerationConfigResponse;
3131
- };
3132
- export type ModerationRule = {
3133
- id: string;
3134
- name: string;
3135
- description: string;
3136
- config_keys: string[];
3137
- team: string;
3138
- rule: RuleBuilderRule;
3139
- enabled: boolean;
3140
- created_at: string;
3141
- updated_at: string;
3142
- };
3143
- export type ModerationRuleRequest = {
3144
- name: string;
3145
- description: string;
3146
- config_keys: string[];
3147
- team: string;
3148
- rule: RuleBuilderRule;
3149
- enabled: boolean;
3150
- };
3151
- export type RuleBuilderRule = {
3152
- id: string;
3153
- rule_type: 'user' | 'content';
3154
- conditions?: RuleBuilderCondition[];
3155
- logic?: 'AND' | 'OR';
3156
- groups?: RuleBuilderConditionGroup[];
3157
- action: RuleBuilderAction;
3158
- cooldown_period?: string;
3159
- };
3160
- export type RuleBuilderCondition = {
3161
- type: string;
3162
- confidence?: number;
3163
- text_rule_params?: TextRuleParameters;
3164
- image_rule_params?: ImageRuleParameters;
3165
- video_rule_params?: VideoRuleParameters;
3166
- user_rule_params?: UserRuleParameters;
3167
- content_count_rule_params?: ContentCountRuleParameters;
3168
- text_content_params?: TextContentParameters;
3169
- image_content_params?: ImageContentParameters;
3170
- video_content_params?: VideoContentParameters;
3171
- user_created_within_params?: UserCreatedWithinParameters;
3172
- user_custom_property_params?: UserCustomPropertyParameters;
3173
- };
3174
- export type RuleBuilderConditionGroup = {
3175
- logic: 'AND' | 'OR';
3176
- conditions: RuleBuilderCondition[];
3177
- };
3178
- export type RuleBuilderAction = {
3179
- type: string;
3180
- ban_options?: BanOptions;
3181
- flag_user_options?: FlagUserOptions;
3182
- };
3183
- export type TextRuleParameters = {
3184
- threshold: number;
3185
- time_window: string;
3186
- harm_labels?: string[];
3187
- llm_harm_labels?: Record<string, string>;
3188
- contains_url?: boolean;
3189
- severity?: string;
3190
- blocklist_match?: string[];
3191
- };
3192
- export type ImageRuleParameters = {
3193
- threshold: number;
3194
- time_window: string;
3195
- harm_labels: string[];
3196
- };
3197
- export type VideoRuleParameters = {
3198
- threshold: number;
3199
- time_window: string;
3200
- harm_labels: string[];
3201
- };
3202
- export type UserRuleParameters = {
3203
- max_age: string;
3204
- };
3205
- export type ContentCountRuleParameters = {
3206
- threshold: number;
3207
- time_window: string;
3208
- };
3209
- export type TextContentParameters = {
3210
- harm_labels?: string[];
3211
- llm_harm_labels?: Record<string, string>;
3212
- contains_url?: boolean;
3213
- severity?: string;
3214
- blocklist_match?: string[];
3215
- };
3216
- export type ImageContentParameters = {
3217
- harm_labels: string[];
3218
- };
3219
- export type VideoContentParameters = {
3220
- harm_labels: string[];
3221
- };
3222
- export type UserCreatedWithinParameters = {
3223
- max_age: string;
3224
- };
3225
- export type UserCustomPropertyParameters = {
3226
- property_key: string;
3227
- operator: string;
3228
- expected_value: string;
3229
- };
3230
- export type BanOptions = {
3231
- duration: number;
3232
- reason: string;
3233
- shadow_ban: boolean;
3234
- ip_ban: boolean;
3235
- };
3236
- export type FlagUserOptions = {
3237
- reason: string;
3238
- };
3239
- export type QueryModerationRulesFilters = QueryFilters<{
3240
- name?: string;
3241
- team?: string;
3242
- enabled?: boolean;
3243
- rule_type?: string;
3244
- created_at?: PrimitiveFilter<string>;
3245
- updated_at?: PrimitiveFilter<string>;
3246
- }>;
3247
- export type QueryModerationRulesSort = Array<Sort<'name' | 'enabled' | 'team' | 'created_at' | 'updated_at'>>;
3248
- export type QueryModerationRulesResponse = {
3249
- rules: ModerationRule[];
3250
- default_llm_labels: Record<string, string>;
3251
- next?: string;
3252
- prev?: string;
3253
- };
3254
- export type UpsertModerationRuleResponse = {
3255
- rule: ModerationRule;
3256
- };
3257
676
  export type ModerationFlagOptions = {
3258
677
  custom?: Record<string, unknown>;
3259
678
  moderation_payload?: ModerationPayload;
3260
679
  user_id?: string;
3261
680
  };
3262
- export type ModerationMuteOptions = {
3263
- timeout?: number;
3264
- user_id?: string;
3265
- };
3266
- export type GetUserModerationReportOptions = {
3267
- create_user_if_not_exists?: boolean;
3268
- include_user_blocks?: boolean;
3269
- include_user_mutes?: boolean;
3270
- };
3271
681
  export type AIState = 'AI_STATE_ERROR' | 'AI_STATE_CHECKING_SOURCES' | 'AI_STATE_THINKING' | 'AI_STATE_GENERATING' | (string & {});
3272
- export type ModerationActionType = 'flag' | 'shadow' | 'remove' | 'bounce' | 'bounce_flag' | 'bounce_remove';
3273
- export type ModerationSeverity = 'low' | 'medium' | 'high' | 'critical';
3274
- export type AutomodRule = {
3275
- action: ModerationActionType;
3276
- label: string;
3277
- threshold: number;
3278
- };
3279
- export type BlockListRule = {
3280
- action: ModerationActionType;
3281
- name?: string;
3282
- };
3283
- export type BlockListConfig = {
3284
- enabled: boolean;
3285
- rules: BlockListRule[];
3286
- async?: boolean;
3287
- };
3288
- export type LLMConfig = {
3289
- rules: LLMRule[];
3290
- severity_descriptions?: Record<ModerationSeverity, string>;
3291
- app_context?: string;
3292
- };
3293
- export type LLMRule = {
3294
- label: string;
3295
- description: string;
3296
- action: ModerationActionType;
3297
- severity_rules?: LLMSeverityRule[];
3298
- };
3299
- export type LLMSeverityRule = {
3300
- severity: ModerationSeverity;
3301
- action: ModerationActionType;
3302
- };
3303
- export type AutomodToxicityConfig = {
3304
- enabled: boolean;
3305
- rules: AutomodRule[];
3306
- async?: boolean;
3307
- };
3308
- export type AutomodPlatformCircumventionConfig = {
3309
- enabled: boolean;
3310
- rules: AutomodRule[];
3311
- async?: boolean;
3312
- };
3313
- export type AutomodSemanticFiltersRule = {
3314
- action: ModerationActionType;
3315
- name: string;
3316
- threshold: number;
3317
- };
3318
- export type AutomodSemanticFiltersConfig = {
3319
- enabled: boolean;
3320
- rules: AutomodSemanticFiltersRule[];
3321
- async?: boolean;
3322
- };
3323
- export type AITextSeverityRule = {
3324
- action: ModerationActionType;
3325
- severity: ModerationSeverity;
3326
- };
3327
- export type AITextRule = {
3328
- label: string;
3329
- action?: ModerationActionType;
3330
- severity_rules?: AITextSeverityRule[];
3331
- };
3332
- export type AITextConfig = {
3333
- enabled: boolean;
3334
- rules: AITextRule[];
3335
- async?: boolean;
3336
- profile?: string;
3337
- severity_rules?: AITextSeverityRule[];
3338
- };
3339
- export type AIImageRule = {
3340
- action: ModerationActionType;
3341
- label: string;
3342
- min_confidence?: number;
3343
- };
3344
- export type AIImageConfig = {
3345
- enabled: boolean;
3346
- rules: AIImageRule[];
3347
- async?: boolean;
3348
- };
3349
- export type AIVideoRule = {
3350
- action: ModerationActionType;
3351
- label: string;
3352
- min_confidence?: number;
3353
- };
3354
- export type AIVideoConfig = {
3355
- enabled: boolean;
3356
- rules: AIVideoRule[];
3357
- async?: boolean;
3358
- };
3359
- export type VelocityFilterConfigRule = {
3360
- action: 'flag' | 'shadow' | 'remove' | 'ban';
3361
- ban_duration?: number;
3362
- cascading_action?: 'flag' | 'shadow' | 'remove' | 'ban';
3363
- cascading_threshold?: number;
3364
- check_message_context?: boolean;
3365
- fast_spam_threshold?: number;
3366
- fast_spam_ttl?: number;
3367
- ip_ban?: boolean;
3368
- shadow_ban?: boolean;
3369
- slow_spam_ban_duration?: number;
3370
- slow_spam_threshold?: number;
3371
- slow_spam_ttl?: number;
3372
- };
3373
- export type VelocityFilterConfig = {
3374
- cascading_actions: boolean;
3375
- enabled: boolean;
3376
- first_message_only: boolean;
3377
- rules: VelocityFilterConfigRule[];
3378
- async?: boolean;
3379
- };
3380
- export type PromoteChannelParams = {
3381
- channels: Array<Channel>;
3382
- channelToMove: Channel;
3383
- sort: ChannelSort;
3384
- /**
3385
- * If the index of the channel within `channels` list which is being moved upwards
3386
- * (`channelToMove`) is known, you can supply it to skip extra calculation.
3387
- */
3388
- channelToMoveIndexWithinChannels?: number;
3389
- };
3390
682
  /**
3391
683
  * An identifier containing information about the downstream SDK using stream-chat. It
3392
684
  * is used to resolve the user agent.
@@ -3413,576 +705,77 @@ export type AppIdentifier = {
3413
705
  name: string;
3414
706
  version?: string;
3415
707
  };
3416
- export type DraftResponse = {
3417
- channel_cid: string;
3418
- created_at: string;
3419
- message: DraftMessage;
3420
- channel?: ChannelResponse;
3421
- parent_id?: string;
3422
- parent_message?: MessageResponseBase;
3423
- quoted_message?: MessageResponseBase;
3424
- };
3425
- export type CreateDraftResponse = APIResponse & {
3426
- draft: DraftResponse;
3427
- };
3428
- export type GetDraftResponse = APIResponse & {
3429
- draft: DraftResponse;
3430
- };
3431
- export type QueryDraftsResponse = APIResponse & {
3432
- drafts: DraftResponse[];
3433
- } & Omit<Pager, 'limit'>;
3434
- export type DraftMessagePayload = PartializeKeys<Omit<DraftMessage, 'mentioned_groups'>, 'id'> & {
3435
- user_id?: string;
3436
- };
3437
- export type DraftMessage = {
3438
- id: string;
3439
- text: string;
3440
- attachments?: Attachment[];
3441
- custom?: {};
3442
- html?: string;
3443
- mentioned_users?: string[];
3444
- mentioned_channel?: boolean;
3445
- mentioned_here?: boolean;
3446
- mentioned_group_ids?: string[];
3447
- mentioned_groups?: UserGroupResponse[];
3448
- mentioned_roles?: string[];
3449
- mml?: string;
3450
- parent_id?: string;
3451
- poll_id?: string;
3452
- quoted_message_id?: string;
3453
- shared_location?: StaticLocationPayload | LiveLocationPayload;
3454
- show_in_channel?: boolean;
3455
- silent?: boolean;
3456
- type?: MessageLabel;
3457
- };
3458
- export type ActiveLiveLocationsAPIResponse = APIResponse & {
3459
- active_live_locations: SharedLiveLocationResponse[];
3460
- };
3461
- export type SharedLocationResponse = {
3462
- channel_cid: string;
3463
- created_at: string;
3464
- created_by_device_id: string;
3465
- end_at?: string;
3466
- latitude: number;
3467
- longitude: number;
3468
- message_id: string;
3469
- updated_at: string;
3470
- user_id: string;
3471
- };
3472
- export type SharedStaticLocationResponse = {
3473
- channel_cid: string;
3474
- created_at: string;
3475
- created_by_device_id: string;
3476
- latitude: number;
3477
- longitude: number;
3478
- message_id: string;
3479
- updated_at: string;
3480
- user_id: string;
3481
- };
3482
- export type SharedLiveLocationResponse = {
3483
- channel_cid: string;
3484
- created_at: string;
3485
- created_by_device_id: string;
3486
- end_at: string;
3487
- latitude: number;
3488
- longitude: number;
3489
- message_id: string;
3490
- updated_at: string;
3491
- user_id: string;
3492
- };
3493
- export type UpdateLocationPayload = {
3494
- message_id: string;
3495
- created_by_device_id?: string;
3496
- end_at?: string;
3497
- latitude?: number;
3498
- longitude?: number;
3499
- user?: {
3500
- id: string;
3501
- };
3502
- user_id?: string;
3503
- };
3504
- export type StaticLocationPayload = {
3505
- created_by_device_id: string;
3506
- latitude: number;
3507
- longitude: number;
3508
- message_id: string;
3509
- };
3510
- export type LiveLocationPayload = {
3511
- created_by_device_id: string;
3512
- end_at: string;
3513
- latitude: number;
3514
- longitude: number;
3515
- message_id: string;
3516
- };
3517
- export type ThreadSort = ThreadSortBase | Array<ThreadSortBase>;
3518
- export type ThreadSortBase = {
3519
- active_participant_count?: AscDesc;
3520
- created_at?: AscDesc;
3521
- last_message_at?: AscDesc;
3522
- parent_message_id?: AscDesc;
3523
- participant_count?: AscDesc;
3524
- reply_count?: AscDesc;
3525
- updated_at?: AscDesc;
3526
- };
3527
- export type ThreadFilters = QueryFilters<{
3528
- channel_cid?: RequireOnlyOne<Pick<QueryFilter<string>, '$eq' | '$in'>> | PrimitiveFilter<string>;
3529
- } & {
3530
- parent_message_id?: RequireOnlyOne<Pick<QueryFilter<ThreadResponse['parent_message_id']>, '$eq' | '$in'>> | PrimitiveFilter<ThreadResponse['parent_message_id']>;
3531
- } & {
3532
- created_by_user_id?: RequireOnlyOne<Pick<QueryFilter<ThreadResponse['created_by_user_id']>, '$eq' | '$in'>> | PrimitiveFilter<ThreadResponse['created_by_user_id']>;
3533
- } & {
3534
- created_at?: RequireOnlyOne<Pick<QueryFilter<ThreadResponse['created_at']>, '$eq' | '$gt' | '$lt' | '$gte' | '$lte'>> | PrimitiveFilter<ThreadResponse['created_at']>;
3535
- } & {
3536
- updated_at?: RequireOnlyOne<Pick<QueryFilter<ThreadResponse['updated_at']>, '$eq' | '$gt' | '$lt' | '$gte' | '$lte'>> | PrimitiveFilter<ThreadResponse['updated_at']>;
3537
- } & {
3538
- last_message_at?: RequireOnlyOne<Pick<QueryFilter<ThreadResponse['last_message_at']>, '$eq' | '$gt' | '$lt' | '$gte' | '$lte'>> | PrimitiveFilter<ThreadResponse['last_message_at']>;
708
+ export type DraftMessage = DraftPayloadResponse & Partial<Pick<MessageResponse, 'shared_location' | 'mentioned_channel' | 'mentioned_group_ids' | 'mentioned_groups' | 'mentioned_here' | 'mentioned_roles'>>;
709
+ export type SharedLiveLocationResponse = RequireLiteral<SharedLocationResponseData, 'end_at'>;
710
+ export type LiveLocationPayload = RequireLiteral<SharedLocation, 'end_at'>;
711
+ export type ThreadSort = SortParamRequest[];
712
+ export type ThreadFilters = NonNullable<QueryThreadsRequest['filter']>;
713
+ export type CreateReminderOptions = Parameters<ChatApi['createReminder']>[0];
714
+ export type ReminderFilters = QueryFilters<{
715
+ channel_cid?: RequireOnlyOne<Pick<QueryFilter<ReminderResponseData['channel_cid']>, '$eq' | '$in'>> | PrimitiveFilter<ReminderResponseData['channel_cid']>;
716
+ created_at?: RequireOnlyOne<Pick<QueryFilter<ReminderResponseData['created_at']>, '$eq' | '$gt' | '$lt' | '$gte' | '$lte'>> | PrimitiveFilter<ReminderResponseData['created_at']>;
717
+ message_id?: RequireOnlyOne<Pick<QueryFilter<ReminderResponseData['message_id']>, '$eq' | '$in'>> | PrimitiveFilter<ReminderResponseData['message_id']>;
718
+ remind_at?: RequireOnlyOne<Pick<QueryFilter<ReminderResponseData['remind_at']>, '$exists' | '$eq' | '$gt' | '$lt' | '$gte' | '$lte'>> | PrimitiveFilter<ReminderResponseData['remind_at']>;
719
+ user_id?: RequireOnlyOne<Pick<QueryFilter<ReminderResponseData['user_id']>, '$eq' | '$in'>> | PrimitiveFilter<ReminderResponseData['user_id']>;
3539
720
  }>;
3540
- export type ReminderResponseBase = {
3541
- channel_cid: string;
3542
- created_at: string;
3543
- message_id: string;
3544
- updated_at: string;
3545
- user_id: string;
3546
- remind_at?: string;
721
+ export type ReminderSort = SortParamRequest[];
722
+ export type ListUserGroupsOptions = NonNullable<Parameters<ChatApi['listUserGroups']>[0]>;
723
+ export type SearchUserGroupsOptions = Parameters<ChatApi['searchUserGroups']>[0];
724
+ export type RateLimit = {
725
+ rate_limit?: number;
726
+ rate_limit_remaining?: number;
727
+ rate_limit_reset?: Date;
728
+ };
729
+ export type RequestMetadata = {
730
+ response_headers: Record<string, string>;
731
+ rate_limit: RateLimit;
732
+ response_code: number;
733
+ client_request_id: string;
734
+ };
735
+ export type StreamResponse<T> = T & {
736
+ metadata: RequestMetadata;
737
+ };
738
+ export type EventPayload<T extends Event['type'] | (string & {})> = Extract<Event, {
739
+ type: T;
740
+ }>;
741
+ export type RequireLiteral<L, T extends keyof L> = Omit<L, T> & Required<Pick<L, T>>;
742
+ export type ReplacePropertyTypes<Base, Replacement extends RequireAtLeastOne<Record<keyof Base, any>>> = keyof Replacement extends keyof Base ? Omit<Base, keyof Replacement> & {
743
+ [K in keyof Replacement as undefined extends Base[K] ? never : K]: Replacement[K];
744
+ } & {
745
+ [K in keyof Replacement as undefined extends Base[K] ? K : never]?: Replacement[K];
746
+ } : never;
747
+ export type PartializeAllBut<T, K extends keyof T> = {
748
+ [P in K]-?: T[P];
749
+ } & {
750
+ [P in Exclude<keyof T, K>]?: T[P];
751
+ };
752
+ export type DeleteMessageOptions = Omit<Parameters<ChatApi['deleteMessage']>[0], 'id'>;
753
+ export type SendMessageAPIResponse = StreamResponse<SendMessageResponse>;
754
+ export type UpdateMessageOptions = Omit<UpdateMessageRequest, 'message'>;
755
+ export type UpdateMessageAPIResponse = StreamResponse<UpdateMessageResponse>;
756
+ export type GiphyVersions = keyof Images;
757
+ export type TranslationLanguage = TranslateMessageRequest['language'];
758
+ export * from './gen/models';
759
+ export type EventAPIResponse = APIResponse & {
760
+ event: Event;
3547
761
  };
3548
- export type ReminderResponse = ReminderResponseBase & {
3549
- user: UserResponse;
3550
- message: MessageResponse;
3551
- channel?: ChannelResponse;
762
+ export type PartializeKeys<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T, K>;
763
+ type ErrorResponseDetails = {
764
+ code: number;
765
+ messages: string[];
3552
766
  };
3553
- export type ReminderAPIResponse = APIResponse & {
3554
- reminder: ReminderResponse;
767
+ export type APIErrorResponse = {
768
+ duration: string;
769
+ message: string;
770
+ more_info: string;
771
+ StatusCode: number;
772
+ code?: number;
773
+ details?: ErrorResponseDetails;
3555
774
  };
3556
- export type CreateReminderOptions = {
3557
- messageId: string;
3558
- remind_at?: string | null;
775
+ export type DraftMessagePayload = PartializeKeys<Omit<DraftMessage, 'mentioned_groups'>, 'id'> & {
3559
776
  user_id?: string;
3560
777
  };
3561
- export type UpdateReminderOptions = CreateReminderOptions;
3562
- export type ReminderFilters = QueryFilters<{
3563
- channel_cid?: RequireOnlyOne<Pick<QueryFilter<ReminderResponseBase['channel_cid']>, '$eq' | '$in'>> | PrimitiveFilter<ReminderResponseBase['channel_cid']>;
3564
- created_at?: RequireOnlyOne<Pick<QueryFilter<ReminderResponseBase['created_at']>, '$eq' | '$gt' | '$lt' | '$gte' | '$lte'>> | PrimitiveFilter<ReminderResponseBase['created_at']>;
3565
- message_id?: RequireOnlyOne<Pick<QueryFilter<ReminderResponseBase['message_id']>, '$eq' | '$in'>> | PrimitiveFilter<ReminderResponseBase['message_id']>;
3566
- remind_at?: RequireOnlyOne<Pick<QueryFilter<ReminderResponseBase['remind_at']>, '$exists' | '$eq' | '$gt' | '$lt' | '$gte' | '$lte'>> | PrimitiveFilter<ReminderResponseBase['remind_at']>;
3567
- user_id?: RequireOnlyOne<Pick<QueryFilter<ReminderResponseBase['user_id']>, '$eq' | '$in'>> | PrimitiveFilter<ReminderResponseBase['user_id']>;
3568
- }>;
3569
- export type ReminderSort = Sort<Pick<ReminderResponseBase, 'channel_cid' | 'created_at' | 'remind_at' | 'updated_at'>> | Array<Sort<Pick<ReminderResponseBase, 'channel_cid' | 'created_at' | 'remind_at' | 'updated_at'>>>;
3570
778
  export type QueryRemindersOptions = Pager & {
3571
779
  filter?: ReminderFilters;
3572
780
  sort?: ReminderSort;
3573
781
  };
3574
- export type QueryRemindersResponse = {
3575
- reminders: ReminderResponse[];
3576
- prev?: string;
3577
- next?: string;
3578
- };
3579
- export type UserGroupMemberResponse = {
3580
- group_id: string;
3581
- user_id: string;
3582
- is_admin: boolean;
3583
- created_at: string;
3584
- };
3585
- export type UserGroupResponse = {
3586
- id: string;
3587
- name: string;
3588
- created_at: string;
3589
- updated_at: string;
3590
- description?: string;
3591
- team_id?: string;
3592
- members?: UserGroupMemberResponse[];
3593
- created_by?: string;
3594
- };
3595
- export type CreateUserGroupOptions = {
3596
- /** Human-readable user group name */
3597
- name: string;
3598
- /** Optional user group description shown to members */
3599
- description?: string;
3600
- /** Optional custom user group ID. If omitted, the backend generates one */
3601
- id?: string;
3602
- /** Optional list of user IDs to add as members when the group is created */
3603
- member_ids?: string[];
3604
- /** Optional team ID that scopes the user group to a specific team */
3605
- team_id?: string;
3606
- };
3607
- export type CreateUserGroupResponse = APIResponse & {
3608
- user_group: UserGroupResponse;
3609
- };
3610
- export type GetUserGroupOptions = {
3611
- team_id?: string;
3612
- };
3613
- export type GetUserGroupResponse = APIResponse & {
3614
- user_group: UserGroupResponse;
3615
- };
3616
- export type QueryUserGroupsOptions = {
3617
- limit?: number;
3618
- id_gt?: string;
3619
- created_at_gt?: string;
3620
- team_id?: string;
3621
- };
3622
- export type QueryUserGroupsResponse = APIResponse & {
3623
- user_groups: UserGroupResponse[];
3624
- };
3625
- export type SearchUserGroupsOptions = {
3626
- query: string;
3627
- limit?: number;
3628
- id_gt?: string;
3629
- name_gt?: string;
3630
- team_id?: string;
3631
- };
3632
- export type SearchUserGroupsResponse = APIResponse & {
3633
- user_groups: UserGroupResponse[];
3634
- };
3635
- export type UpdateUserGroupOptions = {
3636
- description?: string;
3637
- name?: string;
3638
- team_id?: string;
3639
- };
3640
- export type UpdateUserGroupResponse = APIResponse & {
3641
- user_group: UserGroupResponse;
3642
- };
3643
- export type DeleteUserGroupOptions = {
3644
- team_id?: string;
3645
- };
3646
- export type AddUserGroupMembersOptions = {
3647
- member_ids: string[];
3648
- as_admin?: boolean;
3649
- team_id?: string;
3650
- };
3651
- export type AddUserGroupMembersResponse = APIResponse & {
3652
- user_group: UserGroupResponse;
3653
- };
3654
- export type RemoveUserGroupMembersOptions = {
3655
- member_ids: string[];
3656
- team_id?: string;
3657
- };
3658
- export type RemoveUserGroupMembersResponse = APIResponse & {
3659
- user_group: UserGroupResponse;
3660
- };
3661
- export type HookType = 'webhook' | 'sqs' | 'sns' | 'pending_message';
3662
- export type EventHook = {
3663
- id?: string;
3664
- hook_type?: HookType;
3665
- enabled?: boolean;
3666
- product?: Product | 'all';
3667
- event_types?: Array<string>;
3668
- webhook_url?: string;
3669
- sqs_queue_url?: string;
3670
- sqs_region?: string;
3671
- sqs_auth_type?: string;
3672
- sqs_key?: string;
3673
- sqs_secret?: string;
3674
- sqs_role_arn?: string;
3675
- sns_topic_arn?: string;
3676
- sns_region?: string;
3677
- sns_auth_type?: string;
3678
- sns_key?: string;
3679
- sns_secret?: string;
3680
- sns_role_arn?: string;
3681
- should_send_custom_events?: boolean;
3682
- timeout_ms?: number;
3683
- callback?: {
3684
- mode: 'CALLBACK_MODE_NONE' | 'CALLBACK_MODE_REST' | 'CALLBACK_MODE_TWIRP';
3685
- };
3686
- delete?: boolean;
3687
- created_at?: string;
3688
- updated_at?: string;
3689
- };
3690
- export type BatchUpdateOperation = 'addMembers' | 'removeMembers' | 'inviteMembers' | 'assignRoles' | 'addModerators' | 'demoteModerators' | 'hide' | 'show' | 'archive' | 'unarchive' | 'updateData';
3691
- export type BatchChannelDataUpdate = {
3692
- frozen?: boolean;
3693
- disabled?: boolean;
3694
- custom?: Record<string, unknown>;
3695
- team?: string;
3696
- config_overrides?: Record<string, unknown>;
3697
- auto_translation_enabled?: boolean;
3698
- auto_translation_language?: string;
3699
- };
3700
- export type UpdateChannelsBatchOptions = {
3701
- operation: BatchUpdateOperation;
3702
- filter: UpdateChannelsBatchFilters;
3703
- members?: string[] | Array<NewMemberPayload>;
3704
- data?: BatchChannelDataUpdate;
3705
- };
3706
- export type UpdateChannelsBatchFilters = QueryFilters<{
3707
- cids?: RequireOnlyOne<Pick<QueryFilter<string>, '$in' | '$eq'>> | PrimitiveFilter<string[]>;
3708
- types?: RequireOnlyOne<Pick<QueryFilter<string>, '$in' | '$eq'>> | PrimitiveFilter<string[]>;
3709
- }>;
3710
- export type UpdateChannelsBatchResponse = {
3711
- result: Record<string, string>;
3712
- } & Partial<TaskResponse>;
3713
- /**
3714
- * Predefined Filter Types
3715
- */
3716
- export type PredefinedFilterOperation = 'QueryChannels';
3717
- export type PredefinedFilterSortParam = {
3718
- /**
3719
- * Field name to sort by.
3720
- *
3721
- * This may be a literal field name such as `created_at`, or a placeholder
3722
- * template such as `{{sort_field}}` that will be interpolated server-side.
3723
- */
3724
- field: string;
3725
- /**
3726
- * Sort direction. `1` means ascending and `-1` means descending.
3727
- *
3728
- * The backend defaults this to `1` when omitted.
3729
- */
3730
- direction?: AscDesc;
3731
- /**
3732
- * Optional server-side hint describing how the sort field value should be
3733
- * interpreted.
3734
- *
3735
- * This is mainly relevant for predefined-filter sort templates and is not
3736
- * part of the regular `queryChannels()` sort shape. Omitting it uses the
3737
- * backend default string behavior. Known backend values include:
3738
- *
3739
- * - `number`: cast custom-field values to numeric before sorting
3740
- * - `boolean`: cast custom-field values to boolean before sorting
3741
- *
3742
- * Other values are backend-defined. In most cases this should be omitted
3743
- * unless you are sorting by a custom field whose stored JSON value is not
3744
- * string-like.
3745
- */
3746
- type?: string;
3747
- };
3748
- /**
3749
- * Stored predefined filter definition as returned by the server.
3750
- *
3751
- * `F` represents the raw filter template shape. It defaults to a generic record
3752
- * because predefined filters are server-managed templates and may include
3753
- * placeholders or app-specific structures.
3754
- */
3755
- export type PredefinedFilter<F extends Record<string, unknown> = Record<string, unknown>> = {
3756
- /**
3757
- * Unique predefined filter name within the app.
3758
- */
3759
- name: string;
3760
- /**
3761
- * Operation this predefined filter is valid for.
3762
- */
3763
- operation: PredefinedFilterOperation;
3764
- /**
3765
- * Filter template stored on the server.
3766
- *
3767
- * This is not necessarily the fully interpolated runtime filter; placeholder
3768
- * values such as `{{user_id}}` may still be present.
3769
- */
3770
- filter: F;
3771
- /**
3772
- * Server creation timestamp in ISO-8601 format.
3773
- */
3774
- created_at: string;
3775
- /**
3776
- * Server update timestamp in ISO-8601 format.
3777
- */
3778
- updated_at: string;
3779
- /**
3780
- * Optional human-readable description.
3781
- */
3782
- description?: string;
3783
- /**
3784
- * Optional sort template stored with the predefined filter.
3785
- */
3786
- sort?: PredefinedFilterSortParam[];
3787
- /**
3788
- * Query identifier generated by the backend for the filter/sort pattern.
3789
- *
3790
- * The exact value is backend-generated and primarily useful for correlating
3791
- * predefined filters with query analysis / query performance data.
3792
- */
3793
- query_id?: number;
3794
- };
3795
- export type CreatePredefinedFilterOptions<F extends Record<string, unknown> = Record<string, unknown>> = {
3796
- /**
3797
- * Unique predefined filter name.
3798
- */
3799
- name: string;
3800
- /**
3801
- * Operation this predefined filter will be used with.
3802
- */
3803
- operation: PredefinedFilterOperation;
3804
- /**
3805
- * Filter template to store on the server.
3806
- */
3807
- filter: F;
3808
- /**
3809
- * Optional human-readable description.
3810
- */
3811
- description?: string;
3812
- /**
3813
- * Optional sort template stored with the predefined filter.
3814
- */
3815
- sort?: PredefinedFilterSortParam[];
3816
- };
3817
- export type UpdatePredefinedFilterOptions<F extends Record<string, unknown> = Record<string, unknown>> = Omit<CreatePredefinedFilterOptions<F>, 'name'>;
3818
- export type PredefinedFilterResponse<F extends Record<string, unknown> = Record<string, unknown>> = APIResponse & {
3819
- predefined_filter: PredefinedFilter<F>;
3820
- };
3821
- /**
3822
- * Paginated response returned when listing predefined filters.
3823
- */
3824
- export type ListPredefinedFiltersResponse<F extends Record<string, unknown> = Record<string, unknown>> = APIResponse & {
3825
- predefined_filters: PredefinedFilter<F>[];
3826
- next?: string;
3827
- prev?: string;
3828
- };
3829
- /**
3830
- * Contains the interpolated filter and sort from a predefined filter.
3831
- * This is returned in the QueryChannels response when using a predefined filter.
3832
- */
3833
- export type ParsedPredefinedFilterResponse<F extends Record<string, unknown> = Record<string, unknown>> = {
3834
- /**
3835
- * Name of the predefined filter that was resolved.
3836
- */
3837
- name: string;
3838
- /**
3839
- * Fully interpolated filter that the backend executed.
3840
- */
3841
- filter: F;
3842
- /**
3843
- * Fully interpolated sort parameters resolved from the predefined filter.
3844
- */
3845
- sort?: PredefinedFilterSortParam[];
3846
- };
3847
- export type PredefinedFilterSort = SortParam[];
3848
- export type ListPredefinedFiltersOptions = Pager & {
3849
- sort?: PredefinedFilterSort;
3850
- };
3851
- /**
3852
- * Team Usage Stats Types
3853
- */
3854
- /**
3855
- * Represents a metric value for a specific date
3856
- */
3857
- export type DailyValue = {
3858
- /** Date in YYYY-MM-DD format */
3859
- date: string;
3860
- /** Metric value for this date */
3861
- value: number;
3862
- };
3863
- /**
3864
- * Statistics for a single metric with optional daily breakdown
3865
- */
3866
- export type MetricStats = {
3867
- /** Per-day values (only present in daily mode) */
3868
- daily?: DailyValue[];
3869
- /** Aggregated total value */
3870
- total: number;
3871
- };
3872
- /**
3873
- * Usage statistics for a single team containing all 16 metrics
3874
- */
3875
- export type TeamUsageStats = {
3876
- /** Team identifier (empty string for users not assigned to any team) */
3877
- team: string;
3878
- /** Daily active users */
3879
- users_daily: MetricStats;
3880
- /** Daily messages sent */
3881
- messages_daily: MetricStats;
3882
- /** Daily translations */
3883
- translations_daily: MetricStats;
3884
- /** Daily image moderations */
3885
- image_moderations_daily: MetricStats;
3886
- /** Peak concurrent users */
3887
- concurrent_users: MetricStats;
3888
- /** Peak concurrent connections */
3889
- concurrent_connections: MetricStats;
3890
- /** Total users */
3891
- users_total: MetricStats;
3892
- /** Users active in last 24 hours */
3893
- users_last_24_hours: MetricStats;
3894
- /** MAU - users active in last 30 days */
3895
- users_last_30_days: MetricStats;
3896
- /** Users active this month */
3897
- users_month_to_date: MetricStats;
3898
- /** Engaged MAU */
3899
- users_engaged_last_30_days: MetricStats;
3900
- /** Engaged users this month */
3901
- users_engaged_month_to_date: MetricStats;
3902
- /** Total messages */
3903
- messages_total: MetricStats;
3904
- /** Messages in last 24 hours */
3905
- messages_last_24_hours: MetricStats;
3906
- /** Messages in last 30 days */
3907
- messages_last_30_days: MetricStats;
3908
- /** Messages this month */
3909
- messages_month_to_date: MetricStats;
3910
- };
3911
- /**
3912
- * Options for querying team-level usage statistics
3913
- */
3914
- export type QueryTeamUsageStatsOptions = {
3915
- /**
3916
- * Month in YYYY-MM format (e.g., '2026-01').
3917
- * Mutually exclusive with start_date/end_date.
3918
- * Returns aggregated monthly values.
3919
- */
3920
- month?: string;
3921
- /**
3922
- * Start date in YYYY-MM-DD format.
3923
- * Used with end_date for custom date range.
3924
- * Returns daily breakdown.
3925
- */
3926
- start_date?: string;
3927
- /**
3928
- * End date in YYYY-MM-DD format.
3929
- * Used with start_date for custom date range.
3930
- * Returns daily breakdown.
3931
- */
3932
- end_date?: string;
3933
- /** Maximum number of teams to return per page (default: 30, max: 30) */
3934
- limit?: number;
3935
- /** Cursor for pagination to fetch next page of teams */
3936
- next?: string;
3937
- };
3938
- /**
3939
- * Response containing team-level usage statistics
3940
- */
3941
- export type QueryTeamUsageStatsResponse = APIResponse & {
3942
- /** Array of team usage statistics */
3943
- teams: TeamUsageStats[];
3944
- /** Cursor for pagination to fetch next page */
3945
- next?: string;
3946
- };
3947
- export type RetentionPolicyConfig = {
3948
- max_age_hours: number;
3949
- };
3950
- export type RetentionPolicy = {
3951
- app_pk: number;
3952
- policy: string;
3953
- config: RetentionPolicyConfig;
3954
- enabled_at: string;
3955
- };
3956
- export type SetRetentionPolicyResponse = APIResponse & {
3957
- policy: RetentionPolicy;
3958
- };
3959
- export type DeleteRetentionPolicyResponse = APIResponse;
3960
- export type GetRetentionPolicyResponse = APIResponse & {
3961
- policies: RetentionPolicy[];
3962
- };
3963
- export type RetentionRunStats = {
3964
- channels_deleted?: number;
3965
- messages_deleted?: number;
3966
- };
3967
- export type RetentionRunResponse = {
3968
- app_pk: number;
3969
- policy: string;
3970
- date: string;
3971
- stats: RetentionRunStats;
3972
- };
3973
- export type GetRetentionPolicyRunsOptions = {
3974
- filter_conditions?: Record<string, unknown>;
3975
- sort?: Array<{
3976
- field: string;
3977
- direction: 1 | -1;
3978
- }>;
3979
- next?: string;
3980
- prev?: string;
3981
- limit?: number;
3982
- };
3983
- export type GetRetentionPolicyRunsResponse = APIResponse & {
3984
- runs: RetentionRunResponse[];
3985
- next?: string;
3986
- prev?: string;
3987
- };
3988
- export {};