go-scheduler-node-sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CalendarMembers = void 0;
4
+ class CalendarMembers {
5
+ constructor(http) {
6
+ this.http = http;
7
+ }
8
+ async invite(calendarUID, data) {
9
+ return this.http.post(`/api/v1/calendars/${calendarUID}/members`, data);
10
+ }
11
+ async list(calendarUID, requestingAccountID) {
12
+ return this.http.get(`/api/v1/calendars/${calendarUID}/members`, {
13
+ params: { account_id: requestingAccountID },
14
+ });
15
+ }
16
+ async update(calendarUID, memberAccountID, requestingAccountID, data) {
17
+ return this.http.put(`/api/v1/calendars/${calendarUID}/members/${memberAccountID}`, data, {
18
+ params: { account_id: requestingAccountID },
19
+ });
20
+ }
21
+ async remove(calendarUID, memberAccountID, requestingAccountID) {
22
+ return this.http.delete(`/api/v1/calendars/${calendarUID}/members/${memberAccountID}`, {
23
+ params: { account_id: requestingAccountID },
24
+ });
25
+ }
26
+ }
27
+ exports.CalendarMembers = CalendarMembers;
@@ -0,0 +1,30 @@
1
+ import { HttpClient } from "../utils/http";
2
+ import { Calendar, CreateCalendarRequest, UpdateCalendarRequest, PagedResponse, ICSImportOptions, ICSImportResponse, ICSLinkImportOptions, ICSLinkImportResponse, ResyncResponse } from "../types";
3
+ export declare class Calendars {
4
+ private http;
5
+ constructor(http: HttpClient);
6
+ create(data: CreateCalendarRequest): Promise<Calendar>;
7
+ get(calendarUID: string): Promise<Calendar>;
8
+ list(accountID: string, limit?: number, offset?: number): Promise<PagedResponse<Calendar>>;
9
+ update(calendarUID: string, data: UpdateCalendarRequest): Promise<Calendar>;
10
+ delete(calendarUID: string): Promise<void>;
11
+ /**
12
+ * Import events from an ICS file
13
+ * @param file - The ICS file to import (Buffer or Blob)
14
+ * @param options - Import options
15
+ * @returns Import response with summary and event results
16
+ */
17
+ importICS(file: Buffer | Blob, options: ICSImportOptions): Promise<ICSImportResponse>;
18
+ /**
19
+ * Import events from an ICS URL
20
+ * @param options - Import options including URL and authentication
21
+ * @returns Import response with summary and event results
22
+ */
23
+ importICSLink(options: ICSLinkImportOptions): Promise<ICSLinkImportResponse>;
24
+ /**
25
+ * Manually resync an ICS calendar
26
+ * @param calendarUID - The calendar UID to resync
27
+ * @returns Resync response with summary
28
+ */
29
+ resync(calendarUID: string): Promise<ResyncResponse>;
30
+ }
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Calendars = void 0;
4
+ class Calendars {
5
+ constructor(http) {
6
+ this.http = http;
7
+ }
8
+ async create(data) {
9
+ return this.http.post("/api/v1/calendars", data);
10
+ }
11
+ async get(calendarUID) {
12
+ return this.http.get(`/api/v1/calendars/${calendarUID}`);
13
+ }
14
+ async list(accountID, limit = 50, offset = 0) {
15
+ return this.http.get("/api/v1/calendars", {
16
+ params: {
17
+ account_id: accountID,
18
+ limit: limit.toString(),
19
+ offset: offset.toString(),
20
+ },
21
+ });
22
+ }
23
+ async update(calendarUID, data) {
24
+ return this.http.put(`/api/v1/calendars/${calendarUID}`, data);
25
+ }
26
+ async delete(calendarUID) {
27
+ return this.http.delete(`/api/v1/calendars/${calendarUID}`);
28
+ }
29
+ /**
30
+ * Import events from an ICS file
31
+ * @param file - The ICS file to import (Buffer or Blob)
32
+ * @param options - Import options
33
+ * @returns Import response with summary and event results
34
+ */
35
+ async importICS(file, options) {
36
+ const formData = new FormData();
37
+ // Add file
38
+ if (Buffer.isBuffer(file)) {
39
+ formData.append("file", new Blob([file]), "calendar.ics");
40
+ }
41
+ else {
42
+ formData.append("file", file, "calendar.ics");
43
+ }
44
+ // Add required fields
45
+ formData.append("account_id", options.accountId);
46
+ // Add optional fields
47
+ if (options.calendarUid) {
48
+ formData.append("calendar_uid", options.calendarUid);
49
+ }
50
+ if (options.calendarMetadata) {
51
+ formData.append("calendar_metadata", JSON.stringify(options.calendarMetadata));
52
+ }
53
+ if (options.importReminders !== undefined) {
54
+ formData.append("import_reminders", options.importReminders.toString());
55
+ }
56
+ if (options.importAttendees !== undefined) {
57
+ formData.append("import_attendees", options.importAttendees.toString());
58
+ }
59
+ return this.http.postForm("/api/v1/calendars/import/ics", formData);
60
+ }
61
+ /**
62
+ * Import events from an ICS URL
63
+ * @param options - Import options including URL and authentication
64
+ * @returns Import response with summary and event results
65
+ */
66
+ async importICSLink(options) {
67
+ const body = {
68
+ account_id: options.accountId,
69
+ ics_url: options.icsUrl,
70
+ auth_type: options.authType,
71
+ ...(options.authCredentials && {
72
+ auth_credentials: options.authCredentials,
73
+ }),
74
+ ...(options.syncIntervalSeconds && {
75
+ sync_interval_seconds: options.syncIntervalSeconds,
76
+ }),
77
+ ...(options.calendarMetadata && {
78
+ calendar_metadata: options.calendarMetadata,
79
+ }),
80
+ ...(options.syncOnPartialFailure !== undefined && {
81
+ sync_on_partial_failure: options.syncOnPartialFailure,
82
+ }),
83
+ };
84
+ return this.http.post("/api/v1/calendars/import/ics-link", body);
85
+ }
86
+ /**
87
+ * Manually resync an ICS calendar
88
+ * @param calendarUID - The calendar UID to resync
89
+ * @returns Resync response with summary
90
+ */
91
+ async resync(calendarUID) {
92
+ return this.http.post(`/api/v1/calendars/${calendarUID}/resync`, {});
93
+ }
94
+ }
95
+ exports.Calendars = Calendars;
@@ -0,0 +1,18 @@
1
+ import { HttpClient } from "../utils/http";
2
+ import { Event, CreateEventRequest, UpdateEventRequest, GetCalendarEventsRequest, PagedResponse } from "../types";
3
+ export declare class Events {
4
+ private http;
5
+ constructor(http: HttpClient);
6
+ create(data: CreateEventRequest): Promise<Event>;
7
+ get(eventUID: string): Promise<Event>;
8
+ getCalendarEvents(data: GetCalendarEventsRequest): Promise<PagedResponse<Event>>;
9
+ update(eventUID: string, data: UpdateEventRequest): Promise<Event>;
10
+ delete(eventUID: string, accountID: string, scope?: "single" | "all"): Promise<void>;
11
+ toggleCancelled(eventUID: string): Promise<Event>;
12
+ transferOwnership(eventUID: string, newOrganizerAccountID: string, newOrganizerCalendarUID: string, scope?: "single" | "all"): Promise<{
13
+ message: string;
14
+ new_organizer: any;
15
+ scope: string;
16
+ count: number;
17
+ }>;
18
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Events = void 0;
4
+ class Events {
5
+ constructor(http) {
6
+ this.http = http;
7
+ }
8
+ async create(data) {
9
+ return this.http.post("/api/v1/events", data);
10
+ }
11
+ async get(eventUID) {
12
+ return this.http.get(`/api/v1/events/${eventUID}`);
13
+ }
14
+ async getCalendarEvents(data) {
15
+ return this.http.post("/api/v1/calendars/events", data);
16
+ }
17
+ async update(eventUID, data) {
18
+ return this.http.put(`/api/v1/events/${eventUID}`, data);
19
+ }
20
+ async delete(eventUID, accountID, scope) {
21
+ const params = { account_id: accountID };
22
+ if (scope) {
23
+ params.scope = scope;
24
+ }
25
+ return this.http.delete(`/api/v1/events/${eventUID}`, {
26
+ params,
27
+ });
28
+ }
29
+ async toggleCancelled(eventUID) {
30
+ return this.http.post(`/api/v1/events/${eventUID}/toggle-cancelled`);
31
+ }
32
+ async transferOwnership(eventUID, newOrganizerAccountID, newOrganizerCalendarUID, scope) {
33
+ return this.http.post(`/api/v1/events/${eventUID}/transfer-ownership`, {
34
+ new_organizer_account_id: newOrganizerAccountID,
35
+ new_organizer_calendar_uid: newOrganizerCalendarUID,
36
+ scope,
37
+ });
38
+ }
39
+ }
40
+ exports.Events = Events;
@@ -0,0 +1,22 @@
1
+ import { HttpClient } from "../utils/http";
2
+ import { Reminder, CreateReminderRequest, UpdateReminderRequest } from "../types";
3
+ export declare class Reminders {
4
+ private http;
5
+ constructor(http: HttpClient);
6
+ create(eventUID: string, data: CreateReminderRequest): Promise<{
7
+ reminder: Reminder;
8
+ scope: string;
9
+ count: number;
10
+ }>;
11
+ list(eventUID: string, accountID?: string): Promise<Reminder[]>;
12
+ update(eventUID: string, reminderUID: string, data: UpdateReminderRequest): Promise<{
13
+ reminder: Reminder;
14
+ scope: string;
15
+ count: number;
16
+ }>;
17
+ delete(eventUID: string, reminderUID: string, scope?: "single" | "all"): Promise<{
18
+ message: string;
19
+ scope: string;
20
+ count: number;
21
+ }>;
22
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Reminders = void 0;
4
+ class Reminders {
5
+ constructor(http) {
6
+ this.http = http;
7
+ }
8
+ async create(eventUID, data) {
9
+ return this.http.post(`/api/v1/events/${eventUID}/reminders`, data);
10
+ }
11
+ async list(eventUID, accountID) {
12
+ const params = accountID ? { account_id: accountID } : undefined;
13
+ return this.http.get(`/api/v1/events/${eventUID}/reminders`, {
14
+ params,
15
+ });
16
+ }
17
+ async update(eventUID, reminderUID, data) {
18
+ return this.http.put(`/api/v1/events/${eventUID}/reminders/${reminderUID}`, data);
19
+ }
20
+ async delete(eventUID, reminderUID, scope) {
21
+ const params = scope ? { scope } : undefined;
22
+ return this.http.delete(`/api/v1/events/${eventUID}/reminders/${reminderUID}`, {
23
+ params,
24
+ });
25
+ }
26
+ }
27
+ exports.Reminders = Reminders;
@@ -0,0 +1,12 @@
1
+ import { HttpClient } from "../utils/http";
2
+ import { Webhook, CreateWebhookRequest, UpdateWebhookRequest, WebhookDelivery, PagedResponse } from "../types";
3
+ export declare class Webhooks {
4
+ private http;
5
+ constructor(http: HttpClient);
6
+ create(data: CreateWebhookRequest): Promise<Webhook>;
7
+ get(webhookUID: string): Promise<Webhook>;
8
+ list(limit?: number, offset?: number): Promise<PagedResponse<Webhook>>;
9
+ update(webhookUID: string, data: UpdateWebhookRequest): Promise<Webhook>;
10
+ delete(webhookUID: string): Promise<void>;
11
+ getDeliveries(webhookUID: string, limit?: number, offset?: number): Promise<PagedResponse<WebhookDelivery>>;
12
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Webhooks = void 0;
4
+ class Webhooks {
5
+ constructor(http) {
6
+ this.http = http;
7
+ }
8
+ async create(data) {
9
+ return this.http.post("/api/v1/webhooks", data);
10
+ }
11
+ async get(webhookUID) {
12
+ return this.http.get(`/api/v1/webhooks/${webhookUID}`);
13
+ }
14
+ async list(limit = 50, offset = 0) {
15
+ return this.http.get("/api/v1/webhooks", {
16
+ params: { limit, offset },
17
+ });
18
+ }
19
+ async update(webhookUID, data) {
20
+ return this.http.put(`/api/v1/webhooks/${webhookUID}`, data);
21
+ }
22
+ async delete(webhookUID) {
23
+ return this.http.delete(`/api/v1/webhooks/${webhookUID}`);
24
+ }
25
+ async getDeliveries(webhookUID, limit = 50, offset = 0) {
26
+ return this.http.get(`/api/v1/webhooks/deliveries/${webhookUID}`, {
27
+ params: { limit, offset },
28
+ });
29
+ }
30
+ }
31
+ exports.Webhooks = Webhooks;
@@ -0,0 +1,338 @@
1
+ export interface SchedulerConfig {
2
+ baseURL: string;
3
+ timeout?: number;
4
+ headers?: Record<string, string>;
5
+ }
6
+ export interface Calendar {
7
+ calendar_uid: string;
8
+ account_id: string;
9
+ name?: string;
10
+ description?: string;
11
+ timezone?: string;
12
+ metadata?: Record<string, any>;
13
+ created_ts: number;
14
+ updated_ts: number;
15
+ ics_url?: string | null;
16
+ ics_auth_type?: string | null;
17
+ ics_last_sync_ts?: number | null;
18
+ ics_last_sync_status?: string | null;
19
+ ics_sync_interval_seconds?: number | null;
20
+ ics_error_message?: string | null;
21
+ ics_last_etag?: string | null;
22
+ ics_last_modified?: string | null;
23
+ is_read_only?: boolean;
24
+ sync_on_partial_failure?: boolean;
25
+ }
26
+ export interface CreateCalendarRequest {
27
+ account_id: string;
28
+ name?: string;
29
+ description?: string;
30
+ timezone?: string;
31
+ metadata?: Record<string, any>;
32
+ }
33
+ export interface UpdateCalendarRequest {
34
+ name?: string;
35
+ description?: string;
36
+ timezone?: string;
37
+ metadata?: Record<string, any>;
38
+ }
39
+ export interface Recurrence {
40
+ rule: string;
41
+ until?: number;
42
+ count?: number;
43
+ }
44
+ export interface Event {
45
+ event_uid: string;
46
+ calendar_uid: string;
47
+ account_id: string;
48
+ start_ts: number;
49
+ end_ts: number;
50
+ duration: number;
51
+ timezone?: string;
52
+ local_start?: string;
53
+ metadata?: Record<string, any>;
54
+ recurrence?: Recurrence;
55
+ recurrence_status?: string;
56
+ recurrence_end_ts?: number;
57
+ is_recurring_instance?: boolean;
58
+ is_modified?: boolean;
59
+ master_event_uid?: string;
60
+ original_start_ts?: number;
61
+ exdates_ts?: number[];
62
+ is_cancelled?: boolean;
63
+ created_ts: number;
64
+ updated_ts: number;
65
+ }
66
+ export interface CreateEventRequest {
67
+ calendar_uid: string;
68
+ account_id: string;
69
+ start_ts: number;
70
+ end_ts: number;
71
+ timezone?: string;
72
+ local_start?: string;
73
+ metadata?: Record<string, any>;
74
+ recurrence?: Recurrence;
75
+ }
76
+ export type UpdateScope = "single" | "future" | "all";
77
+ export interface UpdateEventRequest {
78
+ account_id: string;
79
+ start_ts: number;
80
+ end_ts: number;
81
+ timezone?: string;
82
+ local_start?: string;
83
+ metadata?: Record<string, any>;
84
+ recurrence?: Recurrence;
85
+ scope?: UpdateScope;
86
+ }
87
+ export interface GetCalendarEventsRequest {
88
+ calendar_uids: string[];
89
+ start_ts: number;
90
+ end_ts: number;
91
+ }
92
+ export interface Reminder {
93
+ reminder_uid?: string;
94
+ reminder_group_id?: string;
95
+ event_uid: string;
96
+ account_id: string;
97
+ offset_seconds: number;
98
+ trigger_ts?: number;
99
+ metadata?: Record<string, any>;
100
+ is_delivered?: boolean;
101
+ delivered_ts?: number;
102
+ is_archived?: boolean;
103
+ created_ts?: number;
104
+ updated_ts?: number;
105
+ }
106
+ export interface CreateReminderRequest {
107
+ offset_seconds: number;
108
+ account_id: string;
109
+ metadata?: Record<string, any>;
110
+ scope?: "single" | "all";
111
+ }
112
+ export interface UpdateReminderRequest {
113
+ offset_seconds: number;
114
+ metadata?: Record<string, any>;
115
+ scope?: "single" | "all";
116
+ }
117
+ export interface Webhook {
118
+ webhook_uid: string;
119
+ url: string;
120
+ event_types?: string[];
121
+ secret: string;
122
+ retry_count: number;
123
+ timeout_seconds: number;
124
+ failure_count?: number;
125
+ is_active?: boolean;
126
+ created_ts: number;
127
+ updated_ts: number;
128
+ }
129
+ export interface CreateWebhookRequest {
130
+ url: string;
131
+ event_types?: string[];
132
+ secret?: string;
133
+ retry_count?: number;
134
+ timeout_seconds?: number;
135
+ }
136
+ export interface UpdateWebhookRequest {
137
+ url?: string;
138
+ event_types?: string[];
139
+ retry_count?: number;
140
+ timeout_seconds?: number;
141
+ is_active?: boolean;
142
+ }
143
+ export interface WebhookDelivery {
144
+ delivery_uid: string;
145
+ webhook_uid: string;
146
+ event_type: string;
147
+ payload: Record<string, any>;
148
+ status_code?: number;
149
+ response_body?: string;
150
+ error_message?: string;
151
+ attempt_count: number;
152
+ created_ts: number;
153
+ delivered_ts?: number;
154
+ }
155
+ export interface Attendee {
156
+ attendee_uid: string;
157
+ event_uid: string;
158
+ account_id: string;
159
+ role: "organizer" | "attendee";
160
+ rsvp_status: "pending" | "accepted" | "declined" | "tentative";
161
+ attendee_group_id?: string;
162
+ metadata?: Record<string, any>;
163
+ created_ts: number;
164
+ updated_ts: number;
165
+ }
166
+ export interface CreateAttendeeRequest {
167
+ account_id: string;
168
+ role?: "organizer" | "attendee";
169
+ metadata?: Record<string, any>;
170
+ scope?: "single" | "all";
171
+ }
172
+ export interface UpdateAttendeeRequest {
173
+ role?: "organizer" | "attendee";
174
+ metadata?: Record<string, any>;
175
+ scope?: "single" | "all";
176
+ }
177
+ export interface UpdateAttendeeRSVPRequest {
178
+ rsvp_status: "pending" | "accepted" | "declined" | "tentative";
179
+ scope?: "single" | "all";
180
+ }
181
+ export interface TransferOwnershipRequest {
182
+ new_organizer_account_id: string;
183
+ new_organizer_calendar_uid: string;
184
+ scope?: "single" | "all";
185
+ }
186
+ export interface CalendarMember {
187
+ calendar_uid: string;
188
+ account_id: string;
189
+ role: "read" | "write";
190
+ status: "pending" | "confirmed";
191
+ created_ts: number;
192
+ updated_ts: number;
193
+ }
194
+ export interface InviteCalendarMembersRequest {
195
+ account_id: string;
196
+ account_ids: string[];
197
+ role: "read" | "write";
198
+ }
199
+ export interface UpdateCalendarMemberRequest {
200
+ role?: "read" | "write";
201
+ status?: "pending" | "confirmed";
202
+ }
203
+ export interface PagedResponse<T> {
204
+ data: T[];
205
+ total: number;
206
+ limit?: number;
207
+ offset?: number;
208
+ }
209
+ export interface ErrorResponse {
210
+ error: string;
211
+ details?: string;
212
+ }
213
+ export interface ICSImportOptions {
214
+ accountId: string;
215
+ calendarUid?: string;
216
+ calendarMetadata?: Record<string, any>;
217
+ importReminders?: boolean;
218
+ importAttendees?: boolean;
219
+ }
220
+ export interface ICSImportSummary {
221
+ total_events: number;
222
+ imported_events: number;
223
+ failed_events: number;
224
+ }
225
+ export interface ICSImportEventResult {
226
+ ics_uid: string;
227
+ event_uid?: string;
228
+ status: "success" | "failed";
229
+ error?: string;
230
+ }
231
+ export interface ICSImportResponse {
232
+ calendar: Calendar;
233
+ summary: ICSImportSummary;
234
+ events: ICSImportEventResult[];
235
+ }
236
+ export interface ICSLinkImportOptions {
237
+ accountId: string;
238
+ icsUrl: string;
239
+ authType: "none" | "basic" | "bearer";
240
+ authCredentials?: string;
241
+ syncIntervalSeconds?: number;
242
+ calendarMetadata?: Record<string, any>;
243
+ syncOnPartialFailure?: boolean;
244
+ }
245
+ export interface ICSLinkImportResponse {
246
+ calendar: Calendar;
247
+ summary: ICSImportSummary;
248
+ events: ICSImportEventResult[];
249
+ sync_scheduled: boolean;
250
+ }
251
+ export interface ResyncResponse {
252
+ calendar: Calendar;
253
+ imported_events: number;
254
+ failed_events: number;
255
+ warnings: string[];
256
+ }
257
+ export type WebhookEventType = "event.created" | "event.updated" | "event.deleted" | "event.cancelled" | "event.uncancelled" | "event.ownership_transferred" | "calendar.created" | "calendar.updated" | "calendar.deleted" | "calendar.synced" | "calendar.resynced" | "member.invited" | "member.accepted" | "member.rejected" | "member.removed" | "member.status_updated" | "member.role_updated" | "reminder.created" | "reminder.updated" | "reminder.deleted" | "reminder.triggered" | "reminder.due" | "attendee.created" | "attendee.updated" | "attendee.deleted" | "attendee.rsvp_updated";
258
+ export interface WebhookPayload<T = any> {
259
+ webhook_uid: string;
260
+ event_type: WebhookEventType;
261
+ delivery_id: string;
262
+ timestamp: number;
263
+ data: T;
264
+ }
265
+ export interface CalendarWebhookData {
266
+ calendar_uid: string;
267
+ account_id: string;
268
+ created_ts?: number;
269
+ updated_ts?: number;
270
+ metadata?: Record<string, any>;
271
+ }
272
+ export interface CalendarSyncedWebhookData {
273
+ calendar_uid: string;
274
+ account_id: string;
275
+ imported_events: number;
276
+ failed_events: number;
277
+ warnings: string[];
278
+ sync_ts: number;
279
+ manual_trigger: boolean;
280
+ }
281
+ export interface EventWebhookData {
282
+ event_uid: string;
283
+ calendar_uid: string;
284
+ account_id: string;
285
+ start_ts: number;
286
+ end_ts?: number;
287
+ metadata?: Record<string, any>;
288
+ }
289
+ export interface EventBatchWebhookData {
290
+ events: EventWebhookData[];
291
+ count: number;
292
+ }
293
+ export interface ReminderWebhookData {
294
+ reminder_uid: string;
295
+ event_uid: string;
296
+ account_id: string;
297
+ offset_seconds: number;
298
+ metadata?: Record<string, any>;
299
+ }
300
+ export interface ReminderDueWebhookData {
301
+ reminder_uid: string;
302
+ event_uid: string;
303
+ account_id: string;
304
+ offset_seconds: number;
305
+ remind_at_ts: number;
306
+ reminder_metadata?: Record<string, any>;
307
+ event: {
308
+ event_uid: string;
309
+ calendar_uid: string;
310
+ start_ts: number;
311
+ event_metadata?: Record<string, any>;
312
+ };
313
+ }
314
+ export interface AttendeeWebhookData {
315
+ event_uid: string;
316
+ account_id: string;
317
+ role: "organizer" | "attendee";
318
+ rsvp_status: "pending" | "accepted" | "declined" | "tentative";
319
+ scope?: "single" | "all";
320
+ count?: number;
321
+ }
322
+ export interface MemberWebhookData {
323
+ calendar_uid: string;
324
+ account_id: string;
325
+ role: "read" | "write";
326
+ status: "pending" | "confirmed";
327
+ invited_by: string;
328
+ }
329
+ export interface WebhookVerificationResult {
330
+ valid: boolean;
331
+ error?: string;
332
+ }
333
+ export declare function isCalendarWebhook(payload: WebhookPayload): payload is WebhookPayload<CalendarWebhookData>;
334
+ export declare function isCalendarSyncedWebhook(payload: WebhookPayload): payload is WebhookPayload<CalendarSyncedWebhookData>;
335
+ export declare function isEventWebhook(payload: WebhookPayload): payload is WebhookPayload<EventWebhookData | EventWebhookData[]>;
336
+ export declare function isReminderDueWebhook(payload: WebhookPayload): payload is WebhookPayload<ReminderDueWebhookData>;
337
+ export declare function isAttendeeWebhook(payload: WebhookPayload): payload is WebhookPayload<AttendeeWebhookData>;
338
+ export declare function isMemberWebhook(payload: WebhookPayload): payload is WebhookPayload<MemberWebhookData>;
package/dist/types.js ADDED
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isCalendarWebhook = isCalendarWebhook;
4
+ exports.isCalendarSyncedWebhook = isCalendarSyncedWebhook;
5
+ exports.isEventWebhook = isEventWebhook;
6
+ exports.isReminderDueWebhook = isReminderDueWebhook;
7
+ exports.isAttendeeWebhook = isAttendeeWebhook;
8
+ exports.isMemberWebhook = isMemberWebhook;
9
+ // Type guards for webhook payloads
10
+ function isCalendarWebhook(payload) {
11
+ return (payload.event_type.startsWith("calendar.") &&
12
+ payload.event_type !== "calendar.synced" &&
13
+ payload.event_type !== "calendar.resynced");
14
+ }
15
+ function isCalendarSyncedWebhook(payload) {
16
+ return (payload.event_type === "calendar.synced" ||
17
+ payload.event_type === "calendar.resynced");
18
+ }
19
+ function isEventWebhook(payload) {
20
+ return payload.event_type.startsWith("event.");
21
+ }
22
+ function isReminderDueWebhook(payload) {
23
+ return (payload.event_type === "reminder.due" ||
24
+ payload.event_type === "reminder.triggered");
25
+ }
26
+ function isAttendeeWebhook(payload) {
27
+ return payload.event_type.startsWith("attendee.");
28
+ }
29
+ function isMemberWebhook(payload) {
30
+ return payload.event_type.startsWith("member.");
31
+ }