recal-sdk 1.0.1 → 1.2.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.
Files changed (46) hide show
  1. package/README.md +102 -21
  2. package/dist/client/sdk.gen.d.ts +41 -41
  3. package/dist/client/sdk.gen.d.ts.map +1 -1
  4. package/dist/client/sdk.gen.js +131 -131
  5. package/dist/client/sdk.gen.js.map +1 -1
  6. package/dist/client/transformers.gen.d.ts +25 -25
  7. package/dist/client/transformers.gen.d.ts.map +1 -1
  8. package/dist/client/transformers.gen.js +51 -26
  9. package/dist/client/transformers.gen.js.map +1 -1
  10. package/dist/client/types.gen.d.ts +830 -238
  11. package/dist/client/types.gen.d.ts.map +1 -1
  12. package/dist/client/zod.gen.d.ts +357 -118
  13. package/dist/client/zod.gen.d.ts.map +1 -1
  14. package/dist/client/zod.gen.js +235 -180
  15. package/dist/client/zod.gen.js.map +1 -1
  16. package/dist/services/calendar.service.d.ts +12 -5
  17. package/dist/services/calendar.service.d.ts.map +1 -1
  18. package/dist/services/calendar.service.js +10 -6
  19. package/dist/services/calendar.service.js.map +1 -1
  20. package/dist/services/events.service.d.ts +2 -2
  21. package/dist/services/events.service.d.ts.map +1 -1
  22. package/dist/services/events.service.js +8 -8
  23. package/dist/services/events.service.js.map +1 -1
  24. package/dist/services/oauth.service.d.ts +7 -7
  25. package/dist/services/oauth.service.d.ts.map +1 -1
  26. package/dist/services/oauth.service.js +8 -8
  27. package/dist/services/oauth.service.js.map +1 -1
  28. package/dist/services/organizations.service.d.ts +35 -17
  29. package/dist/services/organizations.service.d.ts.map +1 -1
  30. package/dist/services/organizations.service.js +23 -11
  31. package/dist/services/organizations.service.js.map +1 -1
  32. package/dist/services/scheduling.service.d.ts +15 -7
  33. package/dist/services/scheduling.service.d.ts.map +1 -1
  34. package/dist/services/scheduling.service.js +34 -3
  35. package/dist/services/scheduling.service.js.map +1 -1
  36. package/dist/services/users.service.d.ts +2 -2
  37. package/dist/services/users.service.d.ts.map +1 -1
  38. package/dist/services/users.service.js +4 -4
  39. package/dist/services/users.service.js.map +1 -1
  40. package/dist/types.d.ts +27 -5
  41. package/dist/types.d.ts.map +1 -1
  42. package/dist/utils/response.d.ts +10 -0
  43. package/dist/utils/response.d.ts.map +1 -1
  44. package/dist/utils/response.js +20 -0
  45. package/dist/utils/response.js.map +1 -1
  46. package/package.json +3 -3
@@ -43,6 +43,7 @@ export const zAuthConnection = z.object({
43
43
  'microsoft'
44
44
  ]),
45
45
  scope: z.array(z.string()),
46
+ type: z.string(),
46
47
  accessToken: z.optional(z.unknown()),
47
48
  refreshToken: z.optional(z.unknown())
48
49
  });
@@ -57,6 +58,42 @@ export const zTimeRange = z.object({
57
58
  offset: true
58
59
  }).regex(/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))(T((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([,.]\d+(?!:))?)?(\17[0-5]\d([,.]\d+)?)?([Zz]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/)
59
60
  });
61
+ /**
62
+ * Why a calendar or a user could not be read. What each value means and how to resolve it: https://docs.recal.dev/core/troubleshooting
63
+ */
64
+ export const zFreeBusyFailureReason = z.enum([
65
+ 'accessDenied',
66
+ 'authorizationInvalid',
67
+ 'insufficientScopes',
68
+ 'invalidCalendarId',
69
+ 'mailboxUnavailable',
70
+ 'notFound',
71
+ 'providerError',
72
+ 'providerNotConfigured',
73
+ 'rateLimited',
74
+ 'tooManyCalendars'
75
+ ]);
76
+ /**
77
+ * A calendar that could not be read
78
+ */
79
+ export const zFailedCalendar = z.object({
80
+ calendarId: z.string(),
81
+ message: z.string(),
82
+ provider: z.enum([
83
+ 'google',
84
+ 'microsoft'
85
+ ]),
86
+ reason: zFreeBusyFailureReason
87
+ });
88
+ /**
89
+ * A user whose busy times are missing (failedCalendars empty) or incomplete (failedCalendars names the gaps)
90
+ */
91
+ export const zFailedFreeBusyUser = z.object({
92
+ customId: z.string(),
93
+ failedCalendars: z.array(zFailedCalendar),
94
+ message: z.string(),
95
+ reason: zFreeBusyFailureReason
96
+ });
60
97
  /**
61
98
  * Recal Normalized Calendar
62
99
  */
@@ -75,6 +112,7 @@ export const zCalendar = z.object({
75
112
  ])),
76
113
  backgroundColor: z.optional(z.string()),
77
114
  foregroundColor: z.optional(z.string()),
115
+ primary: z.optional(z.boolean()),
78
116
  selected: z.optional(z.boolean()),
79
117
  subject: z.optional(z.string()),
80
118
  timeZone: z.optional(z.string().regex(/^([A-Za-z_]+(?:\/[A-Za-z_]+){1,2}|UTC)$/))
@@ -251,13 +289,13 @@ export const zGetV1OrganizationsResponse = z.object({
251
289
  data: z.array(zOrganization)
252
290
  });
253
291
  export const zPostV1OrganizationsData = z.object({
254
- body: z.optional(z.object({
292
+ body: z.object({
255
293
  name: z.union([
256
294
  z.string().min(3).max(128),
257
295
  z.null()
258
296
  ]),
259
297
  slug: z.string().regex(/^[a-z0-9][a-z0-9_-]{2,127}$/)
260
- })),
298
+ }),
261
299
  path: z.optional(z.never()),
262
300
  query: z.optional(z.never())
263
301
  });
@@ -267,7 +305,7 @@ export const zPostV1OrganizationsData = z.object({
267
305
  export const zPostV1OrganizationsResponse = z.object({
268
306
  data: zOrganization
269
307
  });
270
- export const zDeleteV1OrganizationsOrgSlugData = z.object({
308
+ export const zDeleteV1OrganizationsByOrgSlugData = z.object({
271
309
  body: z.optional(z.never()),
272
310
  path: z.object({
273
311
  orgSlug: z.string().regex(/^[a-z0-9][a-z0-9_-]{2,127}$/)
@@ -277,10 +315,10 @@ export const zDeleteV1OrganizationsOrgSlugData = z.object({
277
315
  /**
278
316
  * Deleted organization
279
317
  */
280
- export const zDeleteV1OrganizationsOrgSlugResponse = z.object({
318
+ export const zDeleteV1OrganizationsByOrgSlugResponse = z.object({
281
319
  data: zOrganization
282
320
  });
283
- export const zGetV1OrganizationsOrgSlugData = z.object({
321
+ export const zGetV1OrganizationsByOrgSlugData = z.object({
284
322
  body: z.optional(z.never()),
285
323
  path: z.object({
286
324
  orgSlug: z.string().regex(/^[a-z0-9][a-z0-9_-]{2,127}$/)
@@ -290,17 +328,17 @@ export const zGetV1OrganizationsOrgSlugData = z.object({
290
328
  /**
291
329
  * Organization
292
330
  */
293
- export const zGetV1OrganizationsOrgSlugResponse = z.object({
331
+ export const zGetV1OrganizationsByOrgSlugResponse = z.object({
294
332
  data: zOrganization
295
333
  });
296
- export const zPutV1OrganizationsOrgSlugData = z.object({
297
- body: z.optional(z.object({
334
+ export const zPutV1OrganizationsByOrgSlugData = z.object({
335
+ body: z.object({
298
336
  name: z.union([
299
337
  z.string().min(3).max(128),
300
338
  z.null()
301
339
  ]),
302
340
  slug: z.string().regex(/^[a-z0-9][a-z0-9_-]{2,127}$/)
303
- })),
341
+ }),
304
342
  path: z.object({
305
343
  orgSlug: z.string().regex(/^[a-z0-9][a-z0-9_-]{2,127}$/)
306
344
  }),
@@ -309,22 +347,22 @@ export const zPutV1OrganizationsOrgSlugData = z.object({
309
347
  /**
310
348
  * Updated organization
311
349
  */
312
- export const zPutV1OrganizationsOrgSlugResponse = z.object({
350
+ export const zPutV1OrganizationsByOrgSlugResponse = z.object({
313
351
  data: zOrganization
314
352
  });
315
- export const zDeleteV1OrganizationsOrgSlugMembersData = z.object({
316
- body: z.optional(z.object({
353
+ export const zDeleteV1OrganizationsByOrgSlugMembersData = z.object({
354
+ body: z.object({
317
355
  userIds: z.array(z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{2,127}$/))
318
- })),
356
+ }),
319
357
  path: z.object({
320
358
  orgSlug: z.string().regex(/^[a-z0-9][a-z0-9_-]{2,127}$/)
321
359
  }),
322
360
  query: z.optional(z.never())
323
361
  });
324
- export const zDeleteV1OrganizationsOrgSlugMembersResponse = z.object({
362
+ export const zDeleteV1OrganizationsByOrgSlugMembersResponse = z.object({
325
363
  data: z.string()
326
364
  });
327
- export const zGetV1OrganizationsOrgSlugMembersData = z.object({
365
+ export const zGetV1OrganizationsByOrgSlugMembersData = z.object({
328
366
  body: z.optional(z.never()),
329
367
  path: z.object({
330
368
  orgSlug: z.string().regex(/^[a-z0-9][a-z0-9_-]{2,127}$/)
@@ -343,7 +381,7 @@ export const zGetV1OrganizationsOrgSlugMembersData = z.object({
343
381
  /**
344
382
  * All members of an organization
345
383
  */
346
- export const zGetV1OrganizationsOrgSlugMembersResponse = z.object({
384
+ export const zGetV1OrganizationsByOrgSlugMembersResponse = z.object({
347
385
  data: z.array(z.object({
348
386
  createdAt: z.iso.datetime({
349
387
  offset: true
@@ -353,16 +391,16 @@ export const zGetV1OrganizationsOrgSlugMembersResponse = z.object({
353
391
  organizations: z.optional(z.array(zOrganization))
354
392
  }))
355
393
  });
356
- export const zPostV1OrganizationsOrgSlugMembersData = z.object({
357
- body: z.optional(z.object({
394
+ export const zPostV1OrganizationsByOrgSlugMembersData = z.object({
395
+ body: z.object({
358
396
  userIds: z.array(z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{2,127}$/))
359
- })),
397
+ }),
360
398
  path: z.object({
361
399
  orgSlug: z.string().regex(/^[a-z0-9][a-z0-9_-]{2,127}$/)
362
400
  }),
363
401
  query: z.optional(z.never())
364
402
  });
365
- export const zPostV1OrganizationsOrgSlugMembersResponse = z.union([
403
+ export const zPostV1OrganizationsByOrgSlugMembersResponse = z.union([
366
404
  z.object({
367
405
  data: z.string()
368
406
  }),
@@ -370,7 +408,7 @@ export const zPostV1OrganizationsOrgSlugMembersResponse = z.union([
370
408
  data: z.string()
371
409
  })
372
410
  ]);
373
- export const zGetV1OrganizationsOrgSlugCalendarBusyData = z.object({
411
+ export const zGetV1OrganizationsByOrgSlugCalendarBusyData = z.object({
374
412
  body: z.optional(z.never()),
375
413
  path: z.object({
376
414
  orgSlug: z.string().regex(/^[a-z0-9][a-z0-9_-]{2,127}$/)
@@ -393,33 +431,24 @@ export const zGetV1OrganizationsOrgSlugCalendarBusyData = z.object({
393
431
  })
394
432
  });
395
433
  /**
396
- * Busy times of all users of an organization
434
+ * Busy times of all users of an organization, plus the users that could not be read
397
435
  */
398
- export const zGetV1OrganizationsOrgSlugCalendarBusyResponse = z.object({
399
- data: z.array(zTimeRange)
436
+ export const zGetV1OrganizationsByOrgSlugCalendarBusyResponse = z.object({
437
+ data: z.array(zTimeRange),
438
+ failedUsers: z.array(zFailedFreeBusyUser)
400
439
  });
401
- export const zGetV1OrganizationsOrgSlugSchedulingData = z.object({
440
+ export const zGetV1OrganizationsByOrgSlugSchedulingData = z.object({
402
441
  body: z.optional(z.never()),
403
442
  path: z.object({
404
443
  orgSlug: z.string().regex(/^[a-z0-9][a-z0-9_-]{2,127}$/)
405
444
  }),
406
445
  query: z.object({
407
446
  end: z.string().regex(/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))(T((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([,.]\d+(?!:))?)?(\17[0-5]\d([,.]\d+)?)?([Zz]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/),
408
- padding: z.union([
409
- z.string().regex(/^(?:(?!^-0$)-?(?:(?:0|[1-9]\d*)))$/),
410
- z.unknown()
411
- ]),
412
- slotDuration: z.union([
413
- z.string().regex(/^(?:(?!^-0$)-?(?:(?:0|[1-9]\d*)))$/),
414
- z.unknown()
415
- ]),
416
447
  start: z.string().regex(/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))(T((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([,.]\d+(?!:))?)?(\17[0-5]\d([,.]\d+)?)?([Zz]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/),
417
448
  earliestTimeEachDay: z.optional(z.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/)),
418
449
  latestTimeEachDay: z.optional(z.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/)),
419
- maxOverlaps: z.optional(z.union([
420
- z.string().regex(/^(?:(?!^-0$)-?(?:(?:0|[1-9]\d*)))$/),
421
- z.unknown()
422
- ])),
450
+ maxOverlaps: z.optional(z.string().regex(/^(?:(?!^-0$)-?(?:(?:0|[1-9]\d*)))$/)).default('0'),
451
+ padding: z.optional(z.string().regex(/^(?:(?!^-0$)-?(?:(?:0|[1-9]\d*)))$/)).default('0'),
423
452
  provider: z.optional(z.union([
424
453
  z.array(z.enum([
425
454
  'google',
@@ -427,13 +456,14 @@ export const zGetV1OrganizationsOrgSlugSchedulingData = z.object({
427
456
  ])),
428
457
  z.literal('google'),
429
458
  z.literal('microsoft')
430
- ]))
459
+ ])),
460
+ slotDuration: z.optional(z.string().regex(/^(?:(?!^-0$)-?(?:(?:0|[1-9]\d*)))$/)).default('30')
431
461
  })
432
462
  });
433
463
  /**
434
- * Available time slots
464
+ * Available time slots, plus the users that could not be read
435
465
  */
436
- export const zGetV1OrganizationsOrgSlugSchedulingResponse = z.object({
466
+ export const zGetV1OrganizationsByOrgSlugSchedulingResponse = z.object({
437
467
  data: z.object({
438
468
  availableSlots: z.array(z.object({
439
469
  end: z.iso.datetime({
@@ -457,7 +487,8 @@ export const zGetV1OrganizationsOrgSlugSchedulingResponse = z.object({
457
487
  earliestTimeEachDay: z.optional(z.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/)),
458
488
  latestTimeEachDay: z.optional(z.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/))
459
489
  })
460
- })
490
+ }),
491
+ failedUsers: z.array(zFailedFreeBusyUser)
461
492
  });
462
493
  export const zGetV1UsersData = z.object({
463
494
  body: z.optional(z.never()),
@@ -478,10 +509,10 @@ export const zGetV1UsersResponse = z.object({
478
509
  }))
479
510
  });
480
511
  export const zPostV1UsersData = z.object({
481
- body: z.optional(z.object({
512
+ body: z.object({
482
513
  id: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{2,127}$/),
483
514
  organizationSlugs: z.optional(z.array(z.string().regex(/^[a-z0-9][a-z0-9_-]{2,127}$/)))
484
- })),
515
+ }),
485
516
  path: z.optional(z.never()),
486
517
  query: z.optional(z.never())
487
518
  });
@@ -498,7 +529,7 @@ export const zPostV1UsersResponse = z.object({
498
529
  organizations: z.optional(z.array(zOrganization))
499
530
  })
500
531
  });
501
- export const zDeleteV1UsersUserIdData = z.object({
532
+ export const zDeleteV1UsersByUserIdData = z.object({
502
533
  body: z.optional(z.never()),
503
534
  path: z.object({
504
535
  userId: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{2,127}$/)
@@ -508,7 +539,7 @@ export const zDeleteV1UsersUserIdData = z.object({
508
539
  /**
509
540
  * User
510
541
  */
511
- export const zDeleteV1UsersUserIdResponse = z.object({
542
+ export const zDeleteV1UsersByUserIdResponse = z.object({
512
543
  data: z.object({
513
544
  createdAt: z.iso.datetime({
514
545
  offset: true
@@ -518,7 +549,7 @@ export const zDeleteV1UsersUserIdResponse = z.object({
518
549
  organizations: z.optional(z.array(zOrganization))
519
550
  })
520
551
  });
521
- export const zGetV1UsersUserIdData = z.object({
552
+ export const zGetV1UsersByUserIdData = z.object({
522
553
  body: z.optional(z.never()),
523
554
  path: z.object({
524
555
  userId: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{2,127}$/)
@@ -537,7 +568,7 @@ export const zGetV1UsersUserIdData = z.object({
537
568
  /**
538
569
  * User
539
570
  */
540
- export const zGetV1UsersUserIdResponse = z.object({
571
+ export const zGetV1UsersByUserIdResponse = z.object({
541
572
  data: z.object({
542
573
  createdAt: z.iso.datetime({
543
574
  offset: true
@@ -547,10 +578,10 @@ export const zGetV1UsersUserIdResponse = z.object({
547
578
  organizations: z.optional(z.array(zOrganization))
548
579
  })
549
580
  });
550
- export const zPutV1UsersUserIdData = z.object({
551
- body: z.optional(z.object({
581
+ export const zPutV1UsersByUserIdData = z.object({
582
+ body: z.object({
552
583
  userId: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{2,127}$/)
553
- })),
584
+ }),
554
585
  path: z.object({
555
586
  userId: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{2,127}$/)
556
587
  }),
@@ -559,7 +590,7 @@ export const zPutV1UsersUserIdData = z.object({
559
590
  /**
560
591
  * User
561
592
  */
562
- export const zPutV1UsersUserIdResponse = z.object({
593
+ export const zPutV1UsersByUserIdResponse = z.object({
563
594
  data: z.object({
564
595
  createdAt: z.iso.datetime({
565
596
  offset: true
@@ -569,7 +600,7 @@ export const zPutV1UsersUserIdResponse = z.object({
569
600
  organizations: z.optional(z.array(zOrganization))
570
601
  })
571
602
  });
572
- export const zGetV1UsersUserIdOrganizationsData = z.object({
603
+ export const zGetV1UsersByUserIdOrganizationsData = z.object({
573
604
  body: z.optional(z.never()),
574
605
  path: z.object({
575
606
  userId: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{2,127}$/)
@@ -579,10 +610,10 @@ export const zGetV1UsersUserIdOrganizationsData = z.object({
579
610
  /**
580
611
  * List of organizations
581
612
  */
582
- export const zGetV1UsersUserIdOrganizationsResponse = z.object({
613
+ export const zGetV1UsersByUserIdOrganizationsResponse = z.object({
583
614
  data: z.array(zOrganization)
584
615
  });
585
- export const zGetV1UsersUserIdCalendarData = z.object({
616
+ export const zGetV1UsersByUserIdCalendarData = z.object({
586
617
  body: z.optional(z.never()),
587
618
  path: z.object({
588
619
  userId: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{2,127}$/)
@@ -601,10 +632,10 @@ export const zGetV1UsersUserIdCalendarData = z.object({
601
632
  /**
602
633
  * List of calendars
603
634
  */
604
- export const zGetV1UsersUserIdCalendarResponse = z.object({
635
+ export const zGetV1UsersByUserIdCalendarResponse = z.object({
605
636
  data: z.array(zCalendar)
606
637
  });
607
- export const zGetV1UsersUserIdCalendarBusyData = z.object({
638
+ export const zGetV1UsersByUserIdCalendarBusyData = z.object({
608
639
  body: z.optional(z.never()),
609
640
  path: z.object({
610
641
  userId: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{2,127}$/)
@@ -612,7 +643,10 @@ export const zGetV1UsersUserIdCalendarBusyData = z.object({
612
643
  query: z.object({
613
644
  end: z.string().regex(/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))(T((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([,.]\d+(?!:))?)?(\17[0-5]\d([,.]\d+)?)?([Zz]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/),
614
645
  start: z.string().regex(/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))(T((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([,.]\d+(?!:))?)?(\17[0-5]\d([,.]\d+)?)?([Zz]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/),
615
- calendarIds: z.optional(z.array(z.string())),
646
+ calendarIds: z.optional(z.union([
647
+ z.string(),
648
+ z.array(z.string())
649
+ ])),
616
650
  provider: z.optional(z.union([
617
651
  z.array(z.enum([
618
652
  'google',
@@ -624,12 +658,13 @@ export const zGetV1UsersUserIdCalendarBusyData = z.object({
624
658
  })
625
659
  });
626
660
  /**
627
- * List of busy intervals
661
+ * List of busy intervals, plus the calendars that could not be read
628
662
  */
629
- export const zGetV1UsersUserIdCalendarBusyResponse = z.object({
630
- data: z.array(zTimeRange)
663
+ export const zGetV1UsersByUserIdCalendarBusyResponse = z.object({
664
+ data: z.array(zTimeRange),
665
+ failedCalendars: z.array(zFailedCalendar)
631
666
  });
632
- export const zGetV1UsersUserIdCalendarEventsData = z.object({
667
+ export const zGetV1UsersByUserIdCalendarEventsData = z.object({
633
668
  body: z.optional(z.never()),
634
669
  path: z.object({
635
670
  userId: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{2,127}$/)
@@ -637,7 +672,10 @@ export const zGetV1UsersUserIdCalendarEventsData = z.object({
637
672
  query: z.object({
638
673
  end: z.string().regex(/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))(T((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([,.]\d+(?!:))?)?(\17[0-5]\d([,.]\d+)?)?([Zz]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/),
639
674
  start: z.string().regex(/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))(T((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([,.]\d+(?!:))?)?(\17[0-5]\d([,.]\d+)?)?([Zz]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/),
640
- calendarIds: z.optional(z.array(z.string())),
675
+ calendarIds: z.optional(z.union([
676
+ z.string(),
677
+ z.array(z.string())
678
+ ])),
641
679
  provider: z.optional(z.union([
642
680
  z.array(z.enum([
643
681
  'google',
@@ -651,11 +689,11 @@ export const zGetV1UsersUserIdCalendarEventsData = z.object({
651
689
  /**
652
690
  * List of events
653
691
  */
654
- export const zGetV1UsersUserIdCalendarEventsResponse = z.object({
692
+ export const zGetV1UsersByUserIdCalendarEventsResponse = z.object({
655
693
  data: z.array(zEvent)
656
694
  });
657
- export const zPostV1UsersUserIdCalendarEventsMetaData = z.object({
658
- body: z.optional(zCreateMetaEvent),
695
+ export const zPostV1UsersByUserIdCalendarEventsMetaData = z.object({
696
+ body: zCreateMetaEvent,
659
697
  path: z.object({
660
698
  userId: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{2,127}$/)
661
699
  }),
@@ -673,10 +711,10 @@ export const zPostV1UsersUserIdCalendarEventsMetaData = z.object({
673
711
  /**
674
712
  * Meta event created
675
713
  */
676
- export const zPostV1UsersUserIdCalendarEventsMetaResponse = z.object({
714
+ export const zPostV1UsersByUserIdCalendarEventsMetaResponse = z.object({
677
715
  data: zMetaEvent
678
716
  });
679
- export const zDeleteV1UsersUserIdCalendarEventsMetaMetaIdData = z.object({
717
+ export const zDeleteV1UsersByUserIdCalendarEventsMetaByMetaIdData = z.object({
680
718
  body: z.optional(z.never()),
681
719
  path: z.object({
682
720
  metaId: z.string(),
@@ -696,12 +734,12 @@ export const zDeleteV1UsersUserIdCalendarEventsMetaMetaIdData = z.object({
696
734
  /**
697
735
  * Meta event deleted
698
736
  */
699
- export const zDeleteV1UsersUserIdCalendarEventsMetaMetaIdResponse = z.object({
737
+ export const zDeleteV1UsersByUserIdCalendarEventsMetaByMetaIdResponse = z.object({
700
738
  data: z.object({
701
739
  success: z.literal(true)
702
740
  })
703
741
  });
704
- export const zGetV1UsersUserIdCalendarEventsMetaMetaIdData = z.object({
742
+ export const zGetV1UsersByUserIdCalendarEventsMetaByMetaIdData = z.object({
705
743
  body: z.optional(z.never()),
706
744
  path: z.object({
707
745
  metaId: z.string(),
@@ -721,11 +759,11 @@ export const zGetV1UsersUserIdCalendarEventsMetaMetaIdData = z.object({
721
759
  /**
722
760
  * Event
723
761
  */
724
- export const zGetV1UsersUserIdCalendarEventsMetaMetaIdResponse = z.object({
762
+ export const zGetV1UsersByUserIdCalendarEventsMetaByMetaIdResponse = z.object({
725
763
  data: zMetaEvent
726
764
  });
727
- export const zPutV1UsersUserIdCalendarEventsMetaMetaIdData = z.object({
728
- body: z.optional(zUpdateMetaEvent),
765
+ export const zPutV1UsersByUserIdCalendarEventsMetaByMetaIdData = z.object({
766
+ body: zUpdateMetaEvent,
729
767
  path: z.object({
730
768
  metaId: z.string(),
731
769
  userId: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{2,127}$/)
@@ -744,11 +782,11 @@ export const zPutV1UsersUserIdCalendarEventsMetaMetaIdData = z.object({
744
782
  /**
745
783
  * Meta event updated
746
784
  */
747
- export const zPutV1UsersUserIdCalendarEventsMetaMetaIdResponse = z.object({
785
+ export const zPutV1UsersByUserIdCalendarEventsMetaByMetaIdResponse = z.object({
748
786
  data: zMetaEvent
749
787
  });
750
- export const zPostV1UsersUserIdCalendarEventsProviderCalendarIdData = z.object({
751
- body: z.optional(zCreateEvent),
788
+ export const zPostV1UsersByUserIdCalendarEventsByProviderByCalendarIdData = z.object({
789
+ body: zCreateEvent,
752
790
  path: z.object({
753
791
  calendarId: z.string(),
754
792
  provider: z.enum([
@@ -762,10 +800,10 @@ export const zPostV1UsersUserIdCalendarEventsProviderCalendarIdData = z.object({
762
800
  /**
763
801
  * Event created
764
802
  */
765
- export const zPostV1UsersUserIdCalendarEventsProviderCalendarIdResponse = z.object({
803
+ export const zPostV1UsersByUserIdCalendarEventsByProviderByCalendarIdResponse = z.object({
766
804
  data: zEvent
767
805
  });
768
- export const zDeleteV1UsersUserIdCalendarEventsProviderCalendarIdEventIdData = z.object({
806
+ export const zDeleteV1UsersByUserIdCalendarEventsByProviderByCalendarIdByEventIdData = z.object({
769
807
  body: z.optional(z.never()),
770
808
  path: z.object({
771
809
  calendarId: z.string(),
@@ -781,12 +819,12 @@ export const zDeleteV1UsersUserIdCalendarEventsProviderCalendarIdEventIdData = z
781
819
  /**
782
820
  * Event deleted
783
821
  */
784
- export const zDeleteV1UsersUserIdCalendarEventsProviderCalendarIdEventIdResponse = z.object({
822
+ export const zDeleteV1UsersByUserIdCalendarEventsByProviderByCalendarIdByEventIdResponse = z.object({
785
823
  data: z.object({
786
824
  success: z.literal(true)
787
825
  })
788
826
  });
789
- export const zGetV1UsersUserIdCalendarEventsProviderCalendarIdEventIdData = z.object({
827
+ export const zGetV1UsersByUserIdCalendarEventsByProviderByCalendarIdByEventIdData = z.object({
790
828
  body: z.optional(z.never()),
791
829
  path: z.object({
792
830
  calendarId: z.string(),
@@ -802,11 +840,11 @@ export const zGetV1UsersUserIdCalendarEventsProviderCalendarIdEventIdData = z.ob
802
840
  /**
803
841
  * Event found
804
842
  */
805
- export const zGetV1UsersUserIdCalendarEventsProviderCalendarIdEventIdResponse = z.object({
843
+ export const zGetV1UsersByUserIdCalendarEventsByProviderByCalendarIdByEventIdResponse = z.object({
806
844
  data: zEvent
807
845
  });
808
- export const zPutV1UsersUserIdCalendarEventsProviderCalendarIdEventIdData = z.object({
809
- body: z.optional(zUpdateEvent),
846
+ export const zPutV1UsersByUserIdCalendarEventsByProviderByCalendarIdByEventIdData = z.object({
847
+ body: zUpdateEvent,
810
848
  path: z.object({
811
849
  calendarId: z.string(),
812
850
  eventId: z.string(),
@@ -821,10 +859,10 @@ export const zPutV1UsersUserIdCalendarEventsProviderCalendarIdEventIdData = z.ob
821
859
  /**
822
860
  * Event updated
823
861
  */
824
- export const zPutV1UsersUserIdCalendarEventsProviderCalendarIdEventIdResponse = z.object({
862
+ export const zPutV1UsersByUserIdCalendarEventsByProviderByCalendarIdByEventIdResponse = z.object({
825
863
  data: zEvent
826
864
  });
827
- export const zGetV1UsersUserIdOauthData = z.object({
865
+ export const zGetV1UsersByUserIdOauthData = z.object({
828
866
  body: z.optional(z.never()),
829
867
  path: z.object({
830
868
  userId: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{2,127}$/)
@@ -839,10 +877,10 @@ export const zGetV1UsersUserIdOauthData = z.object({
839
877
  /**
840
878
  * All oauth connections of the user
841
879
  */
842
- export const zGetV1UsersUserIdOauthResponse = z.object({
880
+ export const zGetV1UsersByUserIdOauthResponse = z.object({
843
881
  data: z.array(zAuthConnection)
844
882
  });
845
- export const zGetV1UsersUserIdOauthLinksData = z.object({
883
+ export const zGetV1UsersByUserIdOauthLinksData = z.object({
846
884
  body: z.optional(z.never()),
847
885
  path: z.object({
848
886
  userId: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{2,127}$/)
@@ -855,7 +893,9 @@ export const zGetV1UsersUserIdOauthLinksData = z.object({
855
893
  scope: z.union([
856
894
  z.array(z.string()),
857
895
  z.literal('edit'),
858
- z.literal('free-busy')
896
+ z.literal('free-busy'),
897
+ z.literal('read'),
898
+ z.literal('write')
859
899
  ]),
860
900
  provider: z.optional(z.union([
861
901
  z.array(z.enum([
@@ -870,7 +910,7 @@ export const zGetV1UsersUserIdOauthLinksData = z.object({
870
910
  /**
871
911
  * Auth urls for the oauth providers
872
912
  */
873
- export const zGetV1UsersUserIdOauthLinksResponse = z.object({
913
+ export const zGetV1UsersByUserIdOauthLinksResponse = z.object({
874
914
  data: z.array(z.object({
875
915
  link: z.url(),
876
916
  provider: z.enum([
@@ -879,7 +919,7 @@ export const zGetV1UsersUserIdOauthLinksResponse = z.object({
879
919
  ])
880
920
  }))
881
921
  });
882
- export const zGetV1UsersUserIdOauthProviderLinkData = z.object({
922
+ export const zGetV1UsersByUserIdOauthByProviderLinkData = z.object({
883
923
  body: z.optional(z.never()),
884
924
  path: z.object({
885
925
  provider: z.enum([
@@ -896,7 +936,9 @@ export const zGetV1UsersUserIdOauthProviderLinkData = z.object({
896
936
  scope: z.union([
897
937
  z.array(z.string()),
898
938
  z.literal('edit'),
899
- z.literal('free-busy')
939
+ z.literal('free-busy'),
940
+ z.literal('read'),
941
+ z.literal('write')
900
942
  ]),
901
943
  redirectUrl: z.optional(z.url())
902
944
  })
@@ -904,17 +946,17 @@ export const zGetV1UsersUserIdOauthProviderLinkData = z.object({
904
946
  /**
905
947
  * Auth url for the oauth provider
906
948
  */
907
- export const zGetV1UsersUserIdOauthProviderLinkResponse = z.object({
949
+ export const zGetV1UsersByUserIdOauthByProviderLinkResponse = z.object({
908
950
  data: z.object({
909
951
  link: z.url()
910
952
  })
911
953
  });
912
- export const zPostV1UsersOauthProviderVerifyData = z.object({
913
- body: z.optional(z.object({
954
+ export const zPostV1UsersOauthByProviderVerifyData = z.object({
955
+ body: z.object({
914
956
  code: z.string(),
915
957
  scope: z.array(z.string()),
916
958
  state: z.string()
917
- })),
959
+ }),
918
960
  path: z.object({
919
961
  provider: z.enum([
920
962
  'google',
@@ -925,7 +967,7 @@ export const zPostV1UsersOauthProviderVerifyData = z.object({
925
967
  redirectUrl: z.optional(z.url())
926
968
  }))
927
969
  });
928
- export const zDeleteV1UsersUserIdOauthProviderData = z.object({
970
+ export const zDeleteV1UsersByUserIdOauthByProviderData = z.object({
929
971
  body: z.optional(z.never()),
930
972
  path: z.object({
931
973
  provider: z.enum([
@@ -936,7 +978,7 @@ export const zDeleteV1UsersUserIdOauthProviderData = z.object({
936
978
  }),
937
979
  query: z.optional(z.never())
938
980
  });
939
- export const zGetV1UsersUserIdOauthProviderData = z.object({
981
+ export const zGetV1UsersByUserIdOauthByProviderData = z.object({
940
982
  body: z.optional(z.never()),
941
983
  path: z.object({
942
984
  provider: z.enum([
@@ -955,11 +997,11 @@ export const zGetV1UsersUserIdOauthProviderData = z.object({
955
997
  /**
956
998
  * OAuth connection of the user
957
999
  */
958
- export const zGetV1UsersUserIdOauthProviderResponse = z.object({
1000
+ export const zGetV1UsersByUserIdOauthByProviderResponse = z.object({
959
1001
  data: zAuthConnection
960
1002
  });
961
- export const zPostV1UsersUserIdOauthProviderData = z.object({
962
- body: z.optional(z.object({
1003
+ export const zPostV1UsersByUserIdOauthByProviderData = z.object({
1004
+ body: z.object({
963
1005
  accessToken: z.string(),
964
1006
  email: z.union([
965
1007
  z.email().regex(/^[\w%+.-]+@[\d.A-Za-z-]+\.[A-Za-z]{2,}$/),
@@ -974,7 +1016,7 @@ export const zPostV1UsersUserIdOauthProviderData = z.object({
974
1016
  z.unknown()
975
1017
  ]),
976
1018
  scope: z.array(z.string())
977
- })),
1019
+ }),
978
1020
  path: z.object({
979
1021
  provider: z.enum([
980
1022
  'google',
@@ -987,10 +1029,10 @@ export const zPostV1UsersUserIdOauthProviderData = z.object({
987
1029
  /**
988
1030
  * OAuth connection created
989
1031
  */
990
- export const zPostV1UsersUserIdOauthProviderResponse = z.object({
1032
+ export const zPostV1UsersByUserIdOauthByProviderResponse = z.object({
991
1033
  data: zAuthConnection
992
1034
  });
993
- export const zGetV1UsersUserIdOauthProviderTokenData = z.object({
1035
+ export const zGetV1UsersByUserIdOauthByProviderTokenData = z.object({
994
1036
  body: z.optional(z.never()),
995
1037
  path: z.object({
996
1038
  provider: z.enum([
@@ -1004,33 +1046,23 @@ export const zGetV1UsersUserIdOauthProviderTokenData = z.object({
1004
1046
  /**
1005
1047
  * Access token
1006
1048
  */
1007
- export const zGetV1UsersUserIdOauthProviderTokenResponse = z.object({
1049
+ export const zGetV1UsersByUserIdOauthByProviderTokenResponse = z.object({
1008
1050
  data: z.object({
1009
1051
  accessToken: z.string()
1010
1052
  })
1011
1053
  });
1012
- export const zGetV1UsersUserIdSchedulingData = z.object({
1054
+ export const zGetV1UsersByUserIdSchedulingData = z.object({
1013
1055
  body: z.optional(z.never()),
1014
1056
  path: z.object({
1015
1057
  userId: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{2,127}$/)
1016
1058
  }),
1017
1059
  query: z.object({
1018
1060
  end: z.string().regex(/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))(T((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([,.]\d+(?!:))?)?(\17[0-5]\d([,.]\d+)?)?([Zz]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/),
1019
- padding: z.union([
1020
- z.string().regex(/^(?:(?!^-0$)-?(?:(?:0|[1-9]\d*)))$/),
1021
- z.unknown()
1022
- ]),
1023
- slotDuration: z.union([
1024
- z.string().regex(/^(?:(?!^-0$)-?(?:(?:0|[1-9]\d*)))$/),
1025
- z.unknown()
1026
- ]),
1027
1061
  start: z.string().regex(/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))(T((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([,.]\d+(?!:))?)?(\17[0-5]\d([,.]\d+)?)?([Zz]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/),
1028
1062
  earliestTimeEachDay: z.optional(z.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/)),
1029
1063
  latestTimeEachDay: z.optional(z.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/)),
1030
- maxOverlaps: z.optional(z.union([
1031
- z.string().regex(/^(?:(?!^-0$)-?(?:(?:0|[1-9]\d*)))$/),
1032
- z.unknown()
1033
- ])),
1064
+ maxOverlaps: z.optional(z.string().regex(/^(?:(?!^-0$)-?(?:(?:0|[1-9]\d*)))$/)).default('0'),
1065
+ padding: z.optional(z.string().regex(/^(?:(?!^-0$)-?(?:(?:0|[1-9]\d*)))$/)).default('0'),
1034
1066
  provider: z.optional(z.union([
1035
1067
  z.array(z.enum([
1036
1068
  'google',
@@ -1038,13 +1070,14 @@ export const zGetV1UsersUserIdSchedulingData = z.object({
1038
1070
  ])),
1039
1071
  z.literal('google'),
1040
1072
  z.literal('microsoft')
1041
- ]))
1073
+ ])),
1074
+ slotDuration: z.optional(z.string().regex(/^(?:(?!^-0$)-?(?:(?:0|[1-9]\d*)))$/)).default('30')
1042
1075
  })
1043
1076
  });
1044
1077
  /**
1045
1078
  * Available time slots
1046
1079
  */
1047
- export const zGetV1UsersUserIdSchedulingResponse = z.object({
1080
+ export const zGetV1UsersByUserIdSchedulingResponse = z.object({
1048
1081
  data: z.object({
1049
1082
  availableSlots: z.array(zTimeRange),
1050
1083
  options: z.object({
@@ -1062,8 +1095,8 @@ export const zGetV1UsersUserIdSchedulingResponse = z.object({
1062
1095
  })
1063
1096
  })
1064
1097
  });
1065
- export const zPostV1UsersUserIdSchedulingData = z.object({
1066
- body: z.optional(z.object({
1098
+ export const zPostV1UsersByUserIdSchedulingData = z.object({
1099
+ body: z.object({
1067
1100
  schedules: z.array(z.object({
1068
1101
  days: z.array(z.enum([
1069
1102
  'friday',
@@ -1077,25 +1110,15 @@ export const zPostV1UsersUserIdSchedulingData = z.object({
1077
1110
  end: z.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/),
1078
1111
  start: z.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/)
1079
1112
  }))
1080
- })),
1113
+ }),
1081
1114
  path: z.object({
1082
1115
  userId: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{2,127}$/)
1083
1116
  }),
1084
1117
  query: z.object({
1085
1118
  end: z.string().regex(/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))(T((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([,.]\d+(?!:))?)?(\17[0-5]\d([,.]\d+)?)?([Zz]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/),
1086
- padding: z.union([
1087
- z.string().regex(/^(?:(?!^-0$)-?(?:(?:0|[1-9]\d*)))$/),
1088
- z.unknown()
1089
- ]),
1090
- slotDuration: z.union([
1091
- z.string().regex(/^(?:(?!^-0$)-?(?:(?:0|[1-9]\d*)))$/),
1092
- z.unknown()
1093
- ]),
1094
1119
  start: z.string().regex(/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))(T((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([,.]\d+(?!:))?)?(\17[0-5]\d([,.]\d+)?)?([Zz]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/),
1095
- maxOverlaps: z.optional(z.union([
1096
- z.string().regex(/^(?:(?!^-0$)-?(?:(?:0|[1-9]\d*)))$/),
1097
- z.unknown()
1098
- ])),
1120
+ maxOverlaps: z.optional(z.string().regex(/^(?:(?!^-0$)-?(?:(?:0|[1-9]\d*)))$/)).default('0'),
1121
+ padding: z.optional(z.string().regex(/^(?:(?!^-0$)-?(?:(?:0|[1-9]\d*)))$/)).default('0'),
1099
1122
  provider: z.optional(z.union([
1100
1123
  z.array(z.enum([
1101
1124
  'google',
@@ -1103,13 +1126,14 @@ export const zPostV1UsersUserIdSchedulingData = z.object({
1103
1126
  ])),
1104
1127
  z.literal('google'),
1105
1128
  z.literal('microsoft')
1106
- ]))
1129
+ ])),
1130
+ slotDuration: z.optional(z.string().regex(/^(?:(?!^-0$)-?(?:(?:0|[1-9]\d*)))$/)).default('30')
1107
1131
  })
1108
1132
  });
1109
1133
  /**
1110
1134
  * Available time slots
1111
1135
  */
1112
- export const zPostV1UsersUserIdSchedulingResponse = z.object({
1136
+ export const zPostV1UsersByUserIdSchedulingResponse = z.object({
1113
1137
  data: z.object({
1114
1138
  availableSlots: z.array(zTimeRange),
1115
1139
  options: z.object({
@@ -1128,41 +1152,49 @@ export const zPostV1UsersUserIdSchedulingResponse = z.object({
1128
1152
  })
1129
1153
  });
1130
1154
  export const zPostV1UsersSchedulingData = z.object({
1131
- body: z.optional(z.object({
1155
+ body: z.object({
1132
1156
  users: z.array(z.object({
1133
1157
  id: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{2,127}$/),
1134
- calendarIds: z.optional(z.array(z.string())),
1135
- schedules: z.optional(z.array(z.object({
1136
- days: z.array(z.enum([
1137
- 'friday',
1138
- 'monday',
1139
- 'saturday',
1140
- 'sunday',
1141
- 'thursday',
1142
- 'tuesday',
1143
- 'wednesday'
1144
- ])),
1145
- end: z.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/),
1146
- start: z.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/)
1147
- })))
1158
+ calendarIds: z.optional(z.union([
1159
+ z.string(),
1160
+ z.array(z.string())
1161
+ ])),
1162
+ schedules: z.optional(z.union([
1163
+ z.object({
1164
+ days: z.array(z.enum([
1165
+ 'friday',
1166
+ 'monday',
1167
+ 'saturday',
1168
+ 'sunday',
1169
+ 'thursday',
1170
+ 'tuesday',
1171
+ 'wednesday'
1172
+ ])),
1173
+ end: z.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/),
1174
+ start: z.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/)
1175
+ }),
1176
+ z.array(z.object({
1177
+ days: z.array(z.enum([
1178
+ 'friday',
1179
+ 'monday',
1180
+ 'saturday',
1181
+ 'sunday',
1182
+ 'thursday',
1183
+ 'tuesday',
1184
+ 'wednesday'
1185
+ ])),
1186
+ end: z.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/),
1187
+ start: z.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/)
1188
+ }))
1189
+ ]))
1148
1190
  }))
1149
- })),
1191
+ }),
1150
1192
  path: z.optional(z.never()),
1151
1193
  query: z.object({
1152
1194
  end: z.string().regex(/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))(T((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([,.]\d+(?!:))?)?(\17[0-5]\d([,.]\d+)?)?([Zz]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/),
1153
- padding: z.union([
1154
- z.string().regex(/^(?:(?!^-0$)-?(?:(?:0|[1-9]\d*)))$/),
1155
- z.unknown()
1156
- ]),
1157
- slotDuration: z.union([
1158
- z.string().regex(/^(?:(?!^-0$)-?(?:(?:0|[1-9]\d*)))$/),
1159
- z.unknown()
1160
- ]),
1161
1195
  start: z.string().regex(/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))(T((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([,.]\d+(?!:))?)?(\17[0-5]\d([,.]\d+)?)?([Zz]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/),
1162
- maxOverlaps: z.optional(z.union([
1163
- z.string().regex(/^(?:(?!^-0$)-?(?:(?:0|[1-9]\d*)))$/),
1164
- z.unknown()
1165
- ])),
1196
+ maxOverlaps: z.optional(z.string().regex(/^(?:(?!^-0$)-?(?:(?:0|[1-9]\d*)))$/)).default('0'),
1197
+ padding: z.optional(z.string().regex(/^(?:(?!^-0$)-?(?:(?:0|[1-9]\d*)))$/)).default('0'),
1166
1198
  provider: z.optional(z.union([
1167
1199
  z.array(z.enum([
1168
1200
  'google',
@@ -1170,16 +1202,18 @@ export const zPostV1UsersSchedulingData = z.object({
1170
1202
  ])),
1171
1203
  z.literal('google'),
1172
1204
  z.literal('microsoft')
1173
- ]))
1205
+ ])),
1206
+ slotDuration: z.optional(z.string().regex(/^(?:(?!^-0$)-?(?:(?:0|[1-9]\d*)))$/)).default('30')
1174
1207
  })
1175
1208
  });
1176
1209
  /**
1177
- * Available time slots for each user
1210
+ * Available time slots for each user, plus the calendars that could not be read
1178
1211
  */
1179
1212
  export const zPostV1UsersSchedulingResponse = z.object({
1180
1213
  data: z.array(z.union([
1181
1214
  z.object({
1182
1215
  availableSlots: z.array(zTimeRange),
1216
+ failedCalendars: z.array(zFailedCalendar),
1183
1217
  options: z.object({
1184
1218
  end: z.iso.datetime({
1185
1219
  offset: true
@@ -1193,25 +1227,46 @@ export const zPostV1UsersSchedulingResponse = z.object({
1193
1227
  earliestTimeEachDay: z.optional(z.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/)),
1194
1228
  latestTimeEachDay: z.optional(z.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/))
1195
1229
  }),
1230
+ status: z.literal('ok'),
1196
1231
  userId: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{2,127}$/),
1197
- calendarIds: z.optional(z.array(z.string())),
1198
- schedules: z.optional(z.array(z.object({
1199
- days: z.array(z.enum([
1200
- 'friday',
1201
- 'monday',
1202
- 'saturday',
1203
- 'sunday',
1204
- 'thursday',
1205
- 'tuesday',
1206
- 'wednesday'
1207
- ])),
1208
- end: z.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/),
1209
- start: z.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/)
1210
- })))
1232
+ calendarIds: z.optional(z.union([
1233
+ z.string(),
1234
+ z.array(z.string())
1235
+ ])),
1236
+ schedules: z.optional(z.union([
1237
+ z.object({
1238
+ days: z.array(z.enum([
1239
+ 'friday',
1240
+ 'monday',
1241
+ 'saturday',
1242
+ 'sunday',
1243
+ 'thursday',
1244
+ 'tuesday',
1245
+ 'wednesday'
1246
+ ])),
1247
+ end: z.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/),
1248
+ start: z.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/)
1249
+ }),
1250
+ z.array(z.object({
1251
+ days: z.array(z.enum([
1252
+ 'friday',
1253
+ 'monday',
1254
+ 'saturday',
1255
+ 'sunday',
1256
+ 'thursday',
1257
+ 'tuesday',
1258
+ 'wednesday'
1259
+ ])),
1260
+ end: z.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/),
1261
+ start: z.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/)
1262
+ }))
1263
+ ]))
1211
1264
  }),
1212
1265
  z.object({
1213
1266
  error: z.string(),
1214
- userId: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{2,127}$/)
1267
+ status: z.literal('error'),
1268
+ userId: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{2,127}$/),
1269
+ reason: z.optional(zFreeBusyFailureReason)
1215
1270
  })
1216
1271
  ]))
1217
1272
  });