34 lines
930 B
TypeScript
34 lines
930 B
TypeScript
|
import { EventJsonDecoder } from './event-json';
|
||
|
import { JsonAnalization } from '@ucap-webmessenger/api';
|
||
|
import { VideoConferenceContentsType } from '@ucap-webmessenger/protocol-event';
|
||
|
|
||
|
export interface VideoConferenceEventJson {
|
||
|
conferenceSeq?: number;
|
||
|
title?: string;
|
||
|
contents?: VideoConferenceContentsType;
|
||
|
startDate?: string;
|
||
|
endDate?: string;
|
||
|
register?: string;
|
||
|
attendee?: string;
|
||
|
}
|
||
|
|
||
|
export const decodeVideoConferenceEventJson: EventJsonDecoder<VideoConferenceEventJson> = (
|
||
|
message: string
|
||
|
) => {
|
||
|
try {
|
||
|
const json = JsonAnalization.receiveAnalization(message);
|
||
|
|
||
|
return {
|
||
|
conferenceSeq: Number(json.confSeq),
|
||
|
title: json.title,
|
||
|
contents: json.contents,
|
||
|
startDate: json.startDate,
|
||
|
endDate: json.endDate,
|
||
|
register: json.register,
|
||
|
attendee: json.attendee
|
||
|
} as VideoConferenceEventJson;
|
||
|
} catch (e) {
|
||
|
return {} as VideoConferenceEventJson;
|
||
|
}
|
||
|
};
|