@onecal/unified-calendar-api-node-sdk 0.1.1
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.
- package/LICENSE +7 -0
- package/README.md +362 -0
- package/dist/index.cjs +542 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +786 -0
- package/dist/index.d.ts +786 -0
- package/dist/index.js +518 -0
- package/dist/index.js.map +1 -0
- package/dist/oauth/index.cjs +20 -0
- package/dist/oauth/index.cjs.map +1 -0
- package/dist/oauth/index.d.cts +21 -0
- package/dist/oauth/index.d.ts +21 -0
- package/dist/oauth/index.js +18 -0
- package/dist/oauth/index.js.map +1 -0
- package/package.json +94 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,786 @@
|
|
|
1
|
+
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
export { getOAuthUrl } from './oauth/index.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Core types for the Unified Calendar API SDK
|
|
6
|
+
*/
|
|
7
|
+
interface UnifiedCalendarApiConfig {
|
|
8
|
+
/**
|
|
9
|
+
* Your Unified Calendar API key (required)
|
|
10
|
+
*/
|
|
11
|
+
apiKey: string;
|
|
12
|
+
/**
|
|
13
|
+
* Base URL for the API (default: https://api.onecalunified.com)
|
|
14
|
+
*/
|
|
15
|
+
unifiedApiBaseUrl?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Request timeout in milliseconds (default: 30000)
|
|
18
|
+
*/
|
|
19
|
+
timeout?: number;
|
|
20
|
+
}
|
|
21
|
+
interface PaginationParams {
|
|
22
|
+
/**
|
|
23
|
+
* Page token for pagination
|
|
24
|
+
*/
|
|
25
|
+
pageToken?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Number of results per page
|
|
28
|
+
*/
|
|
29
|
+
pageSize?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Sync token for incremental sync
|
|
32
|
+
*/
|
|
33
|
+
syncToken?: string;
|
|
34
|
+
}
|
|
35
|
+
interface PaginatedResponse<T> {
|
|
36
|
+
data: T[];
|
|
37
|
+
pageToken?: string;
|
|
38
|
+
nextPageToken?: string;
|
|
39
|
+
syncToken?: string;
|
|
40
|
+
}
|
|
41
|
+
interface APIResponse<T> {
|
|
42
|
+
data: T;
|
|
43
|
+
success?: boolean;
|
|
44
|
+
message?: string;
|
|
45
|
+
}
|
|
46
|
+
interface APIError {
|
|
47
|
+
code?: string;
|
|
48
|
+
message: string;
|
|
49
|
+
details?: Record<string, any>;
|
|
50
|
+
status?: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Calendar types
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
interface Calendar {
|
|
58
|
+
/** Unique identifier for the calendar */
|
|
59
|
+
id: string;
|
|
60
|
+
/** Display name of the calendar */
|
|
61
|
+
name: string;
|
|
62
|
+
/** Hexadecimal color code representing the calendar's color */
|
|
63
|
+
hexColor?: string;
|
|
64
|
+
/** Indicates whether the calendar is a read-only calendar */
|
|
65
|
+
readOnly?: boolean;
|
|
66
|
+
/** Indicates whether this calendar is the primary calendar within this End User Account */
|
|
67
|
+
isPrimary?: boolean;
|
|
68
|
+
/** Indicates whether the calendar is a shared calendar to this End User Account */
|
|
69
|
+
isShared?: boolean;
|
|
70
|
+
/** Time zone associated with the calendar */
|
|
71
|
+
timeZone?: string;
|
|
72
|
+
/** Email address used for calendar invitations to and from this calendar */
|
|
73
|
+
inviteEmail?: string;
|
|
74
|
+
/** List of allowed online meeting providers for this calendar */
|
|
75
|
+
allowedOnlineMeetingProviders?: string[];
|
|
76
|
+
/** Default online meeting provider used for this calendar */
|
|
77
|
+
defaultOnlineMeetingProvider?: string;
|
|
78
|
+
}
|
|
79
|
+
interface CreateCalendarInput {
|
|
80
|
+
/** Display name for the new calendar */
|
|
81
|
+
name: string;
|
|
82
|
+
/** Hexadecimal color code for the calendar */
|
|
83
|
+
hexColor?: string;
|
|
84
|
+
/** Time zone associated with the calendar */
|
|
85
|
+
timeZone?: string;
|
|
86
|
+
}
|
|
87
|
+
interface UpdateCalendarInput {
|
|
88
|
+
/** Updated display name for the calendar */
|
|
89
|
+
name?: string;
|
|
90
|
+
/** Updated hexadecimal color code for the calendar */
|
|
91
|
+
hexColor?: string;
|
|
92
|
+
/** Updated time zone associated with the calendar */
|
|
93
|
+
timeZone?: string;
|
|
94
|
+
}
|
|
95
|
+
interface ListCalendarsParams extends PaginationParams {
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Event types
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
declare enum EventColorId {
|
|
103
|
+
LAVENDER = "1",
|
|
104
|
+
SAGE = "2",
|
|
105
|
+
GRAPE = "3",
|
|
106
|
+
FLAMINGO = "4",
|
|
107
|
+
BANANA = "5",
|
|
108
|
+
TANGERINE = "6",
|
|
109
|
+
PEACOCK = "7",
|
|
110
|
+
GRAPHITE = "8",
|
|
111
|
+
BLUEBERRY = "9",
|
|
112
|
+
BASIL = "10",
|
|
113
|
+
TOMATO = "11"
|
|
114
|
+
}
|
|
115
|
+
declare enum EventOrderBy {
|
|
116
|
+
START_TIME = "startDateTime",
|
|
117
|
+
UPDATED = "updatedDateTime"
|
|
118
|
+
}
|
|
119
|
+
interface EventDateTime {
|
|
120
|
+
/** Date and time in ISO 8601 format (e.g., 2023-03-15T10:00:00) */
|
|
121
|
+
dateTime?: string;
|
|
122
|
+
/** Time zone identifier (e.g., America/New_York) */
|
|
123
|
+
timeZone?: string;
|
|
124
|
+
}
|
|
125
|
+
interface EventAttendee {
|
|
126
|
+
/** Unique identifier of the attendee */
|
|
127
|
+
id?: string;
|
|
128
|
+
/** Full name of the attendee */
|
|
129
|
+
name?: string;
|
|
130
|
+
/** Email address of the attendee */
|
|
131
|
+
email: string;
|
|
132
|
+
/** The attendee's response to the invitation */
|
|
133
|
+
responseStatus?: 'needsAction' | 'declined' | 'tentative' | 'accepted';
|
|
134
|
+
}
|
|
135
|
+
interface EventActor {
|
|
136
|
+
/** Unique identifier for the actor (optional) */
|
|
137
|
+
id?: string;
|
|
138
|
+
/** Display name of the actor (optional) */
|
|
139
|
+
name?: string;
|
|
140
|
+
/** Email address of the actor (optional) */
|
|
141
|
+
email?: string;
|
|
142
|
+
/** Whether this actor is the current user */
|
|
143
|
+
isSelf?: boolean;
|
|
144
|
+
}
|
|
145
|
+
interface ConferenceData {
|
|
146
|
+
/** Conference identifier from the provider (optional) */
|
|
147
|
+
conferenceId?: string;
|
|
148
|
+
/** URL to join the conference */
|
|
149
|
+
joinUrl?: string;
|
|
150
|
+
/** Type of conference (e.g., hangoutsMeet, zoom, teams) */
|
|
151
|
+
conferenceType?: string;
|
|
152
|
+
/** Additional conference details specific to the provider */
|
|
153
|
+
conferenceDetails?: Record<string, any>;
|
|
154
|
+
}
|
|
155
|
+
interface EventReminder {
|
|
156
|
+
/** Reminder notification method (e.g., email, popup) */
|
|
157
|
+
method?: string;
|
|
158
|
+
/** Number of minutes before the event to trigger the reminder */
|
|
159
|
+
minutes?: number;
|
|
160
|
+
}
|
|
161
|
+
interface EventReminders {
|
|
162
|
+
/** Whether to use the calendar's default reminder settings */
|
|
163
|
+
useDefault?: boolean;
|
|
164
|
+
/** Whether reminders are enabled for this event */
|
|
165
|
+
isReminderOn?: boolean;
|
|
166
|
+
/** Custom reminder overrides */
|
|
167
|
+
overrides?: EventReminder[];
|
|
168
|
+
}
|
|
169
|
+
interface Event {
|
|
170
|
+
/** Unique identifier for the event */
|
|
171
|
+
id: string;
|
|
172
|
+
/** Title or summary of the event */
|
|
173
|
+
title: string;
|
|
174
|
+
/** Detailed description or notes about the event */
|
|
175
|
+
description?: string;
|
|
176
|
+
/** ETag of the event for version control */
|
|
177
|
+
etag?: string;
|
|
178
|
+
/** Event start date and time */
|
|
179
|
+
start: EventDateTime;
|
|
180
|
+
/** Event end date and time */
|
|
181
|
+
end: EventDateTime;
|
|
182
|
+
/** Indicates whether the event lasts all day */
|
|
183
|
+
isAllDay?: boolean;
|
|
184
|
+
/** Physical or virtual location of the event */
|
|
185
|
+
location?: string;
|
|
186
|
+
/** ID representing the event color */
|
|
187
|
+
colorId?: EventColorId;
|
|
188
|
+
/** Custom color code applied to this event */
|
|
189
|
+
customColor?: string;
|
|
190
|
+
/** The user's response to the event invitation */
|
|
191
|
+
myResponseStatus?: 'needsAction' | 'declined' | 'tentative' | 'accepted';
|
|
192
|
+
/** List of attendees invited to the event */
|
|
193
|
+
attendees?: EventAttendee[];
|
|
194
|
+
/** Information about the organizer of the event */
|
|
195
|
+
organizer?: EventActor;
|
|
196
|
+
/** Information about the creator of the event */
|
|
197
|
+
creator?: EventActor;
|
|
198
|
+
/** Visibility level of the event */
|
|
199
|
+
visibility?: 'default' | 'public' | 'private' | 'confidential';
|
|
200
|
+
/** Indicates whether the event blocks time on the calendar */
|
|
201
|
+
transparency?: 'transparent' | 'opaque';
|
|
202
|
+
/** Type of the event */
|
|
203
|
+
eventType?: 'default' | 'outOfOffice' | 'focusTime';
|
|
204
|
+
/** Recurrence rules describing how often the event repeats */
|
|
205
|
+
recurrence?: string[];
|
|
206
|
+
/** ID of the recurring event this instance belongs to */
|
|
207
|
+
recurringEventId?: string;
|
|
208
|
+
/** Indicates whether the event is part of a recurring series */
|
|
209
|
+
isRecurring?: boolean;
|
|
210
|
+
/** Indicates whether the event is an exception in a recurring series */
|
|
211
|
+
isException?: boolean;
|
|
212
|
+
/** Indicates whether the event has been canceled */
|
|
213
|
+
isCancelled?: boolean;
|
|
214
|
+
/** Original start date and time of the event before modification */
|
|
215
|
+
originalStart?: EventDateTime;
|
|
216
|
+
/** Information about an associated conference meeting, if any */
|
|
217
|
+
conferenceData?: ConferenceData;
|
|
218
|
+
/** URL link to view the event in a calendar interface */
|
|
219
|
+
webLink?: string;
|
|
220
|
+
/** iCalendar UID for cross-system identification */
|
|
221
|
+
iCalUid?: string;
|
|
222
|
+
/** Event reminder settings */
|
|
223
|
+
reminders?: EventReminders;
|
|
224
|
+
/** Custom key-value properties visible to others */
|
|
225
|
+
publicExtendedProperties?: Record<string, string>;
|
|
226
|
+
/** Custom key-value properties visible only to the authenticated user */
|
|
227
|
+
privateExtendedProperties?: Record<string, string>;
|
|
228
|
+
/** ISO 8601 date-time when the event was created */
|
|
229
|
+
createdAt?: string;
|
|
230
|
+
/** ISO 8601 date-time when the event was last updated */
|
|
231
|
+
updatedAt?: string;
|
|
232
|
+
}
|
|
233
|
+
interface CreateEventInput {
|
|
234
|
+
/** Optional custom ID for the event (if not provided, one will be generated) */
|
|
235
|
+
id?: string;
|
|
236
|
+
/** Title or summary of the event */
|
|
237
|
+
title: string;
|
|
238
|
+
/** Detailed description or notes about the event */
|
|
239
|
+
description?: string;
|
|
240
|
+
/** Event start date and time */
|
|
241
|
+
start: EventDateTime;
|
|
242
|
+
/** Event end date and time */
|
|
243
|
+
end: EventDateTime;
|
|
244
|
+
/** Indicates whether the event lasts all day */
|
|
245
|
+
isAllDay?: boolean;
|
|
246
|
+
/** Physical or virtual location of the event */
|
|
247
|
+
location?: string;
|
|
248
|
+
/** ID representing the event color */
|
|
249
|
+
colorId?: EventColorId;
|
|
250
|
+
/** Custom color code applied to this event */
|
|
251
|
+
customColor?: string;
|
|
252
|
+
/** The user's response to the event invitation */
|
|
253
|
+
myResponseStatus?: 'needsAction' | 'declined' | 'tentative' | 'accepted';
|
|
254
|
+
/** List of attendees invited to the event */
|
|
255
|
+
attendees?: EventAttendee[];
|
|
256
|
+
/** Visibility level of the event */
|
|
257
|
+
visibility?: 'default' | 'public' | 'private' | 'confidential';
|
|
258
|
+
/** Indicates whether the event blocks time on the calendar */
|
|
259
|
+
transparency?: 'transparent' | 'opaque';
|
|
260
|
+
/** Type of the event */
|
|
261
|
+
eventType?: 'default' | 'outOfOffice' | 'focusTime';
|
|
262
|
+
/** Recurrence rules describing how often the event repeats */
|
|
263
|
+
recurrence?: string[];
|
|
264
|
+
/** ID of the recurring event this instance belongs to */
|
|
265
|
+
recurringEventId?: string;
|
|
266
|
+
/** Indicates whether the event is part of a recurring series */
|
|
267
|
+
isRecurring?: boolean;
|
|
268
|
+
/** Indicates whether the event is an exception in a recurring series */
|
|
269
|
+
isException?: boolean;
|
|
270
|
+
/** Indicates whether the event has been canceled */
|
|
271
|
+
isCancelled?: boolean;
|
|
272
|
+
/** Original start date and time of the event before modification */
|
|
273
|
+
originalStart?: EventDateTime;
|
|
274
|
+
/** Information about an associated conference meeting, if any */
|
|
275
|
+
conferenceData?: ConferenceData;
|
|
276
|
+
/** URL link to view the event in a calendar interface */
|
|
277
|
+
webLink?: string;
|
|
278
|
+
/** Event reminder settings */
|
|
279
|
+
reminders?: EventReminders;
|
|
280
|
+
/** Custom key-value properties visible to others */
|
|
281
|
+
publicExtendedProperties?: Record<string, string>;
|
|
282
|
+
/** Custom key-value properties visible only to the authenticated user */
|
|
283
|
+
privateExtendedProperties?: Record<string, string>;
|
|
284
|
+
/** Information about the organizer of the event */
|
|
285
|
+
organizer?: EventActor;
|
|
286
|
+
/** Information about the creator of the event */
|
|
287
|
+
creator?: EventActor;
|
|
288
|
+
/** Provider used to automatically generate a meeting URL */
|
|
289
|
+
generateMeetingUrlProvider?: string;
|
|
290
|
+
}
|
|
291
|
+
interface UpdateEventInput extends Partial<Omit<CreateEventInput, 'id' | 'generateMeetingUrlProvider'>> {
|
|
292
|
+
}
|
|
293
|
+
interface ListEventsParams extends PaginationParams {
|
|
294
|
+
/** ISO 8601 date-time to filter events that start after this time */
|
|
295
|
+
startDateTime?: Date | string;
|
|
296
|
+
/** ISO 8601 date-time to filter events that end before this time */
|
|
297
|
+
endDateTime?: Date | string;
|
|
298
|
+
/** Display all events in the specified time zone */
|
|
299
|
+
timeZone?: string;
|
|
300
|
+
/** JSON object to filter events by custom properties */
|
|
301
|
+
metadataFilters?: Record<string, any>;
|
|
302
|
+
/** Whether to expand the recurrence of recurring events into individual events. If provided, startDateTime and endDateTime are required. By default recurring events are not expanded */
|
|
303
|
+
expandRecurrences?: boolean;
|
|
304
|
+
/** Search for events by title */
|
|
305
|
+
search?: string;
|
|
306
|
+
/** Filter for all-day events only */
|
|
307
|
+
isAllDay?: boolean;
|
|
308
|
+
/** Include or exclude cancelled events */
|
|
309
|
+
isCancelled?: boolean;
|
|
310
|
+
/** Only return events updated after this date/time (ISO 8601 format or Date object) */
|
|
311
|
+
updatedAfter?: Date | string;
|
|
312
|
+
/** Field to order events by. Only available when expandRecurrences is true */
|
|
313
|
+
orderBy?: EventOrderBy;
|
|
314
|
+
}
|
|
315
|
+
interface RSVPInput {
|
|
316
|
+
/** The user's response to the event invitation */
|
|
317
|
+
responseStatus: 'needsAction' | 'declined' | 'tentative' | 'accepted';
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* End User Account types
|
|
322
|
+
*/
|
|
323
|
+
declare enum ProviderType {
|
|
324
|
+
GOOGLE = "GOOGLE",
|
|
325
|
+
MICROSOFT = "MICROSOFT",
|
|
326
|
+
APPLE = "APPLE"
|
|
327
|
+
}
|
|
328
|
+
declare enum EndUserAccountCredentialStatus {
|
|
329
|
+
ACTIVE = "ACTIVE",
|
|
330
|
+
EXPIRED = "EXPIRED",
|
|
331
|
+
REVOKED = "REVOKED"
|
|
332
|
+
}
|
|
333
|
+
interface EndUserAccount {
|
|
334
|
+
/** Unique identifier for the end user account */
|
|
335
|
+
id: string;
|
|
336
|
+
/** Email address of the end user */
|
|
337
|
+
email: string;
|
|
338
|
+
/** Custom ID for the end user account if provided */
|
|
339
|
+
externalId?: string | null;
|
|
340
|
+
/** The ID of the account in the provider's system, if applicable */
|
|
341
|
+
providerAccountId?: string | null;
|
|
342
|
+
/** Type of the provider associated with this end user account */
|
|
343
|
+
providerType: ProviderType;
|
|
344
|
+
/** Identifier of the application associated with this end user account */
|
|
345
|
+
applicationId: string;
|
|
346
|
+
/** List of authorized scopes granted by the end user account to the application */
|
|
347
|
+
authorizedScopes?: string[];
|
|
348
|
+
/** Status of the end user account */
|
|
349
|
+
status: EndUserAccountCredentialStatus;
|
|
350
|
+
/** Timestamp of when the end user account was created */
|
|
351
|
+
createdAt: string;
|
|
352
|
+
/** Timestamp of when the end user account was last updated */
|
|
353
|
+
updatedAt: string;
|
|
354
|
+
}
|
|
355
|
+
interface EndUserAccountCredential {
|
|
356
|
+
/** Unique identifier for the credential */
|
|
357
|
+
id: string;
|
|
358
|
+
/** ID of the end user account this credential belongs to */
|
|
359
|
+
endUserAccountId: string;
|
|
360
|
+
/** OAuth access token for API calls */
|
|
361
|
+
accessToken: string;
|
|
362
|
+
/** OAuth refresh token for obtaining new access tokens (null if not available) */
|
|
363
|
+
refreshToken: string | null;
|
|
364
|
+
/** Current status of the credential */
|
|
365
|
+
status: EndUserAccountCredentialStatus;
|
|
366
|
+
/** Expiration timestamp for the access token in ISO 8601 format (optional) */
|
|
367
|
+
expiresAt?: string | null;
|
|
368
|
+
/** Timestamp when the credential was created in ISO 8601 format */
|
|
369
|
+
createdAt: string;
|
|
370
|
+
/** Timestamp when the credential was last updated in ISO 8601 format */
|
|
371
|
+
updatedAt: string;
|
|
372
|
+
}
|
|
373
|
+
interface CreateEndUserAccountInput {
|
|
374
|
+
/** Email address of the end user */
|
|
375
|
+
email: string;
|
|
376
|
+
/** OAuth refresh token obtained from the authorization flow */
|
|
377
|
+
refreshToken: string;
|
|
378
|
+
/** Type of the provider (GOOGLE, MICROSOFT, or APPLE) */
|
|
379
|
+
providerType: ProviderType;
|
|
380
|
+
/** Custom ID for the end user account if provided */
|
|
381
|
+
externalId?: string;
|
|
382
|
+
/** List of OAuth scopes that were authorized (optional) */
|
|
383
|
+
authorizedScopes?: string[];
|
|
384
|
+
}
|
|
385
|
+
interface ListEndUserAccountsParams {
|
|
386
|
+
/** Pagination token for retrieving the next page of results */
|
|
387
|
+
pageToken?: string;
|
|
388
|
+
/** Maximum number of accounts to return per page */
|
|
389
|
+
limit?: number;
|
|
390
|
+
/** Filter end user accounts by email or external ID */
|
|
391
|
+
search?: string;
|
|
392
|
+
/** Filter end user accounts by status. If not provided, all EUAs matching the search parameter will be returned, regardless of status */
|
|
393
|
+
statusFilter?: 'active' | 'expired';
|
|
394
|
+
}
|
|
395
|
+
interface ListEndUserAccountsResponse {
|
|
396
|
+
/** Array of end user accounts */
|
|
397
|
+
data: EndUserAccount[];
|
|
398
|
+
/** Token for retrieving the next page of results */
|
|
399
|
+
nextPageToken?: string;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Free/Busy types
|
|
404
|
+
*/
|
|
405
|
+
|
|
406
|
+
interface BusySlot {
|
|
407
|
+
/** Start date and time of the busy period */
|
|
408
|
+
start?: EventDateTime;
|
|
409
|
+
/** End date and time of the busy period */
|
|
410
|
+
end?: EventDateTime;
|
|
411
|
+
}
|
|
412
|
+
interface FreeBusySlot {
|
|
413
|
+
/** ID of the calendar these busy slots belong to */
|
|
414
|
+
calendarId: string;
|
|
415
|
+
/** Array of time slots when the calendar is busy */
|
|
416
|
+
busySlots?: BusySlot[];
|
|
417
|
+
}
|
|
418
|
+
type FreeBusyResponse = FreeBusySlot[];
|
|
419
|
+
interface GetFreeBusyInput {
|
|
420
|
+
/** ISO 8601 date-time representing the start of the time range to retrieve free/busy information for */
|
|
421
|
+
startDateTime: Date | string;
|
|
422
|
+
/** ISO 8601 date-time representing the end of the time range to retrieve free/busy information for */
|
|
423
|
+
endDateTime: Date | string;
|
|
424
|
+
/** Display all dates in the specified time zone */
|
|
425
|
+
timeZone: string;
|
|
426
|
+
/** Calendar IDs to retrieve free/busy information for */
|
|
427
|
+
calendarIds: string[];
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* OAuth types
|
|
432
|
+
*/
|
|
433
|
+
|
|
434
|
+
interface OAuthAuthorizeParams {
|
|
435
|
+
/** URL to redirect to after authorization completes */
|
|
436
|
+
redirectUrl?: string;
|
|
437
|
+
/** External identifier from your system to associate with this authorization */
|
|
438
|
+
externalId?: string;
|
|
439
|
+
/** Email hint to pre-fill the login form */
|
|
440
|
+
loginHint?: string;
|
|
441
|
+
/** OAuth prompt parameter */
|
|
442
|
+
prompt?: string;
|
|
443
|
+
/** State parameter */
|
|
444
|
+
state?: string;
|
|
445
|
+
}
|
|
446
|
+
interface OAuthAuthorizeUrlOptions {
|
|
447
|
+
/** Your application ID */
|
|
448
|
+
appId: string;
|
|
449
|
+
/** Calendar provider to authorize with */
|
|
450
|
+
provider: ProviderType;
|
|
451
|
+
/** Additional OAuth parameters */
|
|
452
|
+
params?: OAuthAuthorizeParams;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* Calendar Subscription types
|
|
457
|
+
*/
|
|
458
|
+
interface CalendarSubscription {
|
|
459
|
+
/** Unique identifier for the calendar subscription */
|
|
460
|
+
id: string;
|
|
461
|
+
/** ID of the end user account that owns this subscription */
|
|
462
|
+
endUserAccountId: string;
|
|
463
|
+
/** ID of the calendar being subscribed to (optional in case subscription is for all calendars) */
|
|
464
|
+
calendarId?: string | null;
|
|
465
|
+
/** URL where webhook notifications will be sent */
|
|
466
|
+
url: string;
|
|
467
|
+
/** Calendar provider */
|
|
468
|
+
provider: string;
|
|
469
|
+
/** Expiration date/time of the subscription in ISO 8601 format (optional) */
|
|
470
|
+
expiration?: string | null;
|
|
471
|
+
/** Provider-specific subscription identifier (optional) */
|
|
472
|
+
subscriptionId?: string | null;
|
|
473
|
+
/** Provider-specific resource identifier (optional) */
|
|
474
|
+
resourceId?: string | null;
|
|
475
|
+
/** Timestamp when the subscription was created in ISO 8601 format */
|
|
476
|
+
createdAt: string;
|
|
477
|
+
/** Timestamp when the subscription was last updated in ISO 8601 format */
|
|
478
|
+
updatedAt: string;
|
|
479
|
+
}
|
|
480
|
+
interface CreateCalendarSubscriptionInput {
|
|
481
|
+
/** The unique identifier of the Calendar to subscribe to (Optional, required for event subscriptions) */
|
|
482
|
+
calendarId?: string;
|
|
483
|
+
/** The URL where webhook notifications will be sent. Must be a valid HTTPS URL (Required) */
|
|
484
|
+
webhookUrl: string;
|
|
485
|
+
/** Rate limit for webhook delivery (messages per second). Minimum value is 1 (Optional, if not provided there will be no rate limit applied) */
|
|
486
|
+
rateLimit?: number;
|
|
487
|
+
/** Type of subscription: 'calendar' for calendar changes or 'event' for event changes (Required) */
|
|
488
|
+
subscriptionType: 'calendar' | 'event';
|
|
489
|
+
}
|
|
490
|
+
interface CreateCalendarSubscriptionResponse {
|
|
491
|
+
/** Unique identifier for the created webhook subscription */
|
|
492
|
+
webhookSubscriptionId: string;
|
|
493
|
+
/** Secret key for verifying webhook payload signatures */
|
|
494
|
+
endpointSecret: string;
|
|
495
|
+
}
|
|
496
|
+
interface ListCalendarSubscriptionsParams {
|
|
497
|
+
/** Pagination token for retrieving the next page of results */
|
|
498
|
+
pageToken?: string;
|
|
499
|
+
/** Maximum number of subscriptions to return per page */
|
|
500
|
+
limit?: number;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* Base HTTP client for making API requests
|
|
505
|
+
*/
|
|
506
|
+
|
|
507
|
+
declare class BaseClient {
|
|
508
|
+
private client;
|
|
509
|
+
private config;
|
|
510
|
+
constructor(config: UnifiedCalendarApiConfig);
|
|
511
|
+
private setupInterceptors;
|
|
512
|
+
get<T>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
513
|
+
post<T>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
|
|
514
|
+
put<T>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
|
|
515
|
+
patch<T>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
|
|
516
|
+
delete<T>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
517
|
+
buildUrl(path: string, params?: Record<string, any>): string;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Calendars resource client
|
|
522
|
+
*/
|
|
523
|
+
|
|
524
|
+
declare class Calendars {
|
|
525
|
+
private client;
|
|
526
|
+
constructor(client: BaseClient);
|
|
527
|
+
/**
|
|
528
|
+
* List all calendars for an end user account
|
|
529
|
+
* @param endUserAccountId - The end user account ID
|
|
530
|
+
* @param params - Optional pagination and filter parameters
|
|
531
|
+
*/
|
|
532
|
+
list(endUserAccountId: string, params?: ListCalendarsParams): Promise<PaginatedResponse<Calendar>>;
|
|
533
|
+
/**
|
|
534
|
+
* Get a specific calendar by ID
|
|
535
|
+
* @param endUserAccountId - The end user account ID
|
|
536
|
+
* @param calendarId - The calendar ID
|
|
537
|
+
*/
|
|
538
|
+
get(endUserAccountId: string, calendarId: string): Promise<Calendar>;
|
|
539
|
+
/**
|
|
540
|
+
* Create a new calendar
|
|
541
|
+
* @param endUserAccountId - The end user account ID
|
|
542
|
+
* @param data - Calendar creation data
|
|
543
|
+
*/
|
|
544
|
+
create(endUserAccountId: string, data: CreateCalendarInput): Promise<Calendar>;
|
|
545
|
+
/**
|
|
546
|
+
* Update a calendar
|
|
547
|
+
* @param endUserAccountId - The end user account ID
|
|
548
|
+
* @param calendarId - The calendar ID
|
|
549
|
+
* @param data - Calendar update data
|
|
550
|
+
*/
|
|
551
|
+
update(endUserAccountId: string, calendarId: string, data: UpdateCalendarInput): Promise<Calendar>;
|
|
552
|
+
/**
|
|
553
|
+
* Delete a calendar
|
|
554
|
+
* @param endUserAccountId - The end user account ID
|
|
555
|
+
* @param calendarId - The calendar ID
|
|
556
|
+
*/
|
|
557
|
+
delete(endUserAccountId: string, calendarId: string): Promise<{
|
|
558
|
+
success: boolean;
|
|
559
|
+
}>;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Events resource client
|
|
564
|
+
*/
|
|
565
|
+
|
|
566
|
+
declare class Events {
|
|
567
|
+
private client;
|
|
568
|
+
constructor(client: BaseClient);
|
|
569
|
+
/**
|
|
570
|
+
* List events in a calendar
|
|
571
|
+
* @param endUserAccountId - The end user account ID
|
|
572
|
+
* @param calendarId - The calendar ID
|
|
573
|
+
* @param params - Optional filter parameters
|
|
574
|
+
*/
|
|
575
|
+
list(endUserAccountId: string, calendarId: string, params?: ListEventsParams): Promise<PaginatedResponse<Event>>;
|
|
576
|
+
/**
|
|
577
|
+
* Get a specific event
|
|
578
|
+
* @param endUserAccountId - The end user account ID
|
|
579
|
+
* @param calendarId - The calendar ID
|
|
580
|
+
* @param eventId - The event ID
|
|
581
|
+
*/
|
|
582
|
+
get(endUserAccountId: string, calendarId: string, eventId: string): Promise<Event>;
|
|
583
|
+
/**
|
|
584
|
+
* Create a new event
|
|
585
|
+
* @param endUserAccountId - The end user account ID
|
|
586
|
+
* @param calendarId - The calendar ID
|
|
587
|
+
* @param data - Event creation data
|
|
588
|
+
*/
|
|
589
|
+
create(endUserAccountId: string, calendarId: string, data: CreateEventInput): Promise<Event>;
|
|
590
|
+
/**
|
|
591
|
+
* Update an event
|
|
592
|
+
* @param endUserAccountId - The end user account ID
|
|
593
|
+
* @param calendarId - The calendar ID
|
|
594
|
+
* @param eventId - The event ID
|
|
595
|
+
* @param data - Event update data
|
|
596
|
+
*/
|
|
597
|
+
update(endUserAccountId: string, calendarId: string, eventId: string, data: UpdateEventInput): Promise<Event>;
|
|
598
|
+
/**
|
|
599
|
+
* Delete an event
|
|
600
|
+
* @param endUserAccountId - The end user account ID
|
|
601
|
+
* @param calendarId - The calendar ID
|
|
602
|
+
* @param eventId - The event ID
|
|
603
|
+
*/
|
|
604
|
+
delete(endUserAccountId: string, calendarId: string, eventId: string): Promise<{
|
|
605
|
+
success: boolean;
|
|
606
|
+
}>;
|
|
607
|
+
/**
|
|
608
|
+
* Get event occurrences (for recurring events)
|
|
609
|
+
* @param endUserAccountId - The end user account ID
|
|
610
|
+
* @param calendarId - The calendar ID
|
|
611
|
+
* @param eventId - The event ID
|
|
612
|
+
* @param params - Optional filter parameters
|
|
613
|
+
*/
|
|
614
|
+
getOccurrences(endUserAccountId: string, calendarId: string, eventId: string, params?: ListEventsParams): Promise<PaginatedResponse<Event>>;
|
|
615
|
+
/**
|
|
616
|
+
* RSVP to an event
|
|
617
|
+
* @param endUserAccountId - The end user account ID
|
|
618
|
+
* @param calendarId - The calendar ID
|
|
619
|
+
* @param eventId - The event ID
|
|
620
|
+
* @param data - RSVP data with attendee response
|
|
621
|
+
*/
|
|
622
|
+
rsvp(endUserAccountId: string, calendarId: string, eventId: string, data: RSVPInput): Promise<Event>;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* End User Accounts resource client
|
|
627
|
+
*/
|
|
628
|
+
|
|
629
|
+
declare class EndUserAccounts {
|
|
630
|
+
private client;
|
|
631
|
+
constructor(client: BaseClient);
|
|
632
|
+
/**
|
|
633
|
+
* List all end user accounts
|
|
634
|
+
* @param params - Optional pagination and filter parameters
|
|
635
|
+
*/
|
|
636
|
+
list(params?: ListEndUserAccountsParams): Promise<ListEndUserAccountsResponse>;
|
|
637
|
+
/**
|
|
638
|
+
* Get a specific end user account
|
|
639
|
+
* @param id - The end user account ID
|
|
640
|
+
*/
|
|
641
|
+
get(id: string): Promise<EndUserAccount>;
|
|
642
|
+
/**
|
|
643
|
+
* Create a new end user account with credentials
|
|
644
|
+
* @param data - End user account creation data
|
|
645
|
+
*/
|
|
646
|
+
create(data: CreateEndUserAccountInput): Promise<EndUserAccount>;
|
|
647
|
+
/**
|
|
648
|
+
* Delete an end user account
|
|
649
|
+
* @param id - The end user account ID
|
|
650
|
+
*/
|
|
651
|
+
delete(id: string): Promise<{
|
|
652
|
+
success: boolean;
|
|
653
|
+
}>;
|
|
654
|
+
/**
|
|
655
|
+
* Get credentials for an end user account
|
|
656
|
+
* This will automatically refresh credentials if they are expired
|
|
657
|
+
* @param id - The end user account ID
|
|
658
|
+
*/
|
|
659
|
+
getCredentials(id: string): Promise<EndUserAccountCredential>;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* FreeBusy resource client
|
|
664
|
+
*/
|
|
665
|
+
|
|
666
|
+
declare class FreeBusy {
|
|
667
|
+
private client;
|
|
668
|
+
constructor(client: BaseClient);
|
|
669
|
+
/**
|
|
670
|
+
* Get free/busy information for calendars
|
|
671
|
+
* @param endUserAccountId - The end user account ID
|
|
672
|
+
* @param data - Free/busy query parameters
|
|
673
|
+
*/
|
|
674
|
+
get(endUserAccountId: string, data: GetFreeBusyInput): Promise<FreeBusyResponse>;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
/**
|
|
678
|
+
* Calendar Subscriptions resource client
|
|
679
|
+
*/
|
|
680
|
+
|
|
681
|
+
declare class CalendarSubscriptions {
|
|
682
|
+
private client;
|
|
683
|
+
constructor(client: BaseClient);
|
|
684
|
+
/**
|
|
685
|
+
* List calendar subscriptions for an end user account
|
|
686
|
+
* @param endUserAccountId - The end user account ID
|
|
687
|
+
* @param params - Optional pagination parameters
|
|
688
|
+
*/
|
|
689
|
+
list(endUserAccountId: string, params?: ListCalendarSubscriptionsParams): Promise<{
|
|
690
|
+
data: CalendarSubscription[];
|
|
691
|
+
nextPageToken?: string;
|
|
692
|
+
}>;
|
|
693
|
+
/**
|
|
694
|
+
* Create a calendar subscription
|
|
695
|
+
* @param endUserAccountId - The end user account ID
|
|
696
|
+
* @param data - Subscription data
|
|
697
|
+
*/
|
|
698
|
+
create(endUserAccountId: string, data: CreateCalendarSubscriptionInput): Promise<CreateCalendarSubscriptionResponse>;
|
|
699
|
+
/**
|
|
700
|
+
* Delete a calendar subscription
|
|
701
|
+
* @param endUserAccountId - The end user account ID
|
|
702
|
+
* @param subscriptionId - The subscription ID
|
|
703
|
+
*/
|
|
704
|
+
delete(endUserAccountId: string, subscriptionId: string): Promise<{
|
|
705
|
+
success: boolean;
|
|
706
|
+
}>;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* Main Unified Calendar API SDK client
|
|
711
|
+
*/
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* Unified Calendar API Client
|
|
715
|
+
*/
|
|
716
|
+
declare class UnifiedCalendarApi {
|
|
717
|
+
private baseClient;
|
|
718
|
+
/** Calendar operations */
|
|
719
|
+
readonly calendars: Calendars;
|
|
720
|
+
/** Event operations */
|
|
721
|
+
readonly events: Events;
|
|
722
|
+
/** End user account operations */
|
|
723
|
+
readonly endUserAccounts: EndUserAccounts;
|
|
724
|
+
/** Free/busy operations */
|
|
725
|
+
readonly freeBusy: FreeBusy;
|
|
726
|
+
/** Calendar subscription operations */
|
|
727
|
+
readonly calendarSubscriptions: CalendarSubscriptions;
|
|
728
|
+
/**
|
|
729
|
+
* Create a new Unified Calendar API client
|
|
730
|
+
* @param config - Configuration options
|
|
731
|
+
*/
|
|
732
|
+
constructor(config: UnifiedCalendarApiConfig);
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
/**
|
|
736
|
+
* Custom error classes for the UnifiedCalendarApi SDK
|
|
737
|
+
*/
|
|
738
|
+
/**
|
|
739
|
+
* Base error class for all UnifiedCalendarApi SDK errors
|
|
740
|
+
*/
|
|
741
|
+
declare class UnifiedCalendarApiError extends Error {
|
|
742
|
+
constructor(message: string);
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
* Error thrown when an API request fails
|
|
746
|
+
*/
|
|
747
|
+
declare class APIRequestError extends UnifiedCalendarApiError {
|
|
748
|
+
readonly status: number;
|
|
749
|
+
readonly code?: string;
|
|
750
|
+
readonly details?: Record<string, any>;
|
|
751
|
+
constructor(message: string, status: number, code?: string, details?: Record<string, any>);
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* Error thrown when input validation fails
|
|
755
|
+
*/
|
|
756
|
+
declare class ValidationError extends UnifiedCalendarApiError {
|
|
757
|
+
readonly errors: Record<string, string>;
|
|
758
|
+
constructor(message: string, errors?: Record<string, string>);
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* Error thrown when authentication fails
|
|
762
|
+
*/
|
|
763
|
+
declare class AuthenticationError extends APIRequestError {
|
|
764
|
+
constructor(message?: string);
|
|
765
|
+
}
|
|
766
|
+
/**
|
|
767
|
+
* Error thrown when authorization fails
|
|
768
|
+
*/
|
|
769
|
+
declare class AuthorizationError extends APIRequestError {
|
|
770
|
+
constructor(message?: string);
|
|
771
|
+
}
|
|
772
|
+
/**
|
|
773
|
+
* Error thrown when a resource is not found
|
|
774
|
+
*/
|
|
775
|
+
declare class NotFoundError extends APIRequestError {
|
|
776
|
+
constructor(message?: string);
|
|
777
|
+
}
|
|
778
|
+
/**
|
|
779
|
+
* Error thrown when rate limit is exceeded
|
|
780
|
+
*/
|
|
781
|
+
declare class RateLimitError extends APIRequestError {
|
|
782
|
+
readonly retryAfter?: number;
|
|
783
|
+
constructor(message?: string, retryAfter?: number);
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
export { type APIError, APIRequestError, type APIResponse, AuthenticationError, AuthorizationError, type BusySlot, type Calendar, type CalendarSubscription, CalendarSubscriptions, Calendars, type ConferenceData, type CreateCalendarInput, type CreateCalendarSubscriptionInput, type CreateCalendarSubscriptionResponse, type CreateEndUserAccountInput, type CreateEventInput, type EndUserAccount, type EndUserAccountCredential, EndUserAccountCredentialStatus, EndUserAccounts, type Event, type EventActor, type EventAttendee, EventColorId, type EventDateTime, EventOrderBy, type EventReminder, type EventReminders, Events, FreeBusy, type FreeBusyResponse, type FreeBusySlot, type GetFreeBusyInput, type ListCalendarSubscriptionsParams, type ListCalendarsParams, type ListEndUserAccountsParams, type ListEndUserAccountsResponse, type ListEventsParams, NotFoundError, type OAuthAuthorizeParams, type OAuthAuthorizeUrlOptions, type PaginatedResponse, type PaginationParams, ProviderType, type RSVPInput, RateLimitError, UnifiedCalendarApi, type UnifiedCalendarApiConfig, UnifiedCalendarApiError, type UpdateCalendarInput, type UpdateEventInput, ValidationError };
|