UNPKG

@cometchat/chat-sdk-react-native

Version:
1,354 lines (1,297 loc) 249 kB
import * as React from 'react'; export namespace CometChat { export interface AssistantBaseEventData { timestamp: number; runId: string; threadId: string; [key: string]: any; } export class AIAssistantBaseEvent<T extends AssistantBaseEventData = AssistantBaseEventData> { type: string; conversationId: string; messageId: string; parentId: string; data: T; constructor(type: string, conversationId: string, messageId: string, parentId: string, data: T); getType(): string; setType(type: string): void; getConversationId(): string; setConversationId(conversationId: string): void; getMessageId(): string; setMessageId(messageId: string): void; getParentId(): string; setParentId(parentId: string): void; getData(): T; setData(data: T): void; getTimestamp(): number; setTimestamp(timestamp: number): void; getRunId(): string; setRunId(runId: string): void; getThreadId(): string; setThreadId(threadId: string): void; toJSON(): object; static fromJSON(json: any): AIAssistantBaseEvent; } export interface AssistantRunStartedEventData extends AssistantBaseEventData { [key: string]: any; } export class AIAssistantRunStartedEvent extends AIAssistantBaseEvent<AssistantRunStartedEventData> {} export interface AssistantRunFinishedEventData extends AssistantBaseEventData { [key: string]: any; } export class AIAssistantRunFinishedEvent extends AIAssistantBaseEvent<AssistantRunFinishedEventData> {} export interface AssistantMessageStartedEventData extends AssistantBaseEventData { role: string; [key: string]: any; } export class AIAssistantMessageStartedEvent extends AIAssistantBaseEvent<AssistantMessageStartedEventData> {} export interface AssistantMessageEndedEventData extends AssistantBaseEventData { [key: string]: any; } export class AIAssistantMessageEndedEvent extends AIAssistantBaseEvent<AssistantMessageEndedEventData> {} export interface AssistantContentEventData extends AssistantBaseEventData { delta: string; [key: string]: any; } export class AIAssistantContentReceivedEvent extends AIAssistantBaseEvent<AssistantContentEventData> { constructor( conversationId: string, messageId: string, parentId: string, data: AssistantContentEventData ); /** * Gets the delta value for the content received event * @returns The delta string */ public getDelta(): string; /** * Sets the delta value for the content received event * @param delta - The delta string to set */ public setDelta(delta: string): void; } export interface AssistantToolStartedEventData extends AssistantBaseEventData { toolCallId: string; toolCallName: string; displayName: string; executionText: string; [key: string]: any; } export class AIAssistantToolStartedEvent extends AIAssistantBaseEvent<AssistantToolStartedEventData> {} export interface AssistantToolArgumentEventData extends AssistantBaseEventData { toolCallId: string; delta: string; [key: string]: any; } export class AIAssistantToolArgumentEvent extends AIAssistantBaseEvent<AssistantToolArgumentEventData> {} export interface AssistantToolEndedEventData extends AssistantBaseEventData { toolCallId: string; [key: string]: any; } export class AIAssistantToolEndedEvent extends AIAssistantBaseEvent<AssistantToolEndedEventData> {} export interface AssistantToolResultEventData extends AssistantBaseEventData { toolCallId: string; content: string; role: string; [key: string]: any; } export class AIAssistantToolResultEvent extends AIAssistantBaseEvent<AssistantToolResultEventData> {} /** * * @module AIAssistantMessage */ export class AIAssistantMessageData { runId: string; threadId: string; text: string; constructor(runId: string, threadId: string, text: string); getRunId(): string; setRunId(runId: string): void; getThreadId(): string; setThreadId(threadId: string): void; getText(): string; setText(text: string): void; } export class AIAssistantMessage extends BaseMessage implements Message { protected data?: any; protected aiAssistantMessageData?: AIAssistantMessageData; constructor(receiverId: string, receiverType: string); /** * Method to get sender of the message. * @returns {User} */ getSender(): User; /** * Method to get receiver of the message. * @returns {User | Group} */ getReceiver(): User | Group; /** * Method to get data of the message. * @returns {AIAssistantMessageData} */ getAssistantMessageData(): AIAssistantMessageData; /** * Method to set data of the message. * @param {AIAssistantMessageData} data */ setAssistantMessageData(data: AIAssistantMessageData): void; /** * Method to get data of the message. * @returns {Object} */ getData(): any; /** * Get the tags of the message. * @returns {Array<String>} */ getTags(): Array<String>; /** * @param {Array<String>} tags * Set the tags for the message. */ setTags(tags: Array<String>): void; } /** * * @module AIToolResultMessage */ export class AIToolResultMessageData { runId: string; threadId: string; text: string; toolCallId: string; constructor(runId: string, threadId: string, text: string, toolCallId: string); /** * Get the run ID of the tool result message. * @returns {string} */ getRunId(): string; /** * Set the run ID of the tool result message. * @param {string} runId */ setRunId(runId: string): void; /** * Get the thread ID of the tool result message. * @returns {string} */ getThreadId(): string; /** * Set the thread ID of the tool result message. * @param {string} threadId */ setThreadId(threadId: string): void; /** * Get the text of the tool result message. * @returns {string} */ getText(): string; /** * Set the text of the tool result message. * @param {string} text */ setText(text: string): void; /** * Get the tool call ID of the tool result message. * @returns {string} */ getToolCallId(): string; /** * Set the tool call ID of the tool result message. * @param {string} toolCallId */ setToolCallId(toolCallId: string): void; } export class AIToolResultMessage extends BaseMessage implements Message { protected data?: any; protected toolMessageData?: AIToolResultMessageData; constructor(receiverId: string, receiverType: string); /** * Method to get sender of the message. * @returns {User} */ getSender(): User; /** * Method to get receiver of the message. * @returns {User | Group} */ getReceiver(): User | Group; /** * Method to get data of the message. * @returns {AIToolResultMessageData} */ getToolResultMessageData(): AIToolResultMessageData; /** * Method to set data of the message. * @param {AIAssistantMessageData} data */ setToolResultMessageData(data: AIToolResultMessageData): void; /** * Method to get data of the message. * @returns {Object} */ getData(): any; /** * Get the tags of the message. * @returns {Array<String>} */ getTags(): Array<String>; /** * @param {Array<String>} tags * Set the tags for the message. */ setTags(tags: Array<String>): void; } /** * * @module AIToolArgumentMessage */ export class AIToolCallFunction { name: string; arguments: string; constructor(name: string, args: string); /** * Get the name of the function. * @returns {string} */ getName(): string; /** * Set the name of the function. * @param {string} name */ setName(name: string): void; /** * Get the arguments of the function. * @returns {string} */ getArguments(): string; /** * Set the arguments of the function. * @param {string} args */ setArguments(args: string): void; } export class AIToolCall { id: string; type: string; displayName?: string; executionText?: string; function: AIToolCallFunction; constructor(id: string, type: string, functionObj: AIToolCallFunction, displayName?: string, executionText?: string); /** * Get the id of the tool call. * @returns {string} */ getId(): string; /** * Set the id of the tool call. * @param {string} id */ setId(id: string): void; /** * Get the type of the tool call. * @returns {string} */ getType(): string; /** * Set the type of the tool call. * @param {string} type */ setType(type: string): void; /** * Get the function associated with the tool call. * @returns {AIToolCallFunction} */ getFunction(): AIToolCallFunction; /** * Set the function associated with the tool call. * @param {AIToolCallFunction} functionObj */ setFunction(functionObj: AIToolCallFunction): void; /** * Get the display name of the tool call. * @returns {string | undefined} */ getDisplayName(): string | undefined; /** * Set the display name of the tool call. * @param {string} displayName */ setDisplayName(displayName: string): void; /** * Get the execution text of the tool call. * @returns {string | undefined} */ getExecutionText(): string | undefined; /** * Set the execution text of the tool call. * @param {string} executionText */ setExecutionText(executionText: string): void; /** * Convert the tool call to a JSON object. * @returns {Object} */ static fromJSON(json: any): AIToolCall; static fromArray(array: Array<any>): Array<AIToolCall>; } export class AIToolArgumentMessageData { runId: string; threadId: string; toolCalls?: Array<AIToolCall>; constructor(runId: string, threadId: string, toolCalls?: Array<AIToolCall>); /** * Get the run ID of the tool argument message. * @returns {string} */ getRunId(): string; /** * Set the run ID of the tool argument message. * @param {string} runId */ setRunId(runId: string): void; /** * Get the thread ID of the tool argument message. * @returns {string} */ getThreadId(): string; /** * Set the thread ID of the tool argument message. * @param {string} threadId */ setThreadId(threadId: string): void; /** * Get the tool calls associated with the tool argument message. * @returns {Array<AIToolCall> | undefined} */ getToolCalls(): Array<AIToolCall> | undefined; /** * Set the tool calls associated with the tool argument message. * @param {Array<AIToolCall>} toolCalls */ setToolCalls(toolCalls: Array<AIToolCall>): void; } export class AIToolArgumentMessage extends BaseMessage implements Message { protected data?: any; protected aiToolArgumentMessageData?: AIToolArgumentMessageData; constructor(receiverId: string, receiverType: string); /** * Method to get sender of the message. * @returns {User} */ getSender(): User; /** * Method to get receiver of the message. * @returns {User | Group} */ getReceiver(): User | Group; /** * Method to get data of the message. * @returns {AIToolArgumentMessageData} */ getToolArgumentMessageData(): AIToolArgumentMessageData; /** * Method to set data of the message. * @param {AIToolArgumentMessageData} data */ setToolArgumentMessageData(data: AIToolArgumentMessageData): void; /** * Method to get data of the message. * @returns {Object} */ getData(): any; /** * Get the tags of the message. * @returns {Array<String>} */ getTags(): Array<String>; /** * @param {Array<String>} tags * Set the tags for the message. */ setTags(tags: Array<String>): void; } } export namespace CometChatNotifications{ /** * Function to get preferences set for the logged-in user. * @returns {Promise<PushPreferences>} * @memberof CometChatNotifications * @deprecated * * This method is deprecated as of version 4.0.10 due to newer method 'fetchPreferences'. It will be removed in subsequent versions. */ export function fetchPushPreferences(): Promise<PushPreferences>; /** * Function to get preferences set for the logged-in user. * @returns {Promise<NotificationPreferences>} * @memberof CometChatNotifications */ export function fetchPreferences(): Promise<NotificationPreferences>; /** * Function to update preferences for the logged-in user. * @param {PushPreferences} pushPreferences * @returns {Promise<PushPreferences>} * @memberof CometChatNotifications * @deprecated * * This method is deprecated as of version 4.0.10 due to newer method 'updatePreferences'. It will be removed in subsequent versions. */ export function updatePushPreferences(pushPreferences: PushPreferences): Promise<PushPreferences>; /** * Function to update preferences for the logged-in user. * @param {NotificationPreferences} notificationPreferences * @returns {Promise<NotificationPreferences>} * @memberof CometChatNotifications */ export function updatePreferences(notificationPreferences: NotificationPreferences): Promise<NotificationPreferences>; /** * Function to reset preferences for the logged-in user. * @returns {Promise<PushPreferences>} * @memberof CometChatNotifications * @deprecated * * This method is deprecated as of version 4.0.10 due to newer method 'resetPreferences'. It will be removed in subsequent versions. */ export function resetPushPreferences(): Promise<PushPreferences>; /** * Function to reset preferences for the logged-in user. * @returns {Promise<NotificationPreferences>} * @memberof CometChatNotifications */ export function resetPreferences(): Promise<NotificationPreferences>; /** * Function to register push token for the current authToken of the logged-in user. * @returns {Promise<string>} * @param {string} pushToken * @param {PushPlatforms} platform * @param {string} providerId - Optional, default value is `default`. * @memberof CometChatNotifications */ export function registerPushToken(pushToken: string, platform: PushPlatforms, providerId?: string): Promise<string>; /** * Function to unregister push token registered for the current authToken of the logged-in user. * @returns {Promise<string>} * @memberof CometChatNotifications */ export function unregisterPushToken(): Promise<string>; /** * Function to mute conversations for the logged-in user. * @returns {Promise<string>} * @param {MutedConversation[]} mutedConversations * @memberof CometChatNotifications */ export function muteConversations(mutedConversations: MutedConversation[]): Promise<string>; /** * Function to unmute conversations for the logged-in user. * @returns {Promise<string>} * @param {UnmutedConversation[]} unmutedConversations * @memberof CometChatNotifications */ export function unmuteConversations(unmutedConversations: UnmutedConversation[]): Promise<string>; /** * Function to retrieve list of muted conversations for the logged-in user. * @returns {Promise<MutedConversation[]>} * @memberof CometChatNotifications */ export function getMutedConversations(): Promise<MutedConversation[]>; /** * Function to update timezone for the logged-in user. * @returns {Promise<string>} * @param {string} timezone * @memberof CometChatNotifications */ export function updateTimezone(timezone: String): Promise<string>; /** * Function to get timezone for the logged-in user. * @returns {Promise<{timezone: string} | string>} A promise that resolves to an object containing the timezone or a string in case of an error. * @memberof CometChatNotifications */ export function getTimezone(): Promise< | { timezone: string; } | string >; export enum MessagesOptions { DONT_SUBSCRIBE, SUBSCRIBE_TO_ALL, SUBSCRIBE_TO_MENTIONS } export enum RepliesOptions { DONT_SUBSCRIBE, SUBSCRIBE_TO_ALL, SUBSCRIBE_TO_MENTIONS } export enum ReactionsOptions { DONT_SUBSCRIBE, SUBSCRIBE_TO_REACTIONS_ON_OWN_MESSAGES, SUBSCRIBE_TO_REACTIONS_ON_ALL_MESSAGES } export enum MemberActionsOptions { DONT_SUBSCRIBE, SUBSCRIBE } export enum DNDOptions { DISABLED, ENABLED } export enum DayOfWeek { MONDAY = "monday", TUESDAY = "tuesday", WEDNESDAY = "wednesday", THURSDAY = "thursday", FRIDAY = "friday", SATURDAY = "saturday", SUNDAY = "sunday" } export enum MutedConversationType { ONE_ON_ONE = "oneOnOne", GROUP = "group" } export enum PushPlatforms { FCM_REACT_NATIVE_ANDROID = "fcm_react_native_android", FCM_REACT_NATIVE_IOS = "fcm_react_native_ios", APNS_REACT_NATIVE_DEVICE = "apns_react_native_device", APNS_REACT_NATIVE_VOIP = "apns_react_native_voip" } export const APIConstants: { KEY_GROUP_PREFERENCES: string; KEY_GROUP_MESSAGES: string; KEY_GROUP_REACTIONS: string; KEY_GROUP_REPLIES: string; KEY_GROUP_MEMBER_ADDED: string; KEY_GROUP_MEMBER_LEFT: string; KEY_GROUP_MEMBER_JOINED: string; KEY_GROUP_MEMBER_KICKED: string; KEY_GROUP_MEMBER_BANNED: string; KEY_GROUP_MEMBER_UNBANNED: string; KEY_GROUP_MEMBER_SCOPE_CHANGED: string; KEY_MUTE_PREFERENCES: string; KEY_MUTE_DND: string; KEY_MUTE_SCHEDULE: string; KEY_ONE_ON_ONE_PREFERENCES: string; KEY_ONE_ON_ONE_MESSAGES: string; KEY_ONE_ON_ONE_REACTIONS: string; KEY_ONE_ON_ONE_REPLIES: string; KEY_USE_PRIVACY_TEMPLATE: string; KEY_PROVIDER_ID: string; KEY_TIMEZONE: string; KEY_PLATFORM: string; KEY_FCM_TOKEN: string; KEY_CONVERSATIONS: string; KEY_GET_PREFERENCES: string; KEY_UPDATE_PREFERENCES: string; KEY_RESET_PREFERENCES: string; KEY_REGISTER_TOKEN: string; KEY_UNREGISTER_TOKEN: string; KEY_MUTE_CONVERSATIONS: string; KEY_UNMUTE_CONVERSATIONS: string; KEY_GET_MUTED_CONVERSATIONS: string; KEY_MUTED_CONVERSATIONS: string; KEY_FROM: string; KEY_TO: string; KEY_GET_TIMEZONE: string; KEY_UPDATE_TIMEZONE: string; }; export const APIResponseConstants: { TOKEN_REGISTER_SUCCESS: string; TOKEN_REGISTER_ERROR: string; TOKEN_UNREGISTER_SUCCESS: string; TOKEN_UNREGISTER_ERROR: string; MUTE_CONVERSATION_SUCCESS: string; MUTE_CONVERSATION_ERROR: string; UNMUTE_CONVERSATION_SUCCESS: string; UNMUTE_CONVERSATION_ERROR: string; TIMEZONE_UPDATE_SUCCESS: string; TIMEZONE_UPDATE_ERROR: string; TIMEZONE_FETCH_ERROR: string; }; export const DEFAULT_PROVIDER_ID = "default"; export class DaySchedule { constructor(from: number, to: number, dnd: boolean); /** * Get the from value of Day Schedule. * @returns {number} */ getFrom(): number; /** * @param {number} from * Set the from value of Day Schedule. */ setFrom(from: number): void; /** * Get the to value of Day Schedule. * @returns {number} */ getTo(): number; /** * @param {number} to * Set the to value of Day Schedule. */ setTo(to: number): void; /** * Get the value of DND of Day Schedule. * @returns {boolean} */ getDND(): boolean; /** * @param {boolean} dnd * Set the value of DND of Day Schedule. */ setDND(dnd: boolean): void; } /** * * @module GroupPreferences */ export class GroupPreferences { /** * Get the messages preferences for groups. * @returns {MessagesOptions} */ getMessagesPreference(): MessagesOptions; /** * Get the replies preferences for groups. * @returns {RepliesOptions} */ getRepliesPreference(): RepliesOptions; /** * Get the reactions preferences for groups. * @returns {ReactionsOptions} */ getReactionsPreference(): ReactionsOptions; /** * Get the member left preferences for groups. * @returns {MemberActionsOptions} */ getMemberLeftPreference(): MemberActionsOptions; /** * Get the member added preferences for groups. * @returns {MemberActionsOptions} */ getMemberAddedPreference(): MemberActionsOptions; /** * Get the member joined preferences for groups. * @returns {MemberActionsOptions} */ getMemberJoinedPreference(): MemberActionsOptions; /** * Get the member kicked preferences for groups. * @returns {MemberActionsOptions} */ getMemberKickedPreference(): MemberActionsOptions; /** * Get the member banned preferences for groups. * @returns {MemberActionsOptions} */ getMemberBannedPreference(): MemberActionsOptions; /** * Get the member unbanned preferences for groups. * @returns {MemberActionsOptions} */ getMemberUnbannedPreference(): MemberActionsOptions; /** * Get the member scope change preferences for groups. * @returns {MemberActionsOptions} */ getMemberScopeChangedPreference(): MemberActionsOptions; /** * @param {MessagesOptions} messagesPreference * Set messages preference for groups. */ setMessagesPreference(messagesPreference: MessagesOptions): void; /** * @param {RepliesOptions} repliesPreference * Set replies preference for groups. */ setRepliesPreference(repliesPreference: RepliesOptions): void; /** * @param {ReactionsOptions} reactionsPreference * Set reactions preference for groups. */ setReactionsPreference(reactionsPreference: ReactionsOptions): void; /** * @param {MemberActionsOptions} memberLeftPreference * Set member left preference for groups. */ setMemberLeftPreference(memberLeftPreference: MemberActionsOptions): void; /** * @param {MemberActionsOptions} memberAddedPreference * Set member added preference for groups. */ setMemberAddedPreference(memberAddedPreference: MemberActionsOptions): void; /** * @param {MemberActionsOptions} memberJoinedPreference * Set member joined preference for groups. */ setMemberJoinedPreference(memberJoinedPreference: MemberActionsOptions): void; /** * @param {MemberActionsOptions} memberKickedPreference * Set member kicked preference for groups. */ setMemberKickedPreference(memberKickedPreference: MemberActionsOptions): void; /** * @param {MemberActionsOptions} memberBannedPreference * Set member banned preference for groups. */ setMemberBannedPreference(memberBannedPreference: MemberActionsOptions): void; /** * @param {MemberActionsOptions} memberUnbannedPreference * Set member unbanned preference for groups. */ setMemberUnbannedPreference(memberUnbannedPreference: MemberActionsOptions): void; /** * @param {MemberActionsOptions} memberScopeChangedPreference * Set member scope change preference for groups. */ setMemberScopeChangedPreference(memberScopeChangedPreference: MemberActionsOptions): void; /** * @param {Object} jsonData * Convert JSON object to GroupPreferences. */ static fromJSON(jsonData: Object): GroupPreferences; } export class MutedConversation { /** * Get the id of muted conversation * @returns {string} */ getId(): string; /** * Set the id of muted conversation * @param {string} id */ setId(id: string): void; /** * Get the conversation type of muted conversation. * @returns {ConversationsType} */ getType(): ConversationsType; /** * Set the conversation type of muted conversation. * @param {ConversationsType} type */ setType(type: ConversationsType): void; /** * Get the date until which the conversation should be muted. * @returns {number} */ getUntil(): number; /** * Set the date until which the conversation should be muted. * @param {number} until */ setUntil(until: number): void; } export class MutePreferences { /** * Get the DND preferences. * @returns {DNDOptions} */ getDNDPreference(): DNDOptions; /** * @param {DNDOptions} dndPreferences * Set DND preferences. */ setDNDPreference(dndPreferences: DNDOptions): void; /** * Get the schedule preferences. * @returns {Map<DayOfWeek, DaySchedule>} */ getSchedulePreference(): Map<DayOfWeek, DaySchedule>; /** * @param {Map<DayOfWeek, DaySchedule>} schedule * Set the schedule preferences. */ setSchedulePreference(schedule: Map<DayOfWeek, DaySchedule>): void; /** * Get the schedule for a day. * @returns {DaySchedule} */ getScheduleFor(day: DayOfWeek): DaySchedule; /** * @param {DayOfWeek} day * @param {DaySchedule} schedule * Set the schedule for a day. */ setScheduleFor(day: DayOfWeek, schedule: DaySchedule): void; /** * @param {Object} jsonData * Convert JSON object to MutePreferences. */ static fromJSON(jsonData: Object): MutePreferences; } export class OneOnOnePreferences { /** * Get the reactions preferences for groups. * @returns {ReactionsOptions} */ getReactionsPreference(): ReactionsOptions; /** * @param {ReactionsOptions} reactionsPreference * Set reactions preference for groups. */ setReactionsPreference(reactionsPreference: ReactionsOptions): void; /** * Get the replies preferences for groups. * @returns {RepliesOptions} */ getRepliesPreference(): RepliesOptions; /** * @param {RepliesOptions} repliesPreference * Set replies preference for groups. */ setRepliesPreference(repliesPreference: RepliesOptions): void; /** * Get the messages preferences for groups. * @returns {MessagesOptions} */ getMessagesPreference(): MessagesOptions; /** * @param {MessagesOptions} messagesPreference * Set messages preference for groups. */ setMessagesPreference(messagesPreference: MessagesOptions): void; /** * @param {Object} jsonData * Convert JSON object to OneOnOnePreferences. */ static fromJSON(jsonData: Object): OneOnOnePreferences; } /** * @deprecated This class is deprecated as of version 4.0.10 due to newer class 'NotificationPreferences'. * It will be removed in subsequent versions. */ export class PushPreferences { /** * Get the OneOnOne preferences. * @returns {OneOnOnePreferences} */ getOneOnOnePreferences(): OneOnOnePreferences; /** * @param {OneOnOnePreferences} oneOnOnePreferences * Set the OneOnOne preferences. */ setOneOnOnePreferences(oneOnOnePreferences: OneOnOnePreferences): void; /** * Get the Muted preferences. * @returns {MutePreferences} */ getMutePreferences(): MutePreferences; /** * @param {MutePreferences} mutePreferences * Set the Mute preferences. */ setMutePreferences(mutePreferences: MutePreferences): void; /** * Get the Group preferences. * @returns {GroupPreferences} */ getGroupPreferences(): GroupPreferences; /** * @param {GroupPreferences} groupPreferences * Set the Group preferences. */ setGroupPreferences(groupPreferences: GroupPreferences): void; /** * Returns whether to use privacy template or not. * @returns {boolean} */ getUsePrivacyTemplate(): boolean; /** * @param {boolean} usePrivacyTemplate * Set whether to use privacy template or not. */ setUsePrivacyTemplate(usePrivacyTemplate: boolean): void; /** * @param {Object} jsonData * Convert JSON object to PushPreferences. */ static fromJSON(jsonData: Object): PushPreferences; } export class NotificationPreferences { /** * Get the OneOnOne preferences. * @returns {OneOnOnePreferences} */ getOneOnOnePreferences(): OneOnOnePreferences; /** * @param {OneOnOnePreferences} oneOnOnePreferences * Set the OneOnOne preferences. */ setOneOnOnePreferences(oneOnOnePreferences: OneOnOnePreferences): void; /** * Get the Muted preferences. * @returns {MutePreferences} */ getMutePreferences(): MutePreferences; /** * @param {MutePreferences} mutePreferences * Set the Mute preferences. */ setMutePreferences(mutePreferences: MutePreferences): void; /** * Get the Group preferences. * @returns {GroupPreferences} */ getGroupPreferences(): GroupPreferences; /** * @param {GroupPreferences} groupPreferences * Set the Group preferences. */ setGroupPreferences(groupPreferences: GroupPreferences): void; /** * Returns whether to use privacy template or not. * @returns {boolean} */ getUsePrivacyTemplate(): boolean; /** * @param {boolean} usePrivacyTemplate * Set whether to use privacy template or not. */ setUsePrivacyTemplate(usePrivacyTemplate: boolean): void; /** * @param {Object} jsonData * Convert JSON object to NotificationPreferences. */ static fromJSON(jsonData: Object): NotificationPreferences; } export class UnmutedConversation { /** * Get the id of unmuted conversation * @returns {string} */ getId(): string; /** * Set the id of unmuted conversation * @param {string} id */ setId(id: string): void; /** * Get the conversation type of unmuted conversation. * @returns {ConversationsType} */ getType(): ConversationsType; /** * Set the conversation type of unmuted conversation. * @param {ConversationsType} type */ setType(type: ConversationsType): void; } } export namespace CometChat { let AIAssistantBaseEvent: typeof AIAssistantBaseEvent; let AIAssistantRunStartedEvent: typeof AIAssistantRunStartedEvent; let AIAssistantRunFinishedEvent: typeof AIAssistantRunFinishedEvent; let AIAssistantMessageStartedEvent: typeof AIAssistantMessageStartedEvent; let AIAssistantMessageEndedEvent: typeof AIAssistantMessageEndedEvent; let AIAssistantContentReceivedEvent: typeof AIAssistantContentReceivedEvent; let AIAssistantToolStartedEvent: typeof AIAssistantToolStartedEvent; let AIAssistantToolEndedEvent: typeof AIAssistantToolEndedEvent; let AIAssistantToolArgumentEvent: typeof AIAssistantToolArgumentEvent; let AIAssistantToolResultEvent: typeof AIAssistantToolResultEvent; let AI_ASSISTANT_EVENTS: { RUN_STARTED: string; RUN_FINISHED: string; TEXT_MESSAGE_START: string; TEXT_MESSAGE_END: string; TEXT_MESSAGE_CONTENT: string; TOOL_CALL_STARTED: string; TOOL_CALL_ENDED: string; TOOL_CALL_RESULT: string; TOOL_CALL_ARGUMENT: string; }; let AIAssistantMessage: typeof AIAssistantMessage; let AIToolCall: typeof AIToolCall; let AIToolCallFunction: typeof AIToolCallFunction; let AIAssistantMessageData: typeof AIAssistantMessageData; let AIToolResultMessage: typeof AIToolResultMessage; let AIToolResultMessageData: typeof AIToolResultMessageData; let AIToolArgumentMessage: typeof AIToolArgumentMessage; let AIToolArgumentMessageData: typeof AIToolArgumentMessageData; let AIAssistantListener: typeof AIAssistantListener; let USER_STATUS: { ONLINE: string; OFFLINE: string; }; let MESSAGE_TYPE: { TEXT: string; MEDIA: string; IMAGE: string; VIDEO: string; AUDIO: string; FILE: string; CUSTOM: string; ASSISTANT: string; TOOL_RESULT: string; TOOL_ARGUMENTS: string; }; let CATEGORY_MESSAGE: string; let CATEGORY_ACTION: string; let CATEGORY_CALL: string; let CATEGORY_CUSTOM: string; let CATEGORY_INTERACTIVE: string; let CATEGORY_AGENTIC: string; let ACTION_TYPE: { MEMBER_ADDED: string; MEMBER_JOINED: string; MEMBER_LEFT: string; MEMBER_KICKED: string; MEMBER_BANNED: string; MEMBER_UNBANNED: string; MEMBER_INVITED: string; MEMBER_SCOPE_CHANGED: string; MESSAGE_EDITED: string; MESSSAGE_DELETED: string; TYPE_USER: string; TYPE_GROUP: string; TYPE_GROUP_MEMBER: string; }; let CALL_MODE: { DEFAULT: string, SPOTLIGHT: string, SINGLE: string, }; let AUDIO_MODE: { SPEAKER: string, EARPIECE: string, BLUETOOTH: string, HEADPHONES: string }; let CALL_TYPE: { AUDIO: string; VIDEO: string; }; let RECEIVER_TYPE: { USER: string; GROUP: string; }; let CALL_STATUS: { INITIATED: string; ONGOING: string; UNANSWERED: string; REJECTED: string; BUSY: string; CANCELLED: string; ENDED: string; }; let SORT_BY: { NAME: string; STATUS: string; } let SORT_ORDER: { ASCENDING: string; DESCENDING: string; } let appSettings: AppSettings; /** * Getter for appId. * @internal * @returns * @memberof CometChat */ export function getAppId(): string; /** * Getter for apiKey. * @internal * @returns * @memberof CometChat */ export function getApiKey(): string; /**------------------------------------* * Core apis * *-------------------------------------**/ /** * Initialize the CometChat app with appId & Object of AppSettings Class. * @param {string} appId * @param {AppSettings} appSettings * @returns {CometChat} * @memberof CometChat */ export function init(appId: any, appSettings: AppSettings): Promise<boolean>; /** * Function to check whether CometChat class initialized before. * @returns {boolean} * @memberof CometChat */ export function isInitialized(): boolean; /** * Function to register the FCM token for Push Notification. * @param {string} token * @param {JSON Object} Settings * @returns {Promise<string>} * @memberof CometChat */ export function registerTokenForPushNotification(token: string, settings?: {}): Promise<string>; /** * Login funtion will authenticate user provided as an argument. There are two ways to login: * 1. using UID and authKey (unsecure way) * 2. using authToken (secure way) * @param {...string[]} args * @returns {User | CometChatException} * @memberof CometChat */ export function login(...args: any): Promise<User>; /**-------------------------------------------------------------------* * Message related functions provided by CometChat class * *--------------------------------------------------------------------**/ /** * Function to send message. * @param {TextMessage | MediaMessage | CustomMessage | InteractiveMessage |any} message * @returns {Message | any} * @memberof CometChat */ export function sendMessage(message: TextMessage | MediaMessage | CustomMessage | InteractiveMessage |any): Promise<TextMessage | MediaMessage | CustomMessage | InteractiveMessage | BaseMessage>; /** * Function to send a message to user. * @internal * @param {*} message Object * @returns * @memberof CometChat */ export function sendDirectMessage(message: Object): Promise<TextMessage | BaseMessage | MediaMessage | CustomMessage>; /** * Function to send a message to group. * @internal * @param {*} message * @returns * @memberof CometChat */ export function sendGroupMessage(message: any): Promise<TextMessage | BaseMessage | MediaMessage | CustomMessage>; /** * Function to send a media message. * @param {MediaMessage} message * @returns {Message | any} * @memberof CometChat */ export function sendMediaMessage(message: Object): Promise<TextMessage | BaseMessage | MediaMessage | CustomMessage>; /** * Function to send a custom message. * @param {CustomMessage} message * @returns {Message | any} * @memberof CometChat */ export function sendCustomMessage(message: CustomMessage): Promise<TextMessage | BaseMessage | MediaMessage | CustomMessage>; /** * * Function to send a interactive message. * @param {InteractiveMessage} message * @returns {Message | any} * @memberof CometChat */ export function sendInteractiveMessage(message: InteractiveMessage): Promise<TextMessage | BaseMessage | MediaMessage | CustomMessage>; /** * Function to get the last delivered message id from local storage. * @returns {any} * @memberof CometChat */ export function getLastDeliveredMessageId(): Promise<any>; /** * Function to send start typing notification to the provided uid/ guid. * @param {TypingIndicator | any} typingNotification * @memberof CometChat */ export function startTyping(typingNotification: TypingIndicator | any): void; /** * Function to send stop typing notification to the provided uid/ guid. * @param {TypingIndicator | any} typingNotification * @memberof CometChat */ export function endTyping(typingNotification: TypingIndicator | any): void; /** * Mark all messages upto a specified message id as read. There are two ways markAsRead works: * 1. message * 2. messageID, receiverID, receiverType, senderID * @param {...string[]} args * @memberof CometChat */ export function markAsRead(...args: any): any; /** * Mark all messages upto a specified message id as delivered. There are two ways markAsDelivered works: * 1. message * 2. messageID, receiverID, receiverType, senderID * @param {...string[]} args * @memberof CometChat */ export function markAsDelivered(...args: any): any; /** * Mark entire conversation as read for a user or group. * @param {string} conversationWith - User ID or Group ID * @param {string} conversationType - Conversation type (user or group) * @returns {Promise<string>} * @memberof CometChat */ export function markConversationAsRead(conversationWith: string, conversationType: string): Promise<string>; /** * Mark entire conversation as delivered for a user or group. * @param {string} conversationWith - User ID or Group ID * @param {string} conversationType - Receiver type (user or group) * @returns {Promise<string>} * @memberof CometChat */ export function markConversationAsDelivered(conversationWith: string, conversationType: string): Promise<string>; /** * @deprecated Please use markMessageAsUnread() instead. * Mark all the messages after the specified message id as unread. * @param {TextMessage | MediaMessage | CustomMessage | BaseMessage | any} message * @returns {Promise<string>} * @memberof CometChat **/ export function markAsUnread(message: TextMessage | MediaMessage | CustomMessage | any): Promise<string | CometChatException>; /** * Mark all the messages after the specified message id as unread. * @param {TextMessage | MediaMessage | CustomMessage | BaseMessage | any} message * @returns {Promise<string>} * @memberof CometChat */ export function markMessageAsUnread(message: TextMessage | MediaMessage | CustomMessage | any): Promise<Conversation>; /** * Send a transient message. * @param {string} uid * @param {string} receiverType * @memberof CometChat */ export function sendTransientMessage(transientMessage: TransientMessage): void; /** * Function to fetch message details for the provided messageID. * @param {string | any} messageId * @returns {Message | any} * @memberof CometChat */ export function getMessageDetails(messageId: string | any): Promise<TextMessage | MediaMessage | CustomMessage | InteractiveMessage |BaseMessage>; /** * Function to fetch message receipt details for the provided messageID. * @param {string | any} messageId * @returns {MessageReceipt[]} * @memberof CometChat */ export function getMessageReceipts(messageId: string | any): Promise<MessageReceipt[]>; /** * Function to fetch unread message count. * @param {boolean} doHideMessages * @returns {Object} * @memberof CometChat */ export function getUnreadMessageCount(doHideMessages?: boolean): Promise<Object>; /** * Function to fetch unread message count for all users. * @param {boolean} doHideMessages * @returns {Object} * @memberof CometChat */ export function getUnreadMessageCountForAllUsers(doHideMessages?: boolean): Promise<Object>; /** * Function to fetch unread message count for all groups. * @param {boolean} doHideMessages * @returns {Object} * @memberof CometChat */ export function getUnreadMessageCountForAllGroups(doHideMessages?: boolean): Promise<Object>; /** * Function to fetch unread message count for a particular UID. * @param {string} UID * @param {boolean} doHideMessages * @returns {Object}