1 import type { PaginationParams } from '../../api/interface';
2 import type { CALENDAR_DISPLAY, CALENDAR_TYPE } from '../../calendar/constants';
3 import type { ApiResponse } from '../Api';
4 import type { Nullable, RequireSome } from '../utils';
5 import type { CalendarNotificationSettings, CalendarSettings } from './Calendar';
6 import type { CalendarKey, CalendarPassphrase } from './CalendarKey';
7 import type { CalendarMember, CalendarMemberInvitation } from './CalendarMember';
8 import type { Attendee, CalendarEvent, CalendarEventData } from './Event';
9 import type { ACCESS_LEVEL } from './Link';
11 export type CalendarCreateData = {
15 Display: CALENDAR_DISPLAY;
19 export enum DELETION_REASON {
24 export interface CalendarCreateArguments extends CalendarCreateData {
29 export interface CalendarSetupData {
39 export interface CalendarSetupResponse extends ApiResponse {
41 Passphrase: CalendarPassphrase;
44 export interface CreateOrResetCalendarPayload {
54 export interface CalendarKeysResetData {
55 [calendarID: string]: CalendarSetupData;
58 export interface CreateCalendarMemberData {
60 PassphraseKeyPacket: string;
64 export interface UpdateCalendarMemberData {
66 PassphraseKeyPacket: string;
70 Display: CALENDAR_DISPLAY;
73 export interface UpdateCalendarInviteData {
77 export enum CalendarEventsQueryType {
78 PartDayInsideWindow = 0,
79 PartDayBeforeWindow = 1,
80 FullDayInsideWindow = 2,
81 FullDayBeforeWindow = 3,
84 export interface CalendarEventsQuery extends PaginationParams {
88 Type: CalendarEventsQueryType;
89 MetaDataOnly?: 0 | 1; // default is 0
92 export interface CalendarEventsIDsQuery {
97 export interface CalendarExportEventsQuery extends PaginationParams {
101 export interface GetEventByUIDArguments extends Partial<PaginationParams> {
103 RecurrenceID?: number;
104 CalendarType?: CALENDAR_TYPE;
107 export interface CalendarCreateOrUpdateEventBlobData {
108 CalendarKeyPacket?: string;
109 CalendarEventContent?: Omit<CalendarEventData, 'Author'>[];
110 SharedKeyPacket?: string;
111 SharedEventContent?: Omit<CalendarEventData, 'Author'>[];
112 Notifications: Nullable<CalendarNotificationSettings[]>;
113 Color: Nullable<string>;
114 AttendeesEventContent?: Omit<CalendarEventData, 'Author'>[];
115 Attendees?: Omit<Attendee, 'UpdateTime' | 'ID'>[];
116 CancelledOccurrenceContent?: Omit<CalendarEventData, 'Author'>[];
118 export type CalendarCreateEventBlobData = RequireSome<
119 CalendarCreateOrUpdateEventBlobData,
120 'SharedEventContent' | 'SharedKeyPacket'
123 interface CalendarCreateOrUpdateEventMetaData {
126 IsPersonalSingleEdit?: boolean;
127 RemovedAttendeeAddresses?: string[];
128 AddedProtonAttendees?: {
130 AddressKeyPacket: string;
134 export interface CreateOrUpdateCalendarEventData
135 extends CalendarCreateOrUpdateEventBlobData,
136 CalendarCreateOrUpdateEventMetaData {}
137 export interface CreateSinglePersonalEventData {
138 Notifications: Nullable<CalendarNotificationSettings[]>;
139 Color: Nullable<string>;
142 export interface CreateLinkedCalendarEventData
143 extends RequireSome<Partial<CreateOrUpdateCalendarEventData>, 'SharedKeyPacket'> {
145 SharedEventID: string;
146 SourceCalendarID?: string;
149 export interface QueryCalendarAlarms {
155 export interface CreateCalendarEventSyncData {
157 Event: CreateOrUpdateCalendarEventData;
160 export interface DeleteCalendarEventSyncData {
162 DeletionReason?: DELETION_REASON;
165 export interface UpdateCalendarEventSyncData {
167 Event?: Omit<CreateOrUpdateCalendarEventData, 'SharedKeyPacket' | 'CalendarKeyPacket'>;
170 export interface CreateLinkedCalendarEventsSyncData {
172 Event: CreateLinkedCalendarEventData;
175 export interface SyncMultipleEventsData {
179 | CreateCalendarEventSyncData
180 | CreateLinkedCalendarEventsSyncData
181 | DeleteCalendarEventSyncData
182 | UpdateCalendarEventSyncData
186 export interface CreatePublicLinks {
187 AccessLevel: ACCESS_LEVEL;
188 CacheKeySalt: string;
189 CacheKeyHash: string;
190 EncryptedPassphrase: Nullable<string>;
191 EncryptedPurpose: Nullable<string>;
192 EncryptedCacheKey: string;
193 PassphraseID: Nullable<string>;
196 export interface SyncMultipleApiResponses {
200 Event?: CalendarEvent;
205 export interface SyncMultipleApiResponse extends ApiResponse {
206 Responses: SyncMultipleApiResponses[];
209 export interface UpdateEventPartApiResponse extends ApiResponse {
210 Event: CalendarEvent;
213 export interface AttendeeDeleteSingleEditResponse extends ApiResponse {
214 Event: CalendarEvent;
217 interface GetCanonicalAddressesSingleApiResponse extends ApiResponse {
218 CanonicalEmail: string;
221 export interface GetCanonicalAddressesApiResponses {
223 Response: GetCanonicalAddressesSingleApiResponse;
226 export interface GetCanonicalAddressesApiResponse extends ApiResponse {
227 Responses: GetCanonicalAddressesApiResponses[];
230 export interface GetAllMembersApiResponse {
231 Members: CalendarMember[];
234 export interface GetCalendarInvitationsResponse {
235 Invitations: CalendarMemberInvitation[];
238 export enum BUSY_TIME_SLOT_TYPE {
239 /** Partial day: event's start time is inside the requested window */
241 /** Partial day: event's start time is before the requested window */
242 PARTIAL_DAY_BEFORE = 1,
243 /** Full day: event's start date is inside the requested window */
245 /** Full day: event's start date is before the requested window */
249 export interface GetBusySlotsParams {
250 /** Min 0, Max 100. Defaults to 100 */
252 /** 0 based index. Defaults to 0 */
254 Type: BUSY_TIME_SLOT_TYPE;
255 /** Unix timestamp */
257 /** Unix timestamp */
259 /** The timezone currently used on the calendar, will impact which events are returned: "Timezone=Europe/Paris" */
263 export interface GetBusySlotsResponse extends ApiResponse {
265 IsDataAccessible: boolean;
266 BusyTimeSlots: { Start: number; End: number }[] | null;
272 * @warning Not fully typed
274 export interface JoinHolidayCalendarResponse extends ApiResponse {
279 CalendarSettings: CalendarSettings;
282 export enum VIDEO_CONFERENCE_PROVIDER {