2022-01-06 17:28:31 +00:00
|
|
|
import { DestinationCalendar, SelectedCalendar } from "@prisma/client";
|
|
|
|
import { TFunction } from "next-i18next";
|
|
|
|
|
|
|
|
import { PaymentInfo } from "@ee/lib/stripe/server";
|
|
|
|
|
2022-02-11 22:20:10 +00:00
|
|
|
import type { Event } from "@lib/events/EventManager";
|
2022-01-06 17:28:31 +00:00
|
|
|
import { Ensure } from "@lib/types/utils";
|
|
|
|
import { VideoCallData } from "@lib/videoClient";
|
|
|
|
|
|
|
|
import { NewCalendarEventType } from "../constants/types";
|
|
|
|
import { ConferenceData } from "./GoogleCalendar";
|
|
|
|
|
|
|
|
export type Person = {
|
|
|
|
name: string;
|
|
|
|
email: string;
|
|
|
|
timeZone: string;
|
2022-01-27 20:32:53 +00:00
|
|
|
language: { translate: TFunction; locale: string };
|
2022-01-06 17:28:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export interface EntryPoint {
|
|
|
|
entryPointType?: string;
|
|
|
|
uri?: string;
|
|
|
|
label?: string;
|
|
|
|
pin?: string;
|
|
|
|
accessCode?: string;
|
|
|
|
meetingCode?: string;
|
|
|
|
passcode?: string;
|
|
|
|
password?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface AdditionInformation {
|
|
|
|
conferenceData?: ConferenceData;
|
|
|
|
entryPoints?: EntryPoint[];
|
|
|
|
hangoutLink?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface CalendarEvent {
|
|
|
|
type: string;
|
|
|
|
title: string;
|
|
|
|
startTime: string;
|
|
|
|
endTime: string;
|
|
|
|
description?: string | null;
|
|
|
|
team?: {
|
|
|
|
name: string;
|
|
|
|
members: string[];
|
|
|
|
};
|
|
|
|
location?: string | null;
|
|
|
|
organizer: Person;
|
|
|
|
attendees: Person[];
|
|
|
|
conferenceData?: ConferenceData;
|
|
|
|
additionInformation?: AdditionInformation;
|
|
|
|
uid?: string | null;
|
|
|
|
videoCallData?: VideoCallData;
|
|
|
|
paymentInfo?: PaymentInfo | null;
|
|
|
|
destinationCalendar?: DestinationCalendar | null;
|
2022-01-28 17:40:29 +00:00
|
|
|
cancellationReason?: string | null;
|
2022-02-09 18:25:58 +00:00
|
|
|
rejectionReason?: string | null;
|
2022-01-06 17:28:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface IntegrationCalendar extends Ensure<Partial<SelectedCalendar>, "externalId"> {
|
|
|
|
primary?: boolean;
|
|
|
|
name?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
type EventBusyDate = Record<"start" | "end", Date | string>;
|
|
|
|
|
|
|
|
export interface Calendar {
|
|
|
|
createEvent(event: CalendarEvent): Promise<NewCalendarEventType>;
|
|
|
|
|
2022-02-10 10:44:46 +00:00
|
|
|
updateEvent(uid: string, event: CalendarEvent): Promise<Event | Event[]>;
|
2022-01-06 17:28:31 +00:00
|
|
|
|
2022-01-13 19:47:15 +00:00
|
|
|
deleteEvent(uid: string, event: CalendarEvent): Promise<unknown>;
|
2022-01-06 17:28:31 +00:00
|
|
|
|
|
|
|
getAvailability(
|
|
|
|
dateFrom: string,
|
|
|
|
dateTo: string,
|
|
|
|
selectedCalendars: IntegrationCalendar[]
|
|
|
|
): Promise<EventBusyDate[]>;
|
|
|
|
|
|
|
|
listCalendars(event?: CalendarEvent): Promise<IntegrationCalendar[]>;
|
|
|
|
}
|