import { StatusCode, JsonAnalization } from '@ucap-webmessenger/api'; import { FileType } from '@ucap-webmessenger/protocol-file'; import { EventJsonDecoder } from './event-json'; export interface BundleImageEventJson { statusCode?: StatusCode; errorMessage?: string; roomSeq?: number; attachmentSeq?: number; fileCount?: number; baseUrl?: string; thumbUrls?: string[]; } export const decodeBundleImageEventJson: EventJsonDecoder = ( message: string ) => { try { const json = JsonAnalization.receiveAnalization(message); return { statusCode: json.StatusCode, errorMessage: json.ErrorMessage, roomSeq: json.RoomID, attachmentSeq: json.AttSEQ, fileCount: json.FileCount, thumbUrls: json.ThumbURL } as BundleImageEventJson; } catch (e) { return { statusCode: StatusCode.Fail, errorMessage: e.toString() } as BundleImageEventJson; } };