recal-sdk 0.2.8 → 0.2.10
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/README.md
CHANGED
|
@@ -273,7 +273,7 @@ await recal.calendar.deleteEventByMetaId(
|
|
|
273
273
|
|
|
274
274
|
```typescript
|
|
275
275
|
// Find available time slots (minimal config)
|
|
276
|
-
const availability = await recal.scheduling.
|
|
276
|
+
const availability = await recal.scheduling.user(
|
|
277
277
|
'user_id',
|
|
278
278
|
new Date('2024-01-15'),
|
|
279
279
|
new Date('2024-01-20'),
|
|
@@ -283,7 +283,7 @@ const availability = await recal.scheduling.userSchedulingBasic(
|
|
|
283
283
|
)
|
|
284
284
|
|
|
285
285
|
// Or with more options
|
|
286
|
-
const availabilityDetailed = await recal.scheduling.
|
|
286
|
+
const availabilityDetailed = await recal.scheduling.user(
|
|
287
287
|
'user_id',
|
|
288
288
|
new Date('2024-01-15'),
|
|
289
289
|
new Date('2024-01-20'),
|
|
@@ -298,6 +298,26 @@ const availabilityDetailed = await recal.scheduling.userSchedulingBasic(
|
|
|
298
298
|
)
|
|
299
299
|
```
|
|
300
300
|
|
|
301
|
+
#### Allow Overlapping Events
|
|
302
|
+
|
|
303
|
+
```typescript
|
|
304
|
+
// Find availability even when user already has events scheduled
|
|
305
|
+
const availabilityWithOverlaps = await recal.scheduling.user(
|
|
306
|
+
'user_id',
|
|
307
|
+
new Date('2024-01-15'),
|
|
308
|
+
new Date('2024-01-20'),
|
|
309
|
+
{
|
|
310
|
+
slotDuration: 30,
|
|
311
|
+
maxOverlaps: 2, // Allow up to 2 overlapping events per slot
|
|
312
|
+
timeZone: 'America/New_York'
|
|
313
|
+
}
|
|
314
|
+
)
|
|
315
|
+
|
|
316
|
+
// maxOverlaps: 2, means 1 slot is still available even if the user has 2 existing events at the same time.
|
|
317
|
+
// This enables booking a n concurrent events - useful for optional meetings,
|
|
318
|
+
// tentative invites, or users who can handle multiple events simultaneous, like a team that has just one calendar.
|
|
319
|
+
```
|
|
320
|
+
|
|
301
321
|
#### Get User Availability (Advanced)
|
|
302
322
|
|
|
303
323
|
```typescript
|
|
@@ -312,7 +332,7 @@ const schedules = [
|
|
|
312
332
|
]
|
|
313
333
|
|
|
314
334
|
// Minimal config
|
|
315
|
-
const availability = await recal.scheduling.
|
|
335
|
+
const availability = await recal.scheduling.userAdvanced(
|
|
316
336
|
'user_id',
|
|
317
337
|
schedules,
|
|
318
338
|
new Date('2024-01-15'),
|
|
@@ -321,7 +341,7 @@ const availability = await recal.scheduling.userSchedulingAdvanced(
|
|
|
321
341
|
)
|
|
322
342
|
|
|
323
343
|
// Or with more options
|
|
324
|
-
const availabilityDetailed = await recal.scheduling.
|
|
344
|
+
const availabilityDetailed = await recal.scheduling.userAdvanced(
|
|
325
345
|
'user_id',
|
|
326
346
|
schedules,
|
|
327
347
|
new Date('2024-01-15'),
|
|
@@ -339,7 +359,7 @@ const availabilityDetailed = await recal.scheduling.userSchedulingAdvanced(
|
|
|
339
359
|
|
|
340
360
|
```typescript
|
|
341
361
|
// Find organization-wide available time slots (minimal)
|
|
342
|
-
const orgAvailability = await recal.scheduling.
|
|
362
|
+
const orgAvailability = await recal.scheduling.organization(
|
|
343
363
|
'org-slug',
|
|
344
364
|
new Date('2024-01-15'),
|
|
345
365
|
new Date('2024-01-20'),
|
|
@@ -347,7 +367,7 @@ const orgAvailability = await recal.scheduling.getOrgWideAvailability(
|
|
|
347
367
|
)
|
|
348
368
|
|
|
349
369
|
// Or with constraints
|
|
350
|
-
const orgAvailabilityConstrained = await recal.scheduling.
|
|
370
|
+
const orgAvailabilityConstrained = await recal.scheduling.organization(
|
|
351
371
|
'org-slug',
|
|
352
372
|
new Date('2024-01-15'),
|
|
353
373
|
new Date('2024-01-20'),
|
|
@@ -512,7 +532,7 @@ const linkWithOptions = await recal.oauth.getLink(
|
|
|
512
532
|
'user_id',
|
|
513
533
|
'google',
|
|
514
534
|
{
|
|
515
|
-
scope: 'edit', // 'edit' or 'free-busy' (for OAuth scopes)
|
|
535
|
+
scope: ['edit'], // 'edit' or 'free-busy' (for OAuth scopes)
|
|
516
536
|
accessType: 'offline', // 'offline' or 'online'
|
|
517
537
|
redirectUrl: 'https://app.example.com/callback' // optional
|
|
518
538
|
}
|
|
@@ -531,7 +551,7 @@ const linksFiltered = await recal.oauth.getBulkLinks(
|
|
|
531
551
|
'user_id',
|
|
532
552
|
{
|
|
533
553
|
provider: ['google', 'microsoft'],
|
|
534
|
-
scope: 'edit',
|
|
554
|
+
scope: ['edit'],
|
|
535
555
|
accessType: 'offline'
|
|
536
556
|
}
|
|
537
557
|
)
|
|
@@ -560,7 +580,7 @@ const connection = await recal.oauth.setConnection(
|
|
|
560
580
|
{
|
|
561
581
|
accessToken: 'access_token',
|
|
562
582
|
refreshToken: 'refresh_token', // optional
|
|
563
|
-
scope: ['
|
|
583
|
+
scope: ['edit'],
|
|
564
584
|
expiresAt: new Date('2024-12-31'), // optional
|
|
565
585
|
email: 'user@example.com' // optional
|
|
566
586
|
}
|
|
@@ -577,7 +597,7 @@ await recal.oauth.disconnect('user_id', 'google')
|
|
|
577
597
|
const result = await recal.oauth.verify(
|
|
578
598
|
'google',
|
|
579
599
|
'auth_code_from_callback',
|
|
580
|
-
'edit', // 'edit' or 'free-busy' - single scope, not array
|
|
600
|
+
['edit'], // 'edit' or 'free-busy' - single scope, not array
|
|
581
601
|
'state_parameter',
|
|
582
602
|
'https://app.example.com/callback' // optional
|
|
583
603
|
)
|
|
@@ -678,7 +698,7 @@ const recal = new RecalClient({
|
|
|
678
698
|
|
|
679
699
|
```typescript
|
|
680
700
|
// 1. Check availability
|
|
681
|
-
const availability = await recal.scheduling.
|
|
701
|
+
const availability = await recal.scheduling.user(
|
|
682
702
|
'consultant_id',
|
|
683
703
|
new Date(),
|
|
684
704
|
new Date(Date.now() + 7 * 24 * 60 * 60 * 1000), // Next 7 days
|
|
@@ -27,7 +27,7 @@ export declare class OAuthService {
|
|
|
27
27
|
*/
|
|
28
28
|
getBulkLinks(userId: string, options?: {
|
|
29
29
|
provider?: Provider | Provider[];
|
|
30
|
-
scope?: 'edit' | 'free-busy';
|
|
30
|
+
scope?: ('edit' | 'free-busy')[];
|
|
31
31
|
accessType?: 'offline' | 'online';
|
|
32
32
|
}): Promise<OAuthLink[]>;
|
|
33
33
|
/**
|
|
@@ -38,7 +38,7 @@ export declare class OAuthService {
|
|
|
38
38
|
* @returns The OAuth authorization URL
|
|
39
39
|
*/
|
|
40
40
|
getLink(userId: string, provider: Provider, options?: {
|
|
41
|
-
scope?: 'edit' | 'free-busy';
|
|
41
|
+
scope?: ('edit' | 'free-busy')[];
|
|
42
42
|
accessType?: 'offline' | 'online';
|
|
43
43
|
redirectUrl?: string;
|
|
44
44
|
}): Promise<OAuthLink>;
|
|
@@ -69,7 +69,7 @@ export declare class OAuthService {
|
|
|
69
69
|
verify({ provider, code, scope, state, redirectUrl, }: {
|
|
70
70
|
provider: Provider;
|
|
71
71
|
code: string;
|
|
72
|
-
scope: 'edit' | 'free-busy';
|
|
72
|
+
scope: ('edit' | 'free-busy')[];
|
|
73
73
|
state: string;
|
|
74
74
|
redirectUrl?: string;
|
|
75
75
|
}): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.service.d.ts","sourceRoot":"","sources":["../../src/services/oauth.service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAC5F,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAExE,qBAAa,YAAY;IACT,OAAO,CAAC,WAAW;gBAAX,WAAW,EAAE,WAAW;IAE5C;;;;;OAKG;IACU,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,UAAO,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAS3F;;;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