UNPKG

redai-automation-web-sdk

Version:

TypeScript SDK for RedAI Automation Web API - Zalo Personal automation, messaging, advanced sticker search, and bulk operations. 100% compatible with automation-web backend. v1.8.0: Added SessionProxyService for managing proxy assignments to sessions with

79 lines 2.32 kB
"use strict"; /** * Friend Event Types * 100% khớp với zalo-personal-sdk/src/models/FriendEvent.ts */ Object.defineProperty(exports, "__esModule", { value: true }); exports.initializeFriendEvent = initializeFriendEvent; const enums_1 = require("./enums"); /** * Initialize Friend Event Function */ function initializeFriendEvent(uid, data, type) { if (type === enums_1.FriendEventType.ADD || type === enums_1.FriendEventType.REMOVE || type === enums_1.FriendEventType.BLOCK || type === enums_1.FriendEventType.UNBLOCK || type === enums_1.FriendEventType.BLOCK_CALL || type === enums_1.FriendEventType.UNBLOCK_CALL) { return { type, data: data, threadId: data, isSelf: ![enums_1.FriendEventType.ADD, enums_1.FriendEventType.REMOVE].includes(type), }; } else if (type === enums_1.FriendEventType.REJECT_REQUEST || type === enums_1.FriendEventType.UNDO_REQUEST) { const threadId = data.toUid; return { type, data: data, threadId, isSelf: data.fromUid === uid, }; } else if (type === enums_1.FriendEventType.REQUEST) { const threadId = data.toUid; return { type, data: data, threadId, isSelf: data.fromUid === uid, }; } else if (type === enums_1.FriendEventType.SEEN_FRIEND_REQUEST) { return { type, data: data, threadId: uid, isSelf: true, }; } else if (type === enums_1.FriendEventType.PIN_CREATE) { const threadId = data.conversationId; return { type, data: data, threadId, isSelf: data.actorId === uid, }; } else if (type === enums_1.FriendEventType.PIN_UNPIN) { const threadId = data.conversationId; return { type, data: data, threadId, isSelf: data.actorId === uid, }; } else { return { type: enums_1.FriendEventType.UNKNOWN, data: JSON.stringify(data), threadId: "", isSelf: false, }; } } //# sourceMappingURL=friend-event.js.map