UNPKG

@sendbird/chat

Version:
1,462 lines (1,413 loc) 238 kB
import type AsyncStorage from '@react-native-async-storage/async-storage'; import type { MMKV } from 'react-native-mmkv'; /** * @description Object representing an admin message. */ export declare class AdminMessage extends BaseMessage { /** The translated messages (key-value map) for the language codes in key. */ translations: object; /** * @param ts * @param params * @returns * @description Retrieves the threaded replies of the current message depending on the timestamp. * If the current message doesn’t have replies, the result is an empty list. */ getThreadedMessagesByTimestamp( ts: number, params: ThreadedMessageListParams, ): Promise<{ parentMessage: BaseMessage; threadedMessages: BaseMessage[]; }>; } /** * @description Represents information obtained from the application settings. The values for this will be set after a connection has been made. */ export declare class AppInfo { /** The current registered emoji version hash. */ readonly emojiHash: string; /** The maximum limit of file size in bytes for uploading. */ readonly uploadSizeLimit: number; /** Whether an application is using the reaction feature. */ readonly useReaction: boolean; /** List of all attributes that the application is using. */ readonly applicationAttributes: string[]; /** List of all premium features that application is using. */ readonly premiumFeatureList: string[]; /** Whether device tokens would be cached. */ readonly deviceTokenCache: boolean; readonly enabledChannelMemberShipHistory: boolean; /** The maximum count of files that can be included in a single MultipleFilesMessage. */ readonly multipleFilesMessageFileCountLimit: number; /** Whether the SDK stat would be uploaded. */ readonly allowSdkStatsUpload: boolean; /** Whether to increase or decrease on thread messages. */ readonly unreadCountThreadingPolicy: UnreadCountThreadingPolicy; /** Whether to set a thread message as a last message. */ readonly lastMessageThreadingPolicy: LastMessageThreadingPolicy; /** Notification info. */ readonly notificationInfo: NotificationInfo | null; readonly uikitConfigInfo: UIKitConfigInfo; readonly messageTemplateInfo: MessageTemplateInfo | null; readonly disableSuperGroupMack: boolean; } /** * @description A class that can be used to send apple's critical alert. */ export declare class AppleCriticalAlertOptions { /** The name of the critical alert option. */ readonly name: string; /** The volumne of the critical alert option. */ readonly volume: number; } /** * @description A class representing query to retrieve lists related to User. */ export declare class ApplicationUserListQuery extends BaseListQuery { /** * @description User IDs filter. User list containing the passed User IDs will be returned. */ readonly userIdsFilter: string[] | null; /** * @description User meta data key filter. User list containing only and exactly the passed User meta data will be returned. */ readonly metaDataKeyFilter: string | null; /** * @description User meta data values filter. User list containing only and exactly the passed User meta data will be returned. */ readonly metaDataValuesFilter: string[] | null; /** * @description A filter to return users whose nicknames start with the specified string. */ readonly nicknameStartsWithFilter: string | null; /** * @returns * @description Gets the list of Users. * If this method is repeatedly called after each next is finished, it retrieves the following pages of the User list. * If there is no more pages to be read, an empty List (not null) is returned. */ next(): Promise<User[]>; } export declare interface ApplicationUserListQueryParams extends BaseListQueryParams { /** * @description User IDs filter. User list containing the passed User IDs will be returned. */ userIdsFilter?: string[]; /** * @description User meta data key filter. User list containing only and exactly the passed User meta data will be returned. */ metaDataKeyFilter?: string; /** * @description User meta data values filter. User list containing only and exactly the passed User meta data will be returned. */ metaDataValuesFilter?: string[]; /** * @description A filter to return users whose nicknames start with the specified string. */ nicknameStartsWithFilter?: string; } declare enum AuthTokenType { SESSION_TOKEN = 'session_token', ACCESS_TOKEN = 'access_token', } /** * @description A class representing query to retrieve lists related to banned User. */ export declare class BannedUserListQuery extends ChannelDataListQuery { /** * @returns * @description Gets the list of RestrictedUsers. * If this method is repeatedly called after each next is finished, * it retrieves the following pages of the RestrictedUser list. * If there is no more pages to be read, an empty List (not null) is returned. */ next(): Promise<RestrictedUser[]>; } export declare interface BannedUserListQueryParams extends BaseListQueryParams {} /** * @description Objects representing a channel. */ export declare class BaseChannel { /** The pinned message IDs of the channel. */ pinnedMessageIds: number[]; /** The unique channel URL. */ get url(): string; /** The topic or name of the channel. */ get name(): string; set name(value: string); /** The creation time of the channel in milliseconds. */ get createdAt(): number; channelType: ChannelType; /** The cover image URL. */ coverUrl: string; /** The custom type of the channel. */ customType: string; /** The channel data. */ data: string; /** Whether the channel is frozen. */ isFrozen: boolean; /** Whether the channel is ephemeral. */ isEphemeral: boolean; /** A {@link User} who created the channel. `null` if it's created by system. */ creator: User | null; /** * @returns * @description Whether the instance is {@link GroupChannel} type. */ isGroupChannel(): this is GroupChannel; /** * @returns * @description Whether the instance is {@link OpenChannel} type. */ isOpenChannel(): this is OpenChannel; /** * @returns * @description Whether the instance is {@link FeedChannel} type. */ isFeedChannel(): this is FeedChannel; /** All locally cached metadata as a map. */ get cachedMetaData(): object; /** The local timestamp of when this channel has been used in a {@link MessageCollection}. */ get messageCollectionLastAccessedAt(): number; /** * @param channel * @returns * @description Whether the given channel is identical to this channel. */ isIdentical(channel: BaseChannel): boolean; /** * @param channel * @returns * @description Whether the given channel is equal in all the values of this channel. */ isEqual(channel: BaseChannel): boolean; /** * @param params * @returns * @description Creates a query instance to get the operator list from this channel. */ createOperatorListQuery(params?: OperatorListQueryParams): OperatorListQuery; /** * @param params * @returns * @description Creates a query instance to get the muted user (online and offline both) list of this channel. */ createMutedUserListQuery(params?: MutedUserListQueryParams): MutedUserListQuery; /** * @param params * @returns * @description Creates a query instance to get the banned user list from this channel. */ createBannedUserListQuery(params?: BannedUserListQueryParams): BannedUserListQuery; /** * @param params * @returns * @description Creates previous message list query for this channel. */ createPreviousMessageListQuery(params?: PreviousMessageListQueryParams): PreviousMessageListQuery; /** * @param params * @returns * @description Creates a query instance to get pinned messages. */ createPinnedMessageListQuery(params?: PinnedMessageListQueryParams): PinnedMessageListQuery; /** * @param userIds * @description Add operators to the channel. */ addOperators(userIds: string[]): Promise<void>; /** * @param userIds * @description Remove operators from the channel. */ removeOperators(userIds: string[]): Promise<void>; /** * @returns * @description Gets my muted information in this channel. */ getMyMutedInfo(): Promise<MutedInfo>; /** * @param keys * @returns * @description Gets meta data. */ getMetaData(keys: string[]): Promise<MetaData>; /** * @returns * @description Gets all meta data. */ getAllMetaData(): Promise<MetaData>; /** * @param data * @returns * @description Creates meta data. This can be used to customize the channel. */ createMetaData(data: MetaData): Promise<MetaData>; /** * @param data * @param upsert * @returns * @description Updates meta data. */ updateMetaData(data: MetaData, upsert?: boolean): Promise<MetaData>; /** * @param key * @description Deletes a meta data. */ deleteMetaData(key: string): Promise<void>; /** * @description Deletes all meta data. */ deleteAllMetaData(): Promise<void>; /** * @param keys * @returns * @description Gets meta counters. */ getMetaCounters(keys: string[]): Promise<MetaCounter>; /** * @returns * @description Get all meta counters. */ getAllMetaCounters(): Promise<MetaCounter>; /** * @param data * @returns * @description Creates meta counters. This can be used to customize the channel. */ createMetaCounters(data: MetaCounter): Promise<MetaCounter>; /** * @param data * @param upsert * @returns * @description Updates meta counters. */ updateMetaCounters(data: MetaCounter, upsert?: boolean): Promise<MetaCounter>; /** * @param data * @returns * @description Increases meta counters. This increases atomically the keyed meta counter by the specified value. */ increaseMetaCounters(data: MetaCounter): Promise<MetaCounter>; /** * @param data * @returns * @description Decreases meta counters. This decreases atomically the keyed meta counter by the specified value. */ decreaseMetaCounters(data: MetaCounter): Promise<MetaCounter>; /** * @param key * @description Deletes a meta counter. */ deleteMetaCounter(key: string): Promise<void>; /** * @description Deletes all meta counters. */ deleteAllMetaCounters(): Promise<void>; /** * @param user * @param duration * @param description * @returns * @description Mutes a {@link User}. A muted user cannot send a message. */ muteUser(user: User, duration?: number, description?: string): Promise<void>; /** * @param userId * @param duration * @param description * @description Mutes a {@link User} with `userId`. A muted user cannot send a message. */ muteUserWithUserId(userId: string, duration?: number, description?: string): Promise<void>; /** * @param user * @returns * @description Unmutes {@link User}. The unmuted user could send a message again. */ unmuteUser(user: User): Promise<void>; /** * @param userId * @description Unmutes {@link User} with `userId`. The unmuted user could send a message again. */ unmuteUserWithUserId(userId: string): Promise<void>; /** * @param user * @param duration * @param description * @returns * @description Bans a member. Operators can ban members from this channel. * Banned member is kicked out of this channel and cannot enter during the specified seconds. * If you want to ban the user indefinitely, pass -1 to seconds as the argument. */ banUser(user: User, duration?: number, description?: string): Promise<void>; /** * @param userId * @param duration * @param description * @description Bans a member with `userId`. */ banUserWithUserId(userId: string, duration?: number, description?: string): Promise<void>; /** * @param user * @returns * @description Unbans {@link User}. Operators can unban User who has been banned from this channel. */ unbanUser(user: User): Promise<void>; /** * @param userId * @description Unbans {@link User} with `userId`. */ unbanUserWithUserId(userId: string): Promise<void>; /** * @description Freezes the channel. No one could send a message in a frozen channel. */ freeze(): Promise<void>; /** * @description Unfreezes the channel. */ unfreeze(): Promise<void>; /** * @param messageId * @param params * @returns * @description Retrieves previous or next messages based on the message ID in a specific channel. */ getMessagesByMessageId(messageId: number, params: MessageListParams): Promise<BaseMessage[]>; /** * @param ts * @param params * @returns * @description Retrieves previous or next messages based on the timestamp in a specific channel. */ getMessagesByTimestamp(ts: number, params: MessageListParams): Promise<BaseMessage[]>; /** * @param ts * @param params * @returns * @description Requests message change logs after given timestamp. */ getMessageChangeLogsSinceTimestamp(ts: number, params?: MessageChangeLogsParams): Promise<MessageChangelogs>; /** * * @param token * @param params * @returns * @description Requests message change logs after given token. */ getMessageChangeLogsSinceToken(token: string, params?: MessageChangeLogsParams): Promise<MessageChangelogs>; /** * @param params * @returns * @description Sends a user message. */ sendUserMessage(params: UserMessageCreateParams): MessageRequestHandler; /** * @deprecated since v4.9.8. Use resendMessage() instead. * @description Resends a failed user message. */ resendUserMessage(failedMessage: UserMessage): Promise<UserMessage>; /** * @param messageId * @param params * @returns * @description Updates a {@link UserMessage} that was previously sent in the channel. */ updateUserMessage(messageId: number, params: UserMessageUpdateParams): Promise<UserMessage>; /** * @deprecated since v4.9.8. Use copyMessage() instead. * @description Copies a user message from this channel to the target channel. */ copyUserMessage(targetChannel: BaseChannel, message: UserMessage): Promise<UserMessage>; /** * @param targetMessage * @param languages * @returns * @description Translates a user message. */ translateUserMessage(targetMessage: UserMessage, languages: string[]): Promise<UserMessage>; /** * @param params * @returns * @description Sends a file with given file information. */ sendFileMessage(params: FileMessageCreateParams): MessageRequestHandler; /** * @param params * @returns * @description Sends a multiple files or file URLs as a single {@link MultipleFilesMessage}. */ sendMultipleFilesMessage(params: MultipleFilesMessageCreateParams): MultipleFilesMessageRequestHandler; /** * @param paramsList * @returns * @description Sends files with given files information. * The maximum number of files is 20. This method handles FileMessageCreateParams only which have set binary file not URL. */ sendFileMessages(paramsList: FileMessageCreateParams[]): MessageRequestHandler; /** * @deprecated since v4.9.8. Use resendMessage() instead. * @description Resends a file with given file information. */ resendFileMessage(failedMessage: FileMessage, file?: FileCompat): Promise<FileMessage>; /** * @param failedMessage * @param file * @description Resends a failed message. */ resendMessage(failedMessage: FileMessage, file?: FileCompat): MessageRequestHandler<FileMessage>; /** * @param failedMessage * @param file * @description Resends a failed message. */ resendMessage(failedMessage: UserMessage): MessageRequestHandler<UserMessage>; /** * @param messageId * @param params * @returns * @description Updates a FileMessage that was previously sent in the channel. * Note that the file itself cannot be changed; only the fields stored within the message can be modified. */ updateFileMessage(messageId: number, params: FileMessageUpdateParams): Promise<FileMessage>; /** * @param params * @returns * @description Uploads a file and gets the URL and thumbnails. * It takes `progressHandler` as a parameter to keep track of upload progress. */ uploadFile(params: FileUploadParams): Promise<FileUploadResult>; /** * @param requestId * @returns * @description Cancels an ongoing {@link FileMessage} upload. */ cancelUploadingFileMessage(requestId: string): Promise<boolean>; /** * @deprecated since v4.9.8. Use copyMessage() instead. * @description Copies a file message from this channel to the target channel. */ copyFileMessage(targetChannel: BaseChannel, message: FileMessage): Promise<FileMessage>; /** * @param channel * @param message * @description Copies a message from this channel to the target channel. */ copyMessage(channel: BaseChannel, message: FileMessage): MessageRequestHandler<FileMessage>; /** * @param channel * @param message * @description Copies a message from this channel to the target channel. */ copyMessage(channel: BaseChannel, message: UserMessage): MessageRequestHandler<UserMessage>; /** * @param message * @description Deletes a message. */ deleteMessage(message: BaseMessage): Promise<void>; /** * @param message * @param key * @returns * @description Adds {@link Reaction}. */ addReaction(message: BaseMessage, key: string): Promise<ReactionEvent>; /** * @param message * @param key * @returns * @description Deletes {@link Reaction}. */ deleteReaction(message: BaseMessage, key: string): Promise<ReactionEvent>; /** * @param message * @param keys * @returns * @description Creates message meta array keys. */ createMessageMetaArrayKeys(message: BaseMessage, keys: string[]): Promise<BaseMessage>; /** * @param message * @param keys * @returns * @description Deletes message meta array keys. */ deleteMessageMetaArrayKeys(message: BaseMessage, keys: string[]): Promise<BaseMessage>; /** * @param message * @param metaArrays * @returns * @description Adds message meta array values. */ addMessageMetaArrayValues(message: BaseMessage, metaArrays: MessageMetaArray[]): Promise<BaseMessage>; /** * @param message * @param metaArrays * @returns * @description Removes message meta array values. */ removeMessageMetaArrayValues(message: BaseMessage, metaArrays: MessageMetaArray[]): Promise<BaseMessage>; /** * @param category * @param description * @description Reports this channel of inappropriate activities. */ report(category: ReportCategory | ReportCategoryInfo, description: string): Promise<void>; /** * @param user * @param category * @param description * @description Reports a user of suspicious activities. */ reportUser(user: User, category: ReportCategory | ReportCategoryInfo, description: string): Promise<void>; /** * @param message [UserMessage], [FileMessage] or [MultipleMessage] * @param category * @param description * @description Reports a malicious message. */ reportMessage( message: UserMessage | FileMessage | MultipleFilesMessage, category: ReportCategory | ReportCategoryInfo, description: string, ): Promise<void>; /** * @param pollId * @param params * @returns * @description Updates fields of this poll with given params. * Once updated successfully, a non-null {@link Poll} instance will be passed to the result. */ updatePoll(pollId: number, params: PollUpdateParams): Promise<Poll>; /** * @param pollId * @description Deletes this poll. Once deleted successfully, `null` will be passed to the result. */ deletePoll(pollId: number): Promise<void>; /** * @param pollId * @returns * @description Closes this poll. Once closed successfully, a non-null {@link Poll} instance will be passed to the result. */ closePoll(pollId: number): Promise<Poll>; /** * @param pollId * @param optionText * @returns * @description Adds an option with optionText to this poll. Once added successfully, a non-null {@link Poll} instance will be passed to the result. */ addPollOption(pollId: number, optionText: string): Promise<Poll>; /** * @param pollId * @param pollOptionId * @param optionText * @returns * @description Updates optionText fields of this poll option. Once updated successfully, a non-null {@link Poll} instance will be passed to the result. */ updatePollOption(pollId: number, pollOptionId: number, optionText: string): Promise<Poll>; /** * @param pollId * @param pollOptionId * @description Deletes this poll option. */ deletePollOption(pollId: number, pollOptionId: number): Promise<void>; /** * @param pollId * @param pollOptionIds * @returns * @description Vote on pollOptionIds. * This operation overrides previous vote actions, so to update previous vote, pass new pollOptionIds as parameter. * To cancel votes, pass an empty list as pollOptionIds. */ votePoll(pollId: number, pollOptionIds: number[]): Promise<PollVoteEvent>; /** * @param ts * @returns * @description Requests poll change logs after given timestamp. */ getPollChangeLogsSinceTimestamp(ts: number): Promise<PollChangelogs>; /** * @param token * @returns * @description Requests poll change logs after given token. */ getPollChangeLogsSinceToken(token: string | null): Promise<PollChangelogs>; /** * @param limit * @returns * @description Creates a query instance to get the poll list from this channel. */ createPollListQuery(limit?: number): PollListQuery; /** * @param pollId * @param pollOptionId * @param limit * @returns * @description Creates a query instance to get the voters of a poll option. */ createPollVoterListQuery(pollId: number, pollOptionId: number, limit?: number): PollVoterListQuery; /** * @param messageId * @description Pins a message to the channel. */ pinMessage(messageId: number): Promise<void>; /** * @param messageId * @description Removes the message from the channel's pinned messages. */ unpinMessage(messageId: number): Promise<void>; } /** * @description The context of channel-related events in colletions. */ declare type BaseChannelEventContext = | { source: CollectionEventSource.EVENT_CHANNEL_METADATA_CREATED; metaData: MetaData; } | { source: CollectionEventSource.EVENT_CHANNEL_METADATA_UPDATED; metaData: MetaData; } | { source: CollectionEventSource.EVENT_CHANNEL_METADATA_DELETED; metaDataKeys: string[]; } | { source: CollectionEventSource.EVENT_CHANNEL_METACOUNTER_CREATED; metaCounters: MetaCounter; } | { source: CollectionEventSource.EVENT_CHANNEL_METACOUNTER_UPDATED; metaCounters: MetaCounter; } | { source: CollectionEventSource.EVENT_CHANNEL_METACOUNTER_DELETED; metaCounterKeys: string[]; } | { source: CollectionEventSource.EVENT_CHANNEL_MUTED; user: RestrictedUser; } | { source: CollectionEventSource.EVENT_CHANNEL_UNMUTED; user: User; } | { source: CollectionEventSource.EVENT_CHANNEL_BANNED; user: RestrictedUser; } | { source: CollectionEventSource.EVENT_CHANNEL_UNBANNED; user: User; } | { source: CollectionEventSource.EVENT_CHANNEL_INVITED; inviter: User | null; invitees: User[]; } | { source: CollectionEventSource.EVENT_CHANNEL_JOINED; users: User[]; } | { source: CollectionEventSource.EVENT_CHANNEL_LEFT; user: User; } | { source: CollectionEventSource.EVENT_CHANNEL_DECLINED_INVITE; inviter: User; invitee: User; } | { source: CollectionEventSource.EVENT_CHANNEL_OPERATOR_UPDATED; operators: User[]; } | { source: | CollectionEventSource.UNKNOWN | CollectionEventSource.EVENT_CHANNEL_CREATED | CollectionEventSource.EVENT_CHANNEL_UPDATED | CollectionEventSource.EVENT_CHANNEL_DELETED | CollectionEventSource.EVENT_CHANNEL_READ | CollectionEventSource.EVENT_CHANNEL_DELIVERED | CollectionEventSource.EVENT_CHANNEL_ACCEPTED_INVITE | CollectionEventSource.EVENT_CHANNEL_FROZEN | CollectionEventSource.EVENT_CHANNEL_UNFROZEN | CollectionEventSource.EVENT_CHANNEL_HIDDEN | CollectionEventSource.EVENT_CHANNEL_UNHIDDEN | CollectionEventSource.EVENT_CHANNEL_RESET_HISTORY | CollectionEventSource.EVENT_CHANNEL_TYPING_STATUS_UPDATE | CollectionEventSource.EVENT_CHANNEL_MEMBER_COUNT_UPDATED | CollectionEventSource.EVENT_MESSAGE_SENT | CollectionEventSource.EVENT_MESSAGE_RECEIVED | CollectionEventSource.EVENT_MESSAGE_UPDATED | CollectionEventSource.EVENT_PINNED_MESSAGE_UPDATED | CollectionEventSource.REQUEST_CHANNEL | CollectionEventSource.REQUEST_CHANNEL_CHANGELOGS | CollectionEventSource.REFRESH_CHANNEL | CollectionEventSource.CHANNEL_LASTACCESSEDAT_UPDATED | CollectionEventSource.SYNC_CHANNEL_BACKGROUND | CollectionEventSource.SYNC_CHANNEL_CHANGELOGS | CollectionEventSource.EVENT_MESSAGE_SENT_SUCCESS | CollectionEventSource.EVENT_MESSAGE_SENT_FAILED | CollectionEventSource.EVENT_MESSAGE_SENT_PENDING | CollectionEventSource.EVENT_MESSAGE_DELETED | CollectionEventSource.EVENT_MESSAGE_FEEDBACK_ADDED | CollectionEventSource.EVENT_MESSAGE_FEEDBACK_UPDATED | CollectionEventSource.EVENT_MESSAGE_FEEDBACK_DELETED | CollectionEventSource.EVENT_MESSAGE_REACTION_UPDATED | CollectionEventSource.EVENT_MESSAGE_THREADINFO_UPDATED | CollectionEventSource.EVENT_MESSAGE_OFFSET_UPDATED | CollectionEventSource.REQUEST_MESSAGE | CollectionEventSource.EVENT_POLL_UPDATED | CollectionEventSource.EVENT_POLL_VOTED | CollectionEventSource.SYNC_POLL_CHANGELOGS | CollectionEventSource.REQUEST_RESEND_MESSAGE | CollectionEventSource.REQUEST_THREADED_MESSAGE | CollectionEventSource.REQUEST_MESSAGE_CHANGELOGS | CollectionEventSource.SYNC_MESSAGE_FILL | CollectionEventSource.SYNC_MESSAGE_BACKGROUND | CollectionEventSource.SYNC_MESSAGE_CHANGELOGS | CollectionEventSource.LOCAL_MESSAGE_PENDING_CREATED | CollectionEventSource.LOCAL_MESSAGE_FAILED | CollectionEventSource.LOCAL_MESSAGE_CANCELED | CollectionEventSource.LOCAL_MESSAGE_RESEND_STARTED | CollectionEventSource.EVENT_MESSAGE_READ | CollectionEventSource.EVENT_MESSAGE_DELIVERED | CollectionEventSource.EVENT_THREAD_INFO_UPDATED; }; declare abstract class BaseListQuery { /** * @description The maximum number of data per queried page. */ readonly limit: number; /** * @description Whether there is a next page. */ get hasNext(): boolean; /** * @description Whether the current query is in communication progress with server. */ get isLoading(): boolean; } declare interface BaseListQueryParams { /** * @description The maximum number of data per queried page. */ limit?: number; } export declare class BaseMessage extends MessagePrototype { /** The ID of the message. */ messageId: number; /** The parent message's ID if this is a reply message. */ parentMessageId: number; /** The parent message of this message. Only NonNull if this message is a reply message. It does not contain all properties of the parent message. */ parentMessage: BaseMessage | null; /** Checks whether the message is silent or not. */ silent: boolean; /** Whether the message was sent from an operator. */ isOperatorMessage: boolean; /** The thread info of the message. */ threadInfo: ThreadInfo | null; /** The reactions on the message. */ reactions: Reaction[]; /** The {@link OGMetaData} of the message. Might be null if */ ogMetaData: OGMetaData | null; /** The apple critical alert options of the message. */ appleCriticalAlertOptions: AppleCriticalAlertOptions | null; /** The scheduled info of the message if this is a scheduled message */ scheduledInfo: ScheduledInfo | null; /** The suggested replies of the message. */ suggestedReplies: string[] | null; /** * My feedback of the message. Not null, if its {@link FeedbackStatus} is <b>FeedbackStatus.SUBMITTED</b> * Null, if its FeedbackStatus is <b>FeedbackStatus.NOT_APPLICABLE</b> or <b>FeedbackStatus.NO_FEEDBACK/b>. */ myFeedback: Feedback | null; /** My feedback status of the message. */ myFeedbackStatus: FeedbackStatus; /** The form of the message. */ messageForm: MessageForm | null; /** The message text of the message. */ message: string; isIdentical(message: BaseMessage): boolean; /** * @param threadInfoUpdateEvent * @returns * @description Applies {@link ThreadInfoUpdateEvent} to a message. */ applyThreadInfoUpdateEvent(threadInfoUpdateEvent: ThreadInfoUpdateEvent): boolean; /** * @param reactionEvent * @description Applies {@link ReactionEvent} to message. */ applyReactionEvent(reactionEvent: ReactionEvent): void; /** * @param parentMessage * @returns * @description When parent message is updated, you can update the child message's parent message through this method. * If you use {@link MessageCollection}, messages in the collection are automatically updated, so don't need to call it. */ applyParentMessage(parentMessage: BaseMessage): boolean; /** * @param poll * @returns * @description When you get updated polls from groupChannel.getPollChangeLogsSinceToken() or groupChannel.getPollChangeLogsSinceTimestamp(), * you can update the user message's poll through this function. * If you use MessageCollection, messages in the collection are automatically updated, so don't need to call it. */ applyPoll(poll: Poll): boolean; /** The poll that belongs to this message object. */ get poll(): Poll | null; /** * @description Marks the message thread as read. */ markThreadAsRead(): Promise<void>; /** * @param pushEnabled * @description Sets push notification enabled for the thread. */ setPushNotificationEnabled(pushEnabled: boolean): Promise<void>; /** * @param data * @returns * @description Submits the message form of this message. */ submitMessageForm(): Promise<void>; /** * @deprecated since v4.13.0. Use submitMessageForm() instead. */ submitMessageForm(data: { formId: number; answers: Record<string, string> }): Promise<void>; /** * @param data * @description Submits the feedback for the message. * The feedback can be submitted only when the {@link FeedbackStatus} is {@link FeedbackStatus.NO_FEEDBACK}. */ submitFeedback(data: Pick<Feedback, 'rating' | 'comment'>): Promise<void>; /** * @param data * @description Updates the feedback for the message. * The feedback can be updated only when the {@link FeedbackStatus} is {@link FeedbackStatus.SUBMITTED}. */ updateFeedback(data: Feedback): Promise<void>; /** * @param feedbackId * @description Deletes the feedback for the message. * The feedback can be deleted only when the {@link FeedbackStatus} is {@link FeedbackStatus.SUBMITTED}. */ deleteFeedback(feedbackId: number): Promise<void>; } /** * @description Collection that handles message lists, also supporting local caching. */ declare abstract class BaseMessageCollection< Channel extends BaseChannel, Message extends MessagePrototype, MessageKeyType extends number | string, > { /** The filter to show matched messages only. */ readonly filter: MessageFilter; /** The channel of the messages. */ get channel(): Channel; /** The list of succeeded message list in this collection. */ get succeededMessages(): Message[]; /** The failed message lists. */ get failedMessages(): (UserMessage | FileMessage | MultipleFilesMessage)[]; /** The pending message lists. */ get pendingMessages(): (UserMessage | FileMessage | MultipleFilesMessage)[]; /** Whether there's more data to load in previous (oldest) direction. */ get hasPrevious(): boolean; /** Whether there's more data to load in next (latest) direction. */ get hasNext(): boolean; /** * @param policy * @returns * @description Initializes this collection from `startingPoint`. */ initialize(policy: MessageCollectionInitPolicy): MessageCollectionInitHandler<Message>; /** * @returns * @description Loads previous (oldest direction) message lists. */ loadPrevious(): Promise<Message[]>; /** * @returns * @description Loads next (latest direction) message lists. */ loadNext(): Promise<Message[]>; /** * @param reqId * @description Remove specific failed message of the channel. */ removeFailedMessage(reqId: string): Promise<void>; /** * @returns * @description Disposes current {@link BaseMessageCollection} and stops all events from being received. */ dispose(): void; } /** * @description An interface used in {@link MessageCollection}. */ declare interface BaseMessageCollectionEventHandler< Channel extends BaseChannel, Message extends MessagePrototype, MessageKeyType, ChannelEventContext extends BaseChannelEventContext, MessageEventContext extends BaseMessageEventContext, > { /** * @param context * @param channel * @returns * @description Called when there's a change in the channel this collection holds. */ onChannelUpdated?: (context: ChannelEventContext, channel: Channel) => void; /** * @param context * @param channelUrl * @returns * @description Called when the channel this collection holds is deleted. */ onChannelDeleted?: (context: ChannelEventContext, channelUrl: string) => void; /** * @param context * @param channel * @param messages * @returns * @description Called when one or more {@link BaseMessage} is added to this collection. */ onMessagesAdded?: (context: MessageEventContext, channel: Channel, messages: Message[]) => void; /** * @param context * @param channel * @param messages * @returns * @description Called when one or more {@link BaseMessage} is update in this collection. */ onMessagesUpdated?: (context: MessageEventContext, channel: Channel, messages: Message[]) => void; /** * @param context * @param channel * @param messageIds Deprecated since v4.3.1. Use messages instead. * @param messages * @returns * @description Called when one or more {@link BaseMessage} is deleted from this collection. */ onMessagesDeleted?: ( context: MessageEventContext, channel: Channel, messageIds: MessageKeyType[], messages: Message[], ) => void; /** * @returns * @description Called when the collection has detected a huge gap between current message list. * This can happen SDK checks for missing messages, which occurs in two cases. */ onHugeGapDetected?: () => void; } declare interface BaseMessageCollectionParams { filter?: MessageFilter; startingPoint?: number; /** * @deprecated since v4.10.5. Use `prevResultLimit`/`nextResultLimit` instead. */ limit?: number; prevResultLimit?: number; nextResultLimit?: number; } /** * @description Represents a base message params. */ export declare interface BaseMessageCreateParams { /** The data of the message. */ data?: string; /** The custom type of the message. */ customType?: string; /** The mention type of the message. (default: {@link MentionType.USERS}). */ mentionType?: MentionType; /** The mentioned user IDs of the message. */ mentionedUserIds?: string[]; /** The mentioned users of the message. */ mentionedUsers?: User[]; /** The meta arrays of the message. */ metaArrays?: MessageMetaArray[]; /** The parent message ID of the message. */ parentMessageId?: number; /** Whether the message should also be sent to the channel. (default: false) */ isReplyToChannel?: boolean; /** The push notification delivery option user of the message. */ pushNotificationDeliveryOption?: PushNotificationDeliveryOption; /** The apple critical alert options of the message. */ appleCriticalAlertOptions?: AppleCriticalAlertOptions; /** Whether the message should be pinned to the channel. (default: false) */ isPinnedMessage?: boolean; /** The poll id of the message. */ pollId?: number; } /** * @description The context of message-related events in colletions. */ declare type BaseMessageEventContext = { source: CollectionEventSource; }; /** * @description Represents a base message params. */ export declare interface BaseMessageUpdateParams { /** The data of the message. */ data?: string; /** The custom type of the message. */ customType?: string; /** The mention type of the message. */ mentionType?: MentionType; /** The mentioned user IDs of the message. */ mentionedUserIds?: string[]; /** The mentioned users of the message. */ mentionedUsers?: User[]; /** The meta arrays of the message. */ metaArrays?: MessageMetaArray[]; /** The push notification delivery option user of the message. */ pushNotificationDeliveryOption?: PushNotificationDeliveryOption; /** The apple critical alert options of the message. */ appleCriticalAlertOptions?: AppleCriticalAlertOptions; } declare abstract class BaseStore { dbname: string; readonly itemSizeLimit: number; readonly metadataBuffer: number; readonly encryption: Encryption; constructor(props: BaseStoreParams); abstract checkAvailability(): Promise<void>; abstract init(dbname: string): Promise<void>; get adjustedItemSizeLimit(): number; usage(): Promise<number>; getAllKeys(): Promise<string[]>; get(key: string): Promise<object | null>; set(item: StoreItem): Promise<object>; setMany(items: StoreItem[]): Promise<object[]>; remove(key: string): Promise<boolean>; removeMany(keys: string[]): Promise<string[]>; clear(): Promise<void>; } declare interface BaseStoreParams { encryption?: Encryption; itemSizeLimit?: number; metadataBuffer?: number; } /** * @description A class representing query to retrieve lists related to blocked User. */ export declare class BlockedUserListQuery extends BaseListQuery { /** * @description User IDs filter. User list containing the passed User IDs will be returned. */ readonly userIdsFilter: string[] | null; /** * @returns * @description Gets the list of Users. * If this method is repeatedly called after each next is finished, * it retrieves the following pages of the User list. * If there is no more pages to be read, an empty List (not null) is returned. */ next(): Promise<User[]>; } export declare interface BlockedUserListQueryParams extends BaseListQueryParams { /** * @description User IDs filter. User list containing the passed User IDs will be returned. */ userIdsFilter?: string[]; } export declare class CachedChannelInfo { get channel(): GroupChannel; get cachedMessageCount(): number; } export declare enum CachedDataClearOrder { CUSTOM = 'custom', MESSAGE_COLLECTION_ACCESSED_AT = 'messagecollection_accessed_at', } declare abstract class ChannelDataListQuery extends BaseListQuery { /** * @description A channel URL. */ readonly channelUrl: string; /** * @description A channel type. */ readonly channelType: ChannelType; } declare interface ChannelDataListQueryParams extends BaseListQueryParams { /** * @description A channel URL. */ channelUrl: string; /** * @description A channel type. */ channelType: ChannelType; } /** Represents channel types. */ export declare enum ChannelType { BASE = 'base', GROUP = 'group', OPEN = 'open', FEED = 'feed', } /** * @description Represents the source of the collection event. */ export declare enum CollectionEventSource { UNKNOWN = 'UNKNOWN', EVENT_CHANNEL_CREATED = 'EVENT_CHANNEL_CREATED', EVENT_CHANNEL_UPDATED = 'EVENT_CHANNEL_UPDATED', EVENT_CHANNEL_DELETED = 'EVENT_CHANNEL_DELETED', EVENT_CHANNEL_READ = 'EVENT_CHANNEL_READ', EVENT_CHANNEL_DELIVERED = 'EVENT_CHANNEL_DELIVERED', EVENT_CHANNEL_INVITED = 'EVENT_CHANNEL_INVITED', EVENT_CHANNEL_JOINED = 'EVENT_CHANNEL_JOINED', EVENT_CHANNEL_LEFT = 'EVENT_CHANNEL_LEFT', EVENT_CHANNEL_ACCEPTED_INVITE = 'EVENT_CHANNEL_ACCEPTED_INVITE', EVENT_CHANNEL_DECLINED_INVITE = 'EVENT_CHANNEL_DECLINED_INVITE', EVENT_CHANNEL_OPERATOR_UPDATED = 'EVENT_CHANNEL_OPERATOR_UPDATED', EVENT_CHANNEL_BANNED = 'EVENT_CHANNEL_BANNED', EVENT_CHANNEL_UNBANNED = 'EVENT_CHANNEL_UNBANNED', EVENT_CHANNEL_MUTED = 'EVENT_CHANNEL_MUTED', EVENT_CHANNEL_UNMUTED = 'EVENT_CHANNEL_UNMUTED', EVENT_CHANNEL_FROZEN = 'EVENT_CHANNEL_FROZEN', EVENT_CHANNEL_UNFROZEN = 'EVENT_CHANNEL_UNFROZEN', EVENT_CHANNEL_HIDDEN = 'EVENT_CHANNEL_HIDDEN', EVENT_CHANNEL_UNHIDDEN = 'EVENT_CHANNEL_UNHIDDEN', EVENT_CHANNEL_RESET_HISTORY = 'EVENT_CHANNEL_RESET_HISTORY', EVENT_CHANNEL_TYPING_STATUS_UPDATE = 'EVENT_CHANNEL_TYPING_STATUS_UPDATE', EVENT_CHANNEL_MEMBER_COUNT_UPDATED = 'EVENT_CHANNEL_MEMBER_COUNT_UPDATED', EVENT_CHANNEL_METADATA_CREATED = 'EVENT_CHANNEL_METADATA_CREATED', EVENT_CHANNEL_METADATA_UPDATED = 'EVENT_CHANNEL_METADATA_UPDATED', EVENT_CHANNEL_METADATA_DELETED = 'EVENT_CHANNEL_METADATA_DELETED', EVENT_CHANNEL_METACOUNTER_CREATED = 'EVENT_CHANNEL_METACOUNTER_CREATED', EVENT_CHANNEL_METACOUNTER_UPDATED = 'EVENT_CHANNEL_METACOUNTER_UPDATED', EVENT_CHANNEL_METACOUNTER_DELETED = 'EVENT_CHANNEL_METACOUNTER_DELETED', EVENT_MESSAGE_SENT = 'EVENT_MESSAGE_SENT', EVENT_MESSAGE_RECEIVED = 'EVENT_MESSAGE_RECEIVED', EVENT_MESSAGE_UPDATED = 'EVENT_MESSAGE_UPDATED', EVENT_PINNED_MESSAGE_UPDATED = 'EVENT_PINNED_MESSAGE_UPDATED', REQUEST_CHANNEL = 'REQUEST_CHANNEL', REQUEST_CHANNEL_CHANGELOGS = 'REQUEST_CHANNEL_CHANGELOGS', REFRESH_CHANNEL = 'REFRESH_CHANNEL', CHANNEL_LASTACCESSEDAT_UPDATED = 'CHANNEL_LASTACCESSEDAT_UPDATED', SYNC_CHANNEL_BACKGROUND = 'SYNC_CHANNEL_BACKGROUND', SYNC_CHANNEL_CHANGELOGS = 'SYNC_CHANNEL_CHANGELOGS', EVENT_MESSAGE_SENT_SUCCESS = 'EVENT_MESSAGE_SENT_SUCCESS', EVENT_MESSAGE_SENT_FAILED = 'EVENT_MESSAGE_SENT_FAILED', EVENT_MESSAGE_SENT_PENDING = 'EVENT_MESSAGE_SENT_PENDING', EVENT_MESSAGE_DELETED = 'EVENT_MESSAGE_DELETED', EVENT_MESSAGE_FEEDBACK_ADDED = 'EVENT_MESSAGE_FEEDBACK_ADDED', EVENT_MESSAGE_FEEDBACK_UPDATED = 'EVENT_MESSAGE_FEEDBACK_UPDATED', EVENT_MESSAGE_FEEDBACK_DELETED = 'EVENT_MESSAGE_FEEDBACK_DELETED', /** * @deprecated since v4.3.1 */ EVENT_MESSAGE_READ = 'EVENT_MESSAGE_READ', /** * @deprecated since v4.3.1 */ EVENT_MESSAGE_DELIVERED = 'EVENT_MESSAGE_DELIVERED', EVENT_MESSAGE_REACTION_UPDATED = 'EVENT_MESSAGE_REACTION_UPDATED', EVENT_MESSAGE_THREADINFO_UPDATED = 'EVENT_MESSAGE_THREADINFO_UPDATED', EVENT_MESSAGE_OFFSET_UPDATED = 'EVENT_MESSAGE_OFFSET_UPDATED', REQUEST_MESSAGE = 'REQUEST_MESSAGE', /** * @deprecated since v4.12.0 */ EVENT_THREAD_INFO_UPDATED = 'EVENT_THREADINFO_UPDATED', EVENT_POLL_UPDATED = 'EVENT_POLL_UPDATED', EVENT_POLL_VOTED = 'EVENT_POLL_VOTED', SYNC_POLL_CHANGELOGS = 'SYNC_POLL_CHANGELOGS', REQUEST_RESEND_MESSAGE = 'REQUEST_RESEND_MESSAGE', REQUEST_THREADED_MESSAGE = 'REQUEST_THREADED_MESSAGE', REQUEST_MESSAGE_CHANGELOGS = 'REQUEST_MESSAGE_CHANGELOGS', SYNC_MESSAGE_FILL = 'SYNC_MESSAGE_FILL', SYNC_MESSAGE_BACKGROUND = 'SYNC_MESSAGE_BACKGROUND', SYNC_MESSAGE_CHANGELOGS = 'SYNC_MESSAGE_CHANGELOGS', LOCAL_MESSAGE_PENDING_CREATED = 'LOCAL_MESSAGE_PENDING_CREATED', LOCAL_MESSAGE_FAILED = 'LOCAL_MESSAGE_FAILED', LOCAL_MESSAGE_CANCELED = 'LOCAL_MESSAGE_CANCELED', LOCAL_MESSAGE_RESEND_STARTED = 'LOCAL_MESSAGE_RESEND_STARTED', } declare type Comparator<T> = (value: T, other: T) => number; /** * @description Connection handler. This handler provides callbacks for automatically managed reconnection events. * SendbirdChat tries reconnection when the connection is lost. This handler can be used to track the reconnection state. * To add or remove this handler, refer to sendbirdChat.addConnectionHandler() and sendbirdChat.removeConnectionHandler(). */ export declare class ConnectionHandler extends ConnectionHandlerParams { constructor(params?: ConnectionHandlerParams); } declare abstract class ConnectionHandlerParams { /** A callback for when SendbirdChat is connected. */ onConnected?: (userId: string) => void; /** A callback for when SendbirdChat tries to reconnect. */ onReconnectStarted?: () => void; /** A callback for when connection is reestablished. */ onReconnectSucceeded?: () => void; /** A callback for when reconnection is failed. */ onReconnectFailed?: () => void; /** A callback for when SendbirdChat is disconnected. */ onDisconnected?: (userId: string) => void; } /** * @description SDK connection state. */ export declare enum ConnectionState { CONNECTING = 'CONNECTING', OPEN = 'OPEN', CLOSED = 'CLOSED', } /** The count preference. Refer to {@link GroupChannel.setMyCountPreference}. */ export declare enum CountPreference { ALL = 'all', UNREAD_MESSAGE_COUNT_ONLY = 'unread_message_count_only', UNREAD_MENTION_COUNT_ONLY = 'unread_mention_count_only', OFF = 'off', } /** * @description Object representing delivery status. */ export declare class DeliveryStatus { /** The channel URL of the channel that the message is delivered. */ readonly channelUrl: string; /** The channel type of the channel that the message is delivered. */ readonly channelType: string; /** The member of the channel. The delivery time of this member can be got by calling timestamp. */ readonly member: User; /** The delivery time of a member. */ readonly deliveryAt: number; } export declare interface DeviceOsInfo { platform: DeviceOsPlatform; version?: string; } export declare enum DeviceOsPlatform { ANDROID = 'android', IOS = 'ios', WEB = 'web', MOBILE_WEB = 'mobile_web', WINDOWS = 'windows', } export declare interface DoNotDisturbPreference { doNotDisturbOn: boolean; startHour?: number; startMin?: number; endHour?: number; endMin?: number; timezone?: string; } /** * @description Represents an emoji. */ export declare class Emoji { /** The key of the emoji. */ readonly key: string; /** The url of the emoji. */ readonly url: string; } /** * @description Represents an emoji category. */ export declare class EmojiCategory { /** The ID of the emoji category. */ readonly id: number; /** The name of the emoji category. */ readonly name: string; /** The url of the emoji category. */ readonly url: string; /** The list of emojis. */ readonly emojis: Emoji[]; } /** * @description Represents an emoji container. */ export declare class EmojiContainer { /** The hash value of emoji information. */ readonly emojiHash: string; /** The list of emoji categories. */ readonly emojiCategories: EmojiCategory[]; } export declare interface Encryption { encrypt: (obj: object) => object; decrypt: (encrypted: object) => object; } export declare type FailedMessageHandler<T> = (err: Error, message: T | null) => void; /** * @description User's feedback data about the message. */ export declare class Feedback { /** The feedback ID. This is used for deleting the feedback. */ readonly id: number; /** The feedback rating. */ readonly rating: FeedbackRating; /** The feedback comment. */ readonly comment?: string; constructor(payload: FeedbackPayload); } declare interface FeedbackPayload { id: number; rating: FeedbackRating; comment?: string; } /** * @description The feedback rating the user gave. */ export declare enum FeedbackRating { GOOD = 'good', BAD = 'bad', } /** The status of the feedback in the message. */ export declare type FeedbackStatus = /** Feedback is unavailable for this message. */ | 'NOT_APPLICABLE' /** Feedback can be set for this message, but nothing has been submitted yet. */ | 'NO_FEEDBACK' /** Feedback can be set for this message, and something has been submitted. */ | 'SUBMITTED'; /** * @description Represents a feed channel. */ export declare class FeedChannel extends BaseChannel { /** Weather the category filter is enabled or not. */ readonly isCategoryFilterEnabled: boolean; /** Weather the template label is enabled or not. */ readonly isTemplateLabelEnabled: boolean; /** The list of notification categories. */ readonly notificationCategories: NotificationCategory[]; /** The last message of the channel. */ lastMessage: NotificationMessage | null; get url(): string; get name(): string; set name(value: string); get createdAt(): number; /** Member list for this channel. */ get members(): Member[]; /** The total member count for this channel. */ get memberCount(): number; /** My member state. */ get myMemberState(): MemberState; /** Current user's last read receipt timestamp in channel. */ get myLastRead(): number; /** The unread message count for this channel for the currentUser. */ get unreadMessageCount(): number; /** * @returns * @description Serializes the FeedChannel instance. * The instance can be restored by {@link FeedChannelModule.buildFeedChannelFromSerializedData}. */ serialize(): object; /** * @returns * @description Refreshes all the data of this channel. */ refresh(): Promise<FeedChannel>; /** * @param messages * @description Send