import type { SendVideoOptions } from 'zca-js'; import { ThreadType, type API } from 'zca-js'; import type { INodeExecutionData } from 'n8n-workflow'; import type { FileDownloadOptions } from './fileHelper'; /** URL video-sta/d1md.me cần gọi renewlink trước khi forward. */ export declare function needsVideoRenew(urls: string[]): boolean; /** @deprecated Dùng {@link needsVideoRenew} */ export declare function shouldSkipVideoForward(urls: string[]): boolean; export type VideoAlbumItem = { videoUrl: string; thumbnailUrl: string; duration?: number; width?: number; height?: number; fileSize?: number; msgId?: string; ts?: number; rawParams?: string; childnumber?: number; idInGroup?: number; }; export type VideoForwardStrategy = 'renewLinkBeforeForward' | 'forwardByMsgId' | 'inlineForward5' | 'uploadVideoAlbum'; export type VideoForwardAttemptResult = { result: unknown; strategy: VideoForwardStrategy; attempts: string[]; }; export type VideoAlbumSendResult = { videoResults: unknown[]; captionResults: unknown[]; forwardStrategy?: VideoForwardStrategy; forwardAttempts?: string[]; sendMode: 'forwardVideoAlbum' | 'forwardVideo' | 'uploadVideoAlbum'; albumLayoutAchieved: boolean; skipForwardReason?: string; }; export type VideoAlbumSendOptions = { delayMs?: number; downloadOptions?: FileDownloadOptions; }; /** Video inline — không gửi dạng share.file. */ export declare function resolveInlineVideoSend(items: INodeExecutionData[], index: number, attachmentUrls: string, message: string, downloadOptions?: FileDownloadOptions): Promise; /** Album video theo URL user truyền ở field (không tự mở rộng từ trigger). */ export declare function resolveVideoAlbumSend(items: INodeExecutionData[], index: number, attachmentUrls: string): VideoAlbumItem[] | null; export type VideoSendPlan = { kind: 'none'; } | { kind: 'single'; videoUrl: string; thumbnailUrl?: string; inputSource: 'field'; } | { kind: 'album'; albumItems: VideoAlbumItem[]; inputSource: 'field'; }; /** * Lập kế hoạch gửi video theo input user (field urls). * - Nếu resolve được album (>=2 item) => trả `kind=album` * - Ngược lại nếu có 1 URL => `kind=single` */ export declare function planVideoSend(items: INodeExecutionData[], index: number, fieldVideoUrlsRaw: string): VideoSendPlan; export declare function resolveVideoSendOptions(videoUrl: string, thumbnailUrl: string, message: string, durationMs: number, width: number, height: number, downloadOptions?: FileDownloadOptions): Promise; /** Gửi album video: renewlink (video-sta) → forward CDN → upload album → fallback riêng lẻ (tùy chọn). */ export declare function sendVideoAlbumToThreads(api: API, threadIds: string[], threadType: ThreadType, items: VideoAlbumItem[], caption: string, options?: VideoAlbumSendOptions): Promise; export declare function renewVideoAlbumItemForMixedThread(api: API, threadId: string, threadType: ThreadType, item: VideoAlbumItem, layout: { index: number; total: number; sharedGroupLayoutId: string; }): Promise; export declare function forwardVideoAlbumItemForMixedThread(api: API, threadId: string, threadType: ThreadType, item: VideoAlbumItem, index: number, total: number, caption: string, sharedGroupLayoutId: string): Promise; /** Gửi video inline tới từng nhóm/user qua api.sendVideo (endpoint /forward, msgType 5). */ export declare function sendVideoToThreads(api: API, threadIds: string[], threadType: ThreadType, options: SendVideoOptions, delayMs?: number): Promise;