import BaseClientWithStore, { BaseClientWithStoreOptions } from './base-with-store'; import ApplozicSocket from './socket'; import LoginResult from './models/LoginResult'; import { SocketEventListener } from './socket/socket-events'; export interface ApplozicClientOptions extends BaseClientWithStoreOptions { useSocket?: boolean; events?: SocketEventListener; } /** * This is the main class for interacting with the Applozic API. * This class incorporates the [BaseClientWithStore](./base-with-store.ts) class * * Sample usage: * * ```TypeScript * import ApplozicClient from '@applozic/core-sdk'; * * const applozicClient = new ApplozicClient('YOUR-APPLOZIC-APP-ID', { * events: { * onMessageReceived: ({ message }) => { * console.log('onMessageReceived', { message }); * }, * onMessageDelivered: (contactId, messageKey) => { * console.log('onMessageDelivered', { message }); * }, * onMessageRead: (contactId, messageKey) => { * console.log('onMessageRead', { contactId, messageKey }); * }, * onMessageSent: ({ message }) => { * console.log('onMessageSent', { message }); * }, * onMessageDeleted: (contactId, messageKey) => { * console.log('onMessageDeleted', { contactId, messageKey }); * }, * onConversationRead: userId => { * console.log('onConversationRead', { userId }); * }, * onConversationDeleted: contactId => { * console.log('onConversationDeleted', { contactId }); * }, * onUserActivated: message => { * console.log('onUserActivated', { onUserActivated: message }); * }, * onUserConnect: message => { * console.log('onUserConnect', { userConnected: message }); * }, * onUserOnlineStatus: (userId, isOnline, timestamp) => { * console.log('onUserOnlineStatus', { userId, isOnline, timestamp}); * }, * onTypingStatus: (userId, status) => { * console.log('onTypingStatus', { userId, status}); * } * } * }); * ``` * * ## HTML * * ```html * *
* *My first paragraph.
* * * ``` * * ## Available APIs * * - {@link ContactsApi} * - {@link FilesApi} * - {@link GroupsApi} * - {@link MessagesApi} * - sendTypingStatus - {@link ApplozicClient.sendTypingStatus} */ export default class ApplozicClient extends BaseClientWithStore { /** Internal Applozic Socket manager */ applozicSocket: ApplozicSocket | undefined; /** Event handlers like on message sent etc */ private events; /** Use sockets or not, default is true */ private useSocket; /** * Create a new ApplozicClient instance * @param applicationId Applozic application id * @param options Client options */ constructor(applicationId: string, options?: ApplozicClientOptions); postLogin(loginRes: LoginResult): Promise