cal.pub0.org/packages/app-store/jitsivideo/lib/VideoApiAdapter.ts

44 lines
1.2 KiB
TypeScript

import { v4 as uuidv4 } from "uuid";
import type { PartialReference } from "@calcom/types/EventManager";
import type { VideoApiAdapter, VideoCallData } from "@calcom/types/VideoApiAdapter";
import getAppKeysFromSlug from "../../_utils/getAppKeysFromSlug";
import { metadata } from "../_metadata";
const JitsiVideoApiAdapter = (): VideoApiAdapter => {
return {
getAvailability: () => {
return Promise.resolve([]);
},
createMeeting: async (): Promise<VideoCallData> => {
const appKeys = await getAppKeysFromSlug(metadata.slug);
const meetingID = uuidv4();
// Default Value
const hostUrl = appKeys.jitsiHost || "https://meet.jit.si/cal";
return Promise.resolve({
type: metadata.type,
id: meetingID,
password: "",
url: hostUrl + "/" + meetingID,
});
},
deleteMeeting: async (): Promise<void> => {
Promise.resolve();
},
updateMeeting: (bookingRef: PartialReference): Promise<VideoCallData> => {
return Promise.resolve({
type: "jitsi_video",
id: bookingRef.meetingId as string,
password: bookingRef.meetingPassword as string,
url: bookingRef.meetingUrl as string,
});
},
};
};
export default JitsiVideoApiAdapter;