UNPKG

@warriorteam/zalo-webhook-types

Version:

TypeScript types for Zalo Personal webhook events from automation-web

115 lines 3.06 kB
/** * System Event Types * * Events related to system status and operations (6 total). * Includes connection, error, and other system events. */ import { ZaloWebhookEvent } from './base'; import { ZaloConnectionStatus, ZaloThreadType, ZaloUploadStatus } from '../enums'; /** * Connection status event * Triggered when connection status changes */ export interface ZaloConnectionStatusEvent extends ZaloWebhookEvent { eventType: "connection-status"; data: { status: ZaloConnectionStatus; reason: string; timestamp: number; }; } /** * Error event * Triggered when errors occur in the system */ export interface ZaloErrorEvent extends ZaloWebhookEvent { eventType: "error"; data: { errorCode: string; errorMessage: string; errorDetails: any; timestamp: number; }; } /** * Old messages event * Triggered when loading historical messages */ export interface ZaloOldMessagesEvent extends ZaloWebhookEvent { eventType: "old-messages"; data: { threadId: string; threadType: ZaloThreadType; messageCount: number; oldestMessageId: string; newestMessageId: string; loadedAt: number; }; } /** * Old reactions event * Triggered when loading historical reactions */ export interface ZaloOldReactionsEvent extends ZaloWebhookEvent { eventType: "old-reactions"; data: { threadId: string; threadType: ZaloThreadType; reactionCount: number; messageIds: string[]; loadedAt: number; }; } /** * Upload attachment event * Triggered during file upload process */ export interface ZaloUploadAttachmentEvent extends ZaloWebhookEvent { eventType: "upload-attachment"; data: { uploadId: string; fileName: string; fileSize: number; fileType: string; uploadUrl: string; status: ZaloUploadStatus; uploadedAt: number; progress?: number; error?: string; }; } /** * Cipher key event * Triggered when encryption keys are updated */ export interface ZaloCipherKeyEvent extends ZaloWebhookEvent { eventType: "cipher-key"; data: { keyId: string; keyType: string; threadId: string; threadType: ZaloThreadType; keyUpdatedAt: number; }; } /** * Union of all system events */ export type ZaloSystemEvent = ZaloConnectionStatusEvent | ZaloErrorEvent | ZaloOldMessagesEvent | ZaloOldReactionsEvent | ZaloUploadAttachmentEvent | ZaloCipherKeyEvent; /** * Critical system events that require immediate attention */ export type ZaloCriticalSystemEvent = ZaloConnectionStatusEvent | ZaloErrorEvent; /** * Data loading system events */ export type ZaloDataLoadingEvent = ZaloOldMessagesEvent | ZaloOldReactionsEvent; /** * File operation system events */ export type ZaloFileOperationEvent = ZaloUploadAttachmentEvent; /** * Security system events */ export type ZaloSecurityEvent = ZaloCipherKeyEvent; //# sourceMappingURL=system-events.d.ts.map