UNPKG

@cometchat-pro/react-native-chat

Version:
1,533 lines (1,435 loc) 145 kB
import * as React from 'react'; export namespace CometChat { let USER_STATUS: { ONLINE: string; OFFLINE: string; }; let MESSAGE_TYPE: { TEXT: string; MEDIA: string; IMAGE: string; VIDEO: string; AUDIO: string; FILE: string; CUSTOM: string; }; let CATEGORY_MESSAGE: string; let CATEGORY_ACTION: string; let CATEGORY_CALL: string; let CATEGORY_CUSTOM: 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 | any} message * @returns {Message | any} * @memberof CometChat */ export function sendMessage(message: TextMessage | MediaMessage | CustomMessage | any): Promise<TextMessage | MediaMessage | CustomMessage | 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 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; /** * 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 | 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<Object>; /** * 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} * @memberof CometChat */ export function getUnreadMessageCountForUser(UID: string, doHideMessages?: boolean): Promise<Object>; /** * Function to fetch unread message count for a particular GUID. * @param {string} GUID * @param {boolean} doHideMessages * @returns {Object} * @memberof CometChat */ export function getUnreadMessageCountForGroup(GUID: string, doHideMessages?: boolean): Promise<Object>; /** * Funtion to edit a message. * @param {BaseMessage} message * @returns {Promise<BaseMessage>} * @memberof CometChat */ export function editMessage(message: BaseMessage): Promise<BaseMessage>; /** * Funtion to delete a message. * @param {string} messageId * @returns {Promise<BaseMessage>} * @memberof CometChat */ export function deleteMessage(messageId: string): Promise<BaseMessage>; /**---------------------------------------------------------------------------------------* * Online User/Group Member count related functions provided by CometChat class * *----------------------------------------------------------------------------------------**/ /** * This function will return online user count. * @returns {Promise<number>} * @memberof CometChat */ export function getOnlineUserCount(): Promise<number>; /** * This function will return online group members count for given GUIDs. * @param {String[]} groups * @returns {Promise<number>} * @memberof CometChat */ export function getOnlineGroupMemberCount(groups: String[]): Promise<Object>; /**-------------------------------------------------------------------* * User related functions provided by CometChat class * *--------------------------------------------------------------------**/ /** * Function to create a user. * @param {User | any} user * @param {string} apiKey * @returns {Promise<User>} * @memberof CometChat */ export function createUser(user: User | any, apiKey: string): Promise<User>; /** * * Function to update the already existing user and returns the result with updated user. * @param {User | any} user * @param {string} apiKey * @returns {Promise<User>} * @memberof CometChat */ export function updateUser(user: User | any, apiKey: string): Promise<User>; /** * * Function to update the logged-in user and returns the result with updated user * @param {User} user * @returns Promise<User> * @memberof CometChat */ export function updateCurrentUserDetails(user: User | any): Promise<User>; /** * Function to get the information for the uid provided as an argument * @param {string} uid * @returns {Promise<User>} * @memberof CometChat */ export function getUser(uid: any): Promise<User>; /** * * This function will return logged in user from local storage. * @returns {Promise<User | null>} * @memberof CometChat */ export function getLoggedinUser(): Promise<User | null>; /** * Function to block users. * @param {String[]} blockedUids * @returns * @memberof CometChat */ export function blockUsers(blockedUids: String[]): Promise<Object>; /** * Function to unblock users. * @param {String[]} blockedUids * @returns * @memberof CometChat */ export function unblockUsers(blockedUids: String[]): Promise<Object>; /**-------------------------------------------------------------------* * Conversation related functions provided by CometChat class * *--------------------------------------------------------------------**/ /** * Function to fetch conversation for a specific user/group. * @param {string} conversationWith * @param {string} conversationType * @returns {Promise<Conversation>} * @memberof CometChat */ export function getConversation(conversationWith: string, conversationType: string): Promise<Conversation>; /** * Function to tag a conversation for a specific user/group. * @param {string} conversationWith * @param {string} conversationType * @param {Array<String>} tags * @returns {Promise<Conversation>} * @memberof CometChat */ export function tagConversation(conversationWith: string, conversationType: string, tags: Array<String>): Promise<Conversation>; /** * function to delete conversation for a specific user/group. * @param {string} conversationWith * @param {string} conversationType * @returns Promise<string> * @memberof CometChat */ export function deleteConversation(conversationWith: string, conversationType: string): Promise<string>; /**-------------------------------------------------------------------* * Group related functions provided by CometChat class * *--------------------------------------------------------------------**/ /** * Function to create a group. * @param {Group} group * @returns {Promise<Group>} * @memberof CometChat */ export function createGroup(group: Group | any): Promise<Group>; /** * Function to fetch details of a group. * @param {string | Object} guid * @returns {Promise<Group>} * @memberof CometChat */ export function getGroup(guid: string | Object): Promise<Group>; /** * Function to join a public group. * @param {guid} guid * @param {GroupType} type * @param {string} password * @returns {Promise<Group>} * @memberof CometChat */ export function joinGroup(grp: any, type?: GroupType, password?: string): Promise<Group>; /** * Function to update a group. * @param {Group} group * @returns {Promise<Group>} * @memberof CometChat */ export function updateGroup(group: any): Promise<Group>; /** * Function to delete a group. * @param {string} guid * @returns {Promise<boolean>} * @memberof CometChat */ export function deleteGroup(guid: string): Promise<boolean>; /** * Function to leave a group. * @param {string} guid * @returns {Promise} * @memberof CometChat */ export function leaveGroup(guid: string): Promise<boolean>; /** * Function to kick a member from a group. * @param {string} guid * @param {string} uid * @returns {Promise<boolean>} * @memberof CometChat */ export function kickGroupMember(guid: string, uid: string): Promise<boolean>; /** * Function to change the scope of a member in a group. * @param {string} guid * @param {string} uid * @param {GroupMemberScope} scope * @returns {Promise<boolean>} * @memberof CometChat */ export function updateGroupMemberScope(guid: string, uid: string, scope: GroupMemberScope): Promise<boolean>; /** * Function to ban a group member from a group. * @param {string} guid * @param {string} uid * @returns {Promise<boolean>} * @memberof CometChat */ export function banGroupMember(guid: string, uid: string): Promise<boolean>; /** * Function to unban a group member from a group. * @param {string} guid * @param {string} uid * @returns {Promise<boolean>} * @memberof CometChat */ export function unbanGroupMember(guid: string, uid: string): Promise<boolean>; /** * Function to add members in a group. This function can also be used to ban a group member from a group. * @param {string} guid * @param {Array<GroupMember>} groupMembers * @param {Array<String>} bannedMembersList * @returns {Promise<Object>} * @memberof CometChat */ export function addMembersToGroup(guid: string, groupMembers: Array<GroupMember>, bannedMembersList: Array<string>): Promise<Object>; /** * * Function to transfer ownership of a group. * @param {string} guid * @param {string} uid * @returns {Promise<string>} * @memberof CometChat */ export function transferGroupOwnership(guid: string, uid: string): Promise<string>; /** * Function to create a group and add/ban members in/from that group. * @param {Group} group * @param {Array<GroupMember>} members * @param {Array<String>} banMembers * @returns {Promise<Object>} * @memberof CometChat */ export function createGroupWithMembers(group: Group, members: Array<GroupMember>, banMembers: Array<string>): Promise<Object>; /**-------------------------------------------------------------------* * Call related functions provided by CometChat class * *--------------------------------------------------------------------**/ /** * Function to initiate a user/group call. * @param {Call} call * @returns {Promise<Call>} * @memberof CometChat */ export function initiateCall(call: Call | any): Promise<Call>; /** * Function to accept an incoming user/group call. * @param {string} sessionid * @returns {Promise<Call>} * @memberof CometChat */ export function acceptCall(sessionid: string): Promise<Call>; /** * Function to reject an incoming call or cancel an outgoing call. * @param {string} sessionId * @param {string} status * @returns {Promise<Call>} * @memberof CometChat */ export function rejectCall(sessionId: string, status: any): Promise<Call>; /** * Function to end an ongoing call. * @param {string} sessionid * @param {boolean} isInternal - Optional * @returns {Promise<Call>} * @memberof CometChat */ export function endCall(sessionid: string, isInternal?: boolean): Promise<Call>; /** * Function to get the active call. * @returns {Call} * @memberof CometChat */ export function getActiveCall(): Call; /** * Function to start a call. * @param {CallSettings} callSettings * @memberof CometChat */ export function startCall(callSettings: CallSettings): void; /** * Function to fetch participant count of an ongoing call. * @param {string} sessionId * @param {string} type * @returns {Promise<number>} * @memberof CometChat */ export function getCallParticipantCount(sessionId: string, type: string): Promise<number>; /**-------------------------------------------------------------------------------------------------------* * Events listeners setting and removing . * *--------------------------------------------------------------------------------------------------------**/ /** * Function to add a Connection Listner. * @param {string} name * @param {ConnectionListener} connectionListener * @memberof CometChat */ export function addConnectionListener(name: string, connectionListener: ConnectionListener): void; /** * Function to remove a Connection Listner. * @param {string} name * @memberof CometChat */ export function removeConnectionListener(name: string): void; /** * Function to add a Message Listner. * @param {string} name * @param {MessageListener} messageListener * @memberof CometChat */ export function addMessageListener(name: string, messageListener: MessageListener): void; /** * Function to remove a Message Listner. * @param {string} name * @memberof CometChat */ export function removeMessageListener(name: string): void; /** * * Function to add a Call Listener. * @param {string} name * @param {CallListener} callListener * @memberof CometChat */ export function addCallListener(name: string, callListener: CallListener): void; /** * Function to remove a Call Listener. * @param {string} name * @memberof CometChat */ export function removeCallListener(name: string): void; /** * Function to add a User Listener. * @param {string} name * @param {UserListener} userListener * @memberof CometChat */ export function addUserListener(name: string, userListener: UserListener): void; /** * Function to remove a User Listener. * @param {string} name * @memberof CometChat */ export function removeUserListener(name: string): void; /** * Function to add a Group Listener. * @param {string} name * @param {GroupListener} groupListener * @memberof CometChat */ export function addGroupListener(name: string, groupListener: GroupListener): void; /** * * Function to remove a Group Listener. * @param {string} name * @memberof CometChat */ export function removeGroupListener(name: string): void; /** * Function to add a Login Listener. * * @param {string} name * @param {LoginListener} loginListener * @memberof CometChat */ export function addLoginListener(name: string, loginListener: LoginListener): void; /** * Function to remove a Login Listener. * * @param {string} name * @memberof CometChat */ export function removeLoginListener(name: string): void; /** * Get the current connection status * @returns {string} * @memberof CometChat */ export function getConnectionStatus(): string; /** * Returns a boolean value which indicates if the extension is enabled or not. * @param {string} extensionId * @returns {Promise<boolean>} * @memberof CometChat */ export function isExtensionEnabled(extensionId: string): Promise<boolean>; /** * Returns an object of CCExtension Class which has the details of the extension. * * @param {string} extensionId * @returns {Promise<CCExtension>} * @memberof CometChat */ export function getExtensionDetails(extensionId: string): Promise<CCExtension>; /** * Get the XMPP/ WEBRTC details from the servers * @internal * @returns {Promise<Object>} * @memberof CometChat */ export function getAppSettings(): Promise<Object>; /** * Returns a boolean value which indicates if a feature is enabled or not for the current plan. * @param {string} feature * @returns {Promise<boolean>} * @memberof CometChat */ export function isFeatureEnabled(feature: string): Promise<boolean>; /** * Clears the authtoken from server and clears the local cache. * @returns {Promise<Object>} * @memberof CometChat */ export function logout(): Promise<Object>; /** * Function to call extension API. * @param {string} slug * @param {string} method * @param {string} endpoint * @param {Object} data * @returns {Promise<Object>} * @memberof CometChat */ export function callExtension(slug: string, method: string, endpoint: string, data?: Object): Promise<Object>; /** * Function to set resource, platform and language variable. * @param {string} resource * @param {string} platform * @param {string} language * @memberof CometChat */ export function setSource(resource: string, platform: string, language: string): void; /** * * Method to connect to WebSocket server. * * @static * @returns void * @memberof CometChat */ export function connect(): void; /** * * Method to disconnect from WebSocket server. * * @static * @returns void * @memberof CometChat */ export function disconnect(): void; /** * * @module CometChatException * @implements {ErrorModel} */ export class CometChatException implements ErrorModel { code?: string | number; name?: string; message?: string; details?: string; constructor(errorModel: ErrorModel); } /** @private */ export interface UserObj { uid: string; name: string; authToken: string; avatar: string; lastActiveAt: number; link: string; metadata: string; role: string; status: string; statusMessage: string; tags: Array<string>; } /** * Implementation of UserObject */ export class User { /** * Method to get UID of the user. * @returns {string} */ getUid(): string; /** * Method to set UID of the user. * @param {string} uid */ setUid(uid: string): void; /** * Method to get name of the user. * @returns {string} */ getName(): string; /** * Method to set name of the user. * @param {string} name */ setName(name: string): void; /** * Method to get authToken of the user. * @returns {string} */ getAuthToken(): string; /** * Method to set authToken of the user. * @param {string} authToken */ setAuthToken(authToken: string): void; /** * Method to get avatar of the user. * @returns {string} */ getAvatar(): string; /** * Method to set avatar of the user. * @param {string} avatar */ setAvatar(avatar: string): void; /** * Method to get last active at timestamp of the user. * @returns {number} */ getLastActiveAt(): number; /** * Method to set last active at timestamp of the user. * @param {number} lastActiveAt */ setLastActiveAt(lastActiveAt: number): void; /** * Method to get link of the user. * @returns {string} */ getLink(): string; /** * Method to set link of the user. * @param {string} link */ setLink(link: string): string; /** * Method to get metadata of the user. * @returns {string} */ getMetadata(): string; /** * Method to set metadata of the user. * @param {string} metadata */ setMetadata(metadata: string): void; /** * Method to get role of the user. * @returns {string} */ getRole(): string; /** * Method to set role of the user. * @param {string} role */ setRole(role: string): void; /** * Method to get status of the user. * @returns {string} */ getStatus(): string; /** * Method to set status of the user. * @param {string} status */ setStatus(status: string): void; /** * Method to get status message of the user. * @returns {string} */ getStatusMessage(): string; /** * Method to set status message of the user. * @param {string} statusMessage */ setStatusMessage(statusMessage: string): void; setBlockedByMe(blockedByMe: boolean): void; /** * Method to know if the logged-in user has blocked the other user. * @returns {boolean} */ getBlockedByMe(): boolean; setHasBlockedMe(hasBlockedMe: boolean): void; /** * Method to know if the logged-in user has been blocked by the other user. * @returns {boolean} */ getHasBlockedMe(): boolean; /** * Method to set tags of the user. * @param {string[]} tags */ setTags(tags: Array<string>): void; /** * Method to get tags of the user. * @returns {string[]} */ getTags(): Array<string>; /** * Method to set deactivatedAt timestamp of a user. * @param {number} deactivatedAt */ setDeactivatedAt(deactivatedAt: number): void; /** * Method to get deactivatedAt timestamp of a user. * @returns {number} */ getDeactivatedAt(): number; constructor(...userObj: any[]); } /** * * @module MediaMessage */ export class MediaMessage extends BaseMessage implements Message { /** @private */ static readonly TYPE: { TEXT: string; MEDIA: string; IMAGE: string; VIDEO: string; AUDIO: string; FILE: string; CUSTOM: string; }; /** @private */ static readonly RECEIVER_TYPE: { USER: string; GROUP: string; }; /** @private */ static readonly CATEGORY: { MESSAGE: string; ACTION: string; CALL: string; CUSTOM: string; }; private url; private file; private files; private _metaData; protected data?: any; private attachment; private caption; private tags?: Array<String>; constructor(receiverId: string, file: object | string | Array<object> | any, type: string, receiverType: string); /** * Method to set caption for the media message. * @param {string} text */ setCaption(text: string): void; /** * Method to get caption of the media message. * @returns {string} */ getCaption(): 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 metadata of the message. * @returns {Object} */ getMetadata(): Object; /** * Method to set metadata of the message. * @param {Object} metadata */ setMetadata(metadata: Object): void; /** * Method to get data of the message. * @returns {Object} */ getData(): Object; /** * Method to set data of the message. * @param {Object} value */ setData(value: Object): void; /** * Method to get attachment of media message. * @returns {Attachment} */ getAttachment(): Attachment; /** * Method to set attachment of media message. * @param {Attachment} attachment */ setAttachment(attachment: Attachment): void; /** * Method to get all the attachments of media message. * @returns {Array<Attachment>} */ getAttachments(): Array<Attachment>; /** * Method to set multiple attachments of media message. * @param {Array<Attachment>} attachments */ setAttachments(attachments: Array<Attachment>): void; /** * Method to get URL of the media file. * @returns {string} */ getURL(): string; /** * 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 BaseMessage */ export interface Message { } /** *Basic Message Object * * @export * @class BaseMessage */ export class BaseMessage implements Message { protected id?: number; protected conversationId?: string; protected parentMessageId?: number; protected muid?: string; protected sender?: User; protected receiverId?: string; protected receiver?: User | Group; protected type?: string; protected category?: MessageCategory; protected receiverType?: string; protected sentAt?: number; protected deliveredAt?: number; protected readAt?: number; protected deliveredToMeAt?: number; protected readByMeAt?: number; protected metadata: Object; protected status?: string; protected receipts?: any[]; protected readReceipts?: MessageReceipt[]; protected deliveryReceipts?: MessageReceipt[]; protected editedAt: number; protected editedBy: string; protected deletedAt: number; protected deletedBy: string; protected replyCount: number; protected rawMessage: Object; constructor(receiverId: string, messageType: string, receiverType: string, category: MessageCategory); /** * Get ID of the message * @returns {number} */ getId(): number; /** * @param {number} value * Set ID of the message */ setId(value: number): void; /** * Get conversation ID of the message. * @returns {string} */ getConversationId(): string; /** * @param {string} value * Set conversation ID of the message. */ setConversationId(value: string): void; /** * Get parent message ID of the message. * @returns {number} */ getParentMessageId(): number; /** * @param {number} value * Set parent message ID of the message. */ setParentMessageId(value: number): void; /** * Get MUID of the message. * @returns {string} */ getMuid(): string; /** * @param {string} value * Sets the MUID of the message. */ setMuid(value: string): void; /** * Get sender of the message. * @returns {User} */ getSender(): User; /** * @param {User} value * Set sender of the message. */ setSender(value: User): void; /** * Get receiver of the message. * @returns {User | Group} */ getReceiver(): User | Group; /** * @param {User | Group} value * Set receiver of the message. */ setReceiver(value: User | Group): void; /** * Get receiverID of the message. * @returns {string} */ getReceiverId(): string; /** * @param {string} value * Set receiverId of the message. */ setReceiverId(value: string): void; /** * Get type of the message. * @returns {string} */ getType(): string; /** * @param {string} value * Set type of the message. */ setType(value: string): void; /** * Get receiver type of the message. * @returns {string} */ getReceiverType(): string; /** * @param {string} value * Set the receiver type of the message. */ setReceiverType(value: string): void; /** * Get message's sentAt timestamp. * @returns {number} */ getSentAt(): number; /** * @param {number} value * Set message's sentAt timestamp. */ setSentAt(value: number): void; /** @private */ getStatus(): string; /** @private */ setStatus(value: string): void; /** * Get delivery timestamp of the message. * @returns {number} */ getDeliveredAt(): number; /** * @param {number} deliveredAt * Set delivery timestamp of the message. */ setDeliveredAt(deliveredAt: number): void; /** * Get timestamp of the message at which it was delivered to logged in user. * @returns {number} */ getDeliveredToMeAt(): number; /** * @param {number} deliveredToMeAt * Set timestamp of the message at which it was delivered to logged in user. */ setDeliveredToMeAt(deliveredToMeAt: number): void; /** * Get read timestamp of the message. * @returns {number} */ getReadAt(): number; /** * @param {number} readAt * Set read timestamp of the message. */ setReadAt(readAt: number): void; /** * Get timestamp of the message at which it was read by the logged in user. * @returns {number} */ getReadByMeAt(): number; /** * @param {number} readByMeAt * Set timestamp of the message at which it was read by the logged in user. */ setReadByMeAt(readByMeAt: number): void; /** * Get category of the message. * @returns {string} */ getCategory(): MessageCategory; /** * @param {string} category * Set category of the message. */ setCategory(category: MessageCategory): void; /** * Get timestamp of the message when it was updated/edited. * @returns {number} */ getEditedAt(): number; /** * @param {number} editedAt * Set timestamp of the message when it was updated/edited. */ setEditedAt(editedAt: number): void; /** * Get UID of the user who edited/updated the message. * @returns {string} */ getEditedBy(): string; /** * @param {string} editedBy * Set UID of the user who edited/updated the message. */ setEditedBy(editedBy: string): void; /** * Get timestamp of the message when it was deleted. * @returns {number} */ getDeletedAt(): number; /** * @param {number} deletedAt * Set timestamp of the message when it was deleted. */ setDeletedAt(deletedAt: number): void; /** * Get UID of the user who deleted the message. * @returns {number} */ getDeletedBy(): string; /** * @param {string} deletedBy * Set UID of the user who deleted the message. */ setDeletedBy(deletedBy: string): void; /** * Get the number of replies of the message. * @returns {number} */ getReplyCount(): number; /** * @param {number} value * Set the number of replies of the message. */ setReplyCount(value: number): void; /** * Get the raw JSON of the message. * @returns */ getRawMessage(): Object; /** * @param {Object} rawMessage * Set the raw JSON of the message. */ setRawMessage(rawMessage: Object): void; } /** * * @module TextMessage */ export class TextMessage extends BaseMessage implements Message { /** @private */ static readonly TYPE: string; /** @private */ static readonly RECEIVER_TYPE: { USER: string; GROUP: string; }; /** @private */ static readonly CATEGORY: string; private text?; private data?; private processedText?; private tags?; /** *Creates an instance of TextMessage. * @param {string} receiverUid * @param {string} text * @param {string} senderUid * @param {string} receiverType * @memberof TextMessage */ constructor(receiverId: string, text: 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 metadata of the message. * @returns {Object} */ getMetadata(): Object; /** * Method to set metadata of the message. * @param {Object} value */ setMetadata(value: Object): void; /** * Method to get data of the message. * @returns {Object} */ getData(): any; /** * Method to set data of the message. * @param {Object} value */ setData(value: string): void; /** * Method to get text of the message. * @returns {string} */ getText(): string; /** * Method to set text of the message. * @param {string} text */ setText(text: string): void; /** @internal */ setProcessedText(text: string): void; /** @internal */ getProcessedText(): string; /** * 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 const constants: { DEFAULT_STORE: string; MSG_VER_PRE: string; MSG_VER_POST: string; }; export const DEFAULT_VALUES: { ZERO: number; MSGS_LIMIT: number; MSGS_MAX_LIMIT: number; USERS_LIMIT: number; USERS_MAX_LIMIT: number; GROUPS_LIMIT: number; GROUPS_MAX_LIMIT: number; CONVERSATION_MAX_LIMIT: number; CALL_TIMEOUT: number; DEFAULT_MSG_ID: number; DEFAULT_MAX_TYPING_INDICATOR_LIMIT: number; REGION_DEFAULT: string; REGION_DEFAULT_EU: string; REGION_DEFAULT_US: string; REGION_DEFAULT_IN: string; REGION_DEFAULT_PRIVATE: string; }; export enum GroupType { Public = "public", Private = "private", Protected = "protected", Password = "password" } export const GROUP_TYPE: { PUBLIC: string; PRIVATE: string; PROTECTED: string; PASSWORD: string; }; export enum GroupMemberScope { Admin = "admin", Moderator = "moderator", Member = "member" } export const GROUP_MEMBER_SCOPE: { ADMIN: string; MODERATOR: string; PARTICIPANT: string; }; export const APPINFO: { platform: string; sdkVersion: string; apiVersion: string; sdkVersionWithUnderScore: string; userAgent: string; }; export const SDKHeader: { platform: string; sdkVersion: string; sdk: string; }; export const WS: { CONVERSATION: { TYPE: { CHAT: string; GROUP_CHAT: string; }; }; }; export const ANALYTICS: { analyticsHost: string; analyticsVersion: string; }; export const LOCAL_STORE: { COMMON_STORE: string; MESSAGE_LISTENERS_LIST: string; USERS_STORE: string; MESSAGES_STORE: string; KEYS_STORE: string; STORE_STRING: string; KEY_STRING: string; KEY_USER: string; KEY_APP_SETTINGS: string; KEY_APP_ID: string; KEY_DEVICE_ID: string; KEY_MESSAGE_LISTENER_LIST: string; }; export const ResponseConstants: { RESPONSE_KEYS: { KEY_DATA: string; KEY_META: string; KEY_CURSOR: string; KEY_ACTION: string; KEY_MESSAGE: string; KEY_ERROR: string; KEY_ERROR_DETAILS: string; KEY_ERROR_CODE: string; KEY_ERROR_MESSAGE: string; KEY_AUTH_TOKEN: string; KEY_WS_CHANNEL: string; KEY_IDENTITY: string; KEY_SERVICE: string; KEY_ENTITIES: string; KEY_ENTITITY: string; KEY_ENTITYTYPE: string; KEY_ATTACHMENTS: string; CODE_REQUEST_OK: number; CODE_BAD_REQUEST: number; UNREAD_UNDELIVERED_KEYS: { ENTITY: string; ENTITY_TYPE: string; ENTITY_Id: string; COUNT: string; }; GROUP_MEMBERS_RESPONSE: { SUCCESS: string; ERROR: string; MESSAGE: string; }; KEY_ENTITY_TYPE: { USER: string; GROUP: string; }; }; }; export const DELIVERY_RECEIPTS: { RECEIVER_ID: string; RECEIVER_TYPE: string; RECIPIENT: string; MESSAGE_ID: string; RECEIVED: string; DELIVERED_AT: string; ID: string; TIME: string; DELIVERED_TO_ME_AT: string; }; export const READ_RECEIPTS: { RECEIVER_ID: string; RECEIVER_TYPE: string; RECIPIENT: string; MESSAGE_ID: string; READ: string; READ_AT: string; ID: string; TIME: string;