UNPKG

@warriorteam/zalo-webhook-types

Version:

TypeScript types for Zalo Personal webhook events from automation-web

57 lines 1.93 kB
"use strict"; /** * Content Types for Zalo Messages * * Specific content interfaces for different message types. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.isAttachmentContent = isAttachmentContent; exports.isImageContent = isImageContent; exports.isVideoContent = isVideoContent; exports.isVoiceContent = isVoiceContent; exports.isFileContent = isFileContent; exports.isStickerContent = isStickerContent; exports.isLocationContent = isLocationContent; /** * Type guard to check if content is attachment */ function isAttachmentContent(content) { return typeof content === 'object' && content !== null && 'href' in content; } /** * Type guard to check if content is image */ function isImageContent(content) { return isAttachmentContent(content) && 'width' in content && 'height' in content && !('duration' in content); } /** * Type guard to check if content is video */ function isVideoContent(content) { return isAttachmentContent(content) && 'width' in content && 'height' in content && 'duration' in content; } /** * Type guard to check if content is voice */ function isVoiceContent(content) { return typeof content === 'object' && content !== null && 'href' in content && 'duration' in content && !('width' in content); } /** * Type guard to check if content is file */ function isFileContent(content) { return typeof content === 'object' && content !== null && 'href' in content && 'fileType' in content; } /** * Type guard to check if content is sticker */ function isStickerContent(content) { return typeof content === 'object' && content !== null && ('stickerId' in content || 'stickerType' in content); } /** * Type guard to check if content is location */ function isLocationContent(content) { return typeof content === 'object' && content !== null && 'latitude' in content && 'longitude' in content; } //# sourceMappingURL=content.js.map