@chronary/sdk 0.9.0 → 0.11.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.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  /**
2
- * APIPromise wraps a fetch call as a thenable so callers can `await` it
3
- * for parsed data, or call `.withResponse()` to get both parsed data and the raw
4
- * Response (headers, status, etc.).
2
+ * APIPromise wraps a request as a `Promise` so callers can `await` it for the
3
+ * parsed data, or call `.withResponse()` to get both the parsed data and the
4
+ * raw response (status, headers, quota). Every single-request resource method
5
+ * returns one.
5
6
  *
6
7
  * ```ts
7
8
  * // Normal — just the data
@@ -11,6 +12,7 @@
11
12
  * const { data, response } = await client.agents.get('agt_1').withResponse();
12
13
  * console.log(response.status);
13
14
  * console.log(response.headers.get('x-request-id'));
15
+ * console.log(response.quota?.remaining);
14
16
  * ```
15
17
  */
16
18
  /**
@@ -43,24 +45,43 @@ interface WithResponse<T> {
43
45
  response: RawResponse;
44
46
  }
45
47
  /**
46
- * APIPromise is a thenable that resolves to `T` when awaited, but also
47
- * exposes `.withResponse()` to get both the data and raw HTTP response.
48
+ * APIPromise is a `Promise<T>` that resolves to the parsed body when awaited,
49
+ * and also exposes `.withResponse()` to get both the data and the raw HTTP
50
+ * response. Every single-request resource method returns one; the
51
+ * auto-paginating `list()` helpers return a `PageIterator` instead, since they
52
+ * may make several requests.
48
53
  *
49
- * Because it implements `.then()`, it can be awaited, used with `Promise.all()`,
50
- * and chained with `.then()` / `.catch()` / `.finally()`.
54
+ * It is a real `Promise` subclass, so it can be awaited, passed to
55
+ * `Promise.all()`, assigned to a `Promise<T>`, and chained with
56
+ * `.then()` / `.catch()` / `.finally()`.
51
57
  */
52
- declare class APIPromise<T> implements PromiseLike<T> {
53
- private innerPromise;
58
+ declare class APIPromise<T> extends Promise<T> {
59
+ private readonly responsePromise;
60
+ private parsedPromise;
54
61
  constructor(responsePromise: Promise<{
55
62
  data: T;
56
63
  rawResponse: RawResponse;
57
64
  }>);
65
+ /**
66
+ * Derived promises (the result of `.then()` and friends) are plain
67
+ * `Promise`s, so the custom constructor above is never invoked with an
68
+ * executor.
69
+ */
70
+ static get [Symbol.species](): PromiseConstructor;
58
71
  /**
59
72
  * Returns both the parsed data and the raw HTTP response.
60
73
  */
61
74
  withResponse(): Promise<WithResponse<T>>;
62
75
  /**
63
- * Implements the thenable interface. When awaited, resolves to just the parsed data `T`.
76
+ * Maps the parsed data while keeping the raw response, so a resource method
77
+ * that post-processes the body still supports `.withResponse()`.
78
+ *
79
+ * @internal
80
+ */
81
+ _thenUnwrap<U>(transform: (data: T) => U): APIPromise<U>;
82
+ private parse;
83
+ /**
84
+ * When awaited, resolves to just the parsed data `T`.
64
85
  */
65
86
  then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
66
87
  /**
@@ -152,6 +173,7 @@ interface ListAgentsParams {
152
173
  /** Add `calendar_count` and `scoped_key_count` to each agent. */
153
174
  include_counts?: boolean;
154
175
  limit?: number;
176
+ /** Rows to skip, at most 10000; page deeper with `cursor` where the list has it. */
155
177
  offset?: number;
156
178
  }
157
179
  interface Calendar {
@@ -193,6 +215,7 @@ interface ListCalendarsParams {
193
215
  /** Case-insensitive substring of the calendar name, or an exact calendar id. Org-wide list only (not with `agentId`). */
194
216
  q?: string;
195
217
  limit?: number;
218
+ /** Rows to skip, at most 10000; page deeper with `cursor` where the list has it. */
196
219
  offset?: number;
197
220
  }
198
221
  interface BookingPage {
@@ -242,6 +265,7 @@ interface UpdateBookingPageParams {
242
265
  }
243
266
  interface ListBookingPagesParams {
244
267
  limit?: number;
268
+ /** Rows to skip, at most 10000; page deeper with `cursor` where the list has it. */
245
269
  offset?: number;
246
270
  /** Only pages bound to this calendar. */
247
271
  calendar_id?: string;
@@ -327,10 +351,25 @@ interface CalendarEvent {
327
351
  recurrenceRule: string | null;
328
352
  /** ISO 8601 starts of individually cancelled occurrences (EXDATE). */
329
353
  recurrenceExdates: string[];
354
+ /** IANA time zone the recurring series repeats in (e.g. "America/Los_Angeles"). null = UTC. */
355
+ timezone: string | null;
330
356
  /** Present only on expanded instances (`expand: true` lists): id of the recurring series master this instance belongs to. */
331
357
  recurringEventId?: string;
332
358
  /** Present only on expanded instances: the occurrence start this instance was generated for. */
333
359
  originalStartTime?: string;
360
+ /** Present only on expanded instances: local start in the series' time zone (`YYYY-MM-DDTHH:mm:ss`, no offset). */
361
+ startLocal?: string;
362
+ /** Present only on expanded instances: UTC offset of `startLocal` (e.g. "-08:00"). */
363
+ utcOffset?: string;
364
+ /** Present only on expanded instances: `"gap"` when a DST gap moved the local start forward, else null. */
365
+ dstAdjusted?: 'gap' | null;
366
+ /**
367
+ * Present only on update responses that moved a recurring series (changed
368
+ * `start_time`, `recurrence_rule` or `timezone`): cancelled occurrences
369
+ * (exdates) with no occurrence left on the same local date, so they were
370
+ * dropped. Ask the user and re-cancel with `occurrence_start` if needed.
371
+ */
372
+ droppedExdates?: string[];
334
373
  holdExpiresAt: string | null;
335
374
  /** Hold conflict priority (0-100). Never null: 0 unless set on a hold. */
336
375
  holdPriority: number;
@@ -361,6 +400,13 @@ interface CreateEventParams {
361
400
  * or ends more than 90 days out on the free plan (Pro allows unbounded).
362
401
  */
363
402
  recurrence_rule?: string;
403
+ /**
404
+ * IANA time zone the recurring series repeats in, e.g. "America/Los_Angeles".
405
+ * The pattern repeats on local wall time (a weekly 16:00 stays 16:00 across
406
+ * daylight-saving changes); BYDAY and a date-only UNTIL are read in this
407
+ * zone. Omit for UTC. All-day events ignore it.
408
+ */
409
+ timezone?: string;
364
410
  }
365
411
  interface UpdateEventParams {
366
412
  title?: string;
@@ -383,6 +429,15 @@ interface UpdateEventParams {
383
429
  * unbounded).
384
430
  */
385
431
  recurrence_rule?: string | null;
432
+ /**
433
+ * Set or change the IANA time zone the series repeats in, or null for UTC.
434
+ * Validated together with `recurrence_rule` and `start_time` on the merged
435
+ * event, so a UTC series can move to local time in one call. Changing
436
+ * `start_time`, `recurrence_rule` or `timezone` keeps each cancelled
437
+ * occurrence on its local date; any with no match come back in
438
+ * `droppedExdates`.
439
+ */
440
+ timezone?: string | null;
386
441
  }
387
442
  interface ListEventsParams {
388
443
  calendarId?: string;
@@ -392,6 +447,7 @@ interface ListEventsParams {
392
447
  status?: EventStatus;
393
448
  source?: 'internal' | 'external_ical';
394
449
  limit?: number;
450
+ /** Rows to skip, at most 10000; page deeper with `cursor` where the list has it. */
395
451
  offset?: number;
396
452
  /**
397
453
  * Expand recurring series into individual occurrence instances within the
@@ -421,6 +477,7 @@ interface ListOrgEventsParams {
421
477
  expand?: boolean;
422
478
  /** Page size, at most 100. */
423
479
  limit?: number;
480
+ /** Rows to skip, at most 10000; page deeper with `cursor` where the list has it. */
424
481
  offset?: number;
425
482
  }
426
483
  /** Options for event delete calls — `RequestOptions` plus recurrence controls. */
@@ -448,6 +505,7 @@ interface BusyBlock {
448
505
  }
449
506
  interface AvailabilityParams {
450
507
  start: string;
508
+ /** At most the plan's max date range after `start` (30 days on Free); longer is a `ValidationError`. */
451
509
  end: string;
452
510
  /** Requested slot length. Preferred over `slot_duration`. */
453
511
  duration?: SlotDuration;
@@ -465,6 +523,7 @@ interface CrossAgentAvailabilityParams {
465
523
  duration?: SlotDuration;
466
524
  /** @deprecated Use `duration` instead. */
467
525
  slot_duration?: SlotDuration;
526
+ /** Extra calendars whose busy time also blocks slots, at most 50. */
468
527
  calendars?: string[];
469
528
  include_busy?: boolean;
470
529
  /** Return slots from usable stale human-calendar cache. Defaults false (fail closed). */
@@ -606,6 +665,7 @@ interface UpdateWebhookParams {
606
665
  }
607
666
  interface ListWebhooksParams {
608
667
  limit?: number;
668
+ /** Rows to skip, at most 10000; page deeper with `cursor` where the list has it. */
609
669
  offset?: number;
610
670
  }
611
671
  /**
@@ -735,6 +795,7 @@ interface ListICalSubscriptionsParams {
735
795
  agentId?: string;
736
796
  status?: 'active' | 'error' | 'paused';
737
797
  limit?: number;
798
+ /** Rows to skip, at most 10000; page deeper with `cursor` where the list has it. */
738
799
  offset?: number;
739
800
  }
740
801
  /**
@@ -800,6 +861,7 @@ interface ListProposalsParams {
800
861
  status?: ProposalStatus;
801
862
  organizer_agent_id?: string;
802
863
  limit?: number;
864
+ /** Rows to skip, at most 10000; page deeper with `cursor` where the list has it. */
803
865
  offset?: number;
804
866
  }
805
867
  type ResolveProposalResponse = {
@@ -877,6 +939,14 @@ interface HoldsUsage {
877
939
  interface CrossCalendarQueriesUsage {
878
940
  used: number;
879
941
  }
942
+ /**
943
+ * Active agent-scoped (`chr_ak_*`) keys. `count` is a direct count (the name
944
+ * predates the plan cap); `limit` is the plan cap (`null` = unlimited).
945
+ */
946
+ interface ScopedKeysUsage {
947
+ count: number;
948
+ limit: number | null;
949
+ }
880
950
  interface Usage {
881
951
  period_start: string;
882
952
  period_end: string;
@@ -889,7 +959,10 @@ interface Usage {
889
959
  calendars: UsageMetric;
890
960
  events: UsageMetric;
891
961
  api_calls: UsageMetric;
962
+ /** Webhook deliveries this month. */
892
963
  webhooks: UsageMetric;
964
+ /** Registered webhook endpoints vs. the plan cap (null = unlimited). */
965
+ webhook_endpoints: UsageMetric;
893
966
  availability_queries: UsageMetric;
894
967
  ical_subscriptions: UsageMetric;
895
968
  proposals: UsageMetric;
@@ -897,6 +970,8 @@ interface Usage {
897
970
  recurring_events: UsageMetric;
898
971
  /** Active booking pages vs. the plan cap (free: 1, Pro: 25; null = unlimited). */
899
972
  booking_pages: UsageMetric;
973
+ /** Active agent-scoped keys vs. the plan cap. */
974
+ scoped_keys: ScopedKeysUsage;
900
975
  holds: HoldsUsage;
901
976
  cross_calendar_queries: CrossCalendarQueriesUsage;
902
977
  }
@@ -1373,11 +1448,11 @@ declare class AgentsClient {
1373
1448
  * Register your agent with Chronary. Creates a Chronary identity for an agent
1374
1449
  * that already exists in your system, so it can own calendars, events, and webhooks.
1375
1450
  */
1376
- create(params: CreateAgentParams, options?: RequestOptions): Promise<Agent>;
1377
- get(id: string, options?: RequestOptions): Promise<Agent>;
1451
+ create(params: CreateAgentParams, options?: RequestOptions): APIPromise<Agent>;
1452
+ get(id: string, options?: RequestOptions): APIPromise<Agent>;
1378
1453
  list(params?: ListAgentsParams): PageIterator<Agent>;
1379
- update(id: string, params: UpdateAgentParams, options?: RequestOptions): Promise<Agent>;
1380
- delete(id: string, options?: RequestOptions): Promise<void>;
1454
+ update(id: string, params: UpdateAgentParams, options?: RequestOptions): APIPromise<Agent>;
1455
+ delete(id: string, options?: RequestOptions): APIPromise<void>;
1381
1456
  }
1382
1457
 
1383
1458
  declare class CalendarsClient {
@@ -1385,43 +1460,43 @@ declare class CalendarsClient {
1385
1460
  constructor(client: CoreClient);
1386
1461
  create(params: CreateCalendarParams & {
1387
1462
  agentId?: string;
1388
- }, options?: RequestOptions): Promise<Calendar>;
1389
- get(id: string, options?: RequestOptions): Promise<Calendar>;
1463
+ }, options?: RequestOptions): APIPromise<Calendar>;
1464
+ get(id: string, options?: RequestOptions): APIPromise<Calendar>;
1390
1465
  list(params?: ListCalendarsParams): PageIterator<Calendar>;
1391
- update(id: string, params: UpdateCalendarParams, options?: RequestOptions): Promise<Calendar>;
1392
- delete(id: string, options?: RequestOptions): Promise<void>;
1466
+ update(id: string, params: UpdateCalendarParams, options?: RequestOptions): APIPromise<Calendar>;
1467
+ delete(id: string, options?: RequestOptions): APIPromise<void>;
1393
1468
  /**
1394
1469
  * Regenerate the calendar's iCal subscribe URL. The old URL stops working
1395
1470
  * (copies cached elsewhere can be served for up to 5 minutes); returns the
1396
1471
  * calendar with its new `ical_url`. Organization keys only.
1397
1472
  */
1398
- rotateIcalToken(id: string, options?: RequestOptions): Promise<Calendar>;
1399
- getContext(id: string, options?: RequestOptions): Promise<CalendarContext>;
1400
- setAvailabilityRules(id: string, params: SetAvailabilityRulesParams, options?: RequestOptions): Promise<AvailabilityRules>;
1401
- getAvailabilityRules(id: string, options?: RequestOptions): Promise<AvailabilityRules>;
1402
- deleteAvailabilityRules(id: string, options?: RequestOptions): Promise<void>;
1473
+ rotateIcalToken(id: string, options?: RequestOptions): APIPromise<Calendar>;
1474
+ getContext(id: string, options?: RequestOptions): APIPromise<CalendarContext>;
1475
+ setAvailabilityRules(id: string, params: SetAvailabilityRulesParams, options?: RequestOptions): APIPromise<AvailabilityRules>;
1476
+ getAvailabilityRules(id: string, options?: RequestOptions): APIPromise<AvailabilityRules>;
1477
+ deleteAvailabilityRules(id: string, options?: RequestOptions): APIPromise<void>;
1403
1478
  }
1404
1479
 
1405
1480
  declare class BookingPagesClient {
1406
1481
  private readonly client;
1407
1482
  constructor(client: CoreClient);
1408
- create(params: CreateBookingPageParams, options?: RequestOptions): Promise<BookingPage>;
1409
- get(id: string, options?: RequestOptions): Promise<BookingPage>;
1483
+ create(params: CreateBookingPageParams, options?: RequestOptions): APIPromise<BookingPage>;
1484
+ get(id: string, options?: RequestOptions): APIPromise<BookingPage>;
1410
1485
  list(params?: ListBookingPagesParams): PageIterator<BookingPage>;
1411
- update(id: string, params: UpdateBookingPageParams, options?: RequestOptions): Promise<BookingPage>;
1412
- delete(id: string, options?: RequestOptions): Promise<void>;
1486
+ update(id: string, params: UpdateBookingPageParams, options?: RequestOptions): APIPromise<BookingPage>;
1487
+ delete(id: string, options?: RequestOptions): APIPromise<void>;
1413
1488
  /**
1414
1489
  * One page of the bookings made through a booking page, newest start first,
1415
1490
  * with the invitee's details. Pass the returned `next_cursor` as `cursor`
1416
1491
  * for the next page (null on the last page). Bookings made before this
1417
1492
  * endpoint was released are not linked to their page.
1418
1493
  */
1419
- listBookings(id: string, params?: ListBookingsParams, options?: RequestOptions): Promise<BookingList>;
1494
+ listBookings(id: string, params?: ListBookingsParams, options?: RequestOptions): APIPromise<BookingList>;
1420
1495
  /**
1421
1496
  * Replace the page's public link. The old `/book/<slug>` stops working at
1422
1497
  * once; returns the page with its new `slug` and `booking_url`.
1423
1498
  */
1424
- rotateSlug(id: string, options?: RequestOptions): Promise<BookingPage>;
1499
+ rotateSlug(id: string, options?: RequestOptions): APIPromise<BookingPage>;
1425
1500
  /**
1426
1501
  * Public: list available slots for a booking page by its slug. No API key is
1427
1502
  * required for this endpoint (the slug is the credential); any key set on the
@@ -1430,20 +1505,20 @@ declare class BookingPagesClient {
1430
1505
  listSlots(slug: string, params?: {
1431
1506
  from?: string;
1432
1507
  to?: string;
1433
- }, options?: RequestOptions): Promise<BookingSlotsResponse>;
1508
+ }, options?: RequestOptions): APIPromise<BookingSlotsResponse>;
1434
1509
  /**
1435
1510
  * Public: submit a booking against a page's slug. Creates a confirmed event
1436
1511
  * on the underlying calendar and fires an `event.created` webhook with a
1437
1512
  * `booking_page_id` correlation field.
1438
1513
  */
1439
- submit(slug: string, params: SubmitBookingParams, options?: RequestOptions): Promise<BookingSubmissionResult>;
1514
+ submit(slug: string, params: SubmitBookingParams, options?: RequestOptions): APIPromise<BookingSubmissionResult>;
1440
1515
  }
1441
1516
 
1442
1517
  declare class EventsClient {
1443
1518
  private readonly client;
1444
1519
  constructor(client: CoreClient);
1445
- create(calendarId: string, params: CreateEventParams, options?: RequestOptions): Promise<CalendarEvent>;
1446
- get(calendarId: string, eventId: string, options?: RequestOptions): Promise<CalendarEvent>;
1520
+ create(calendarId: string, params: CreateEventParams, options?: RequestOptions): APIPromise<CalendarEvent>;
1521
+ get(calendarId: string, eventId: string, options?: RequestOptions): APIPromise<CalendarEvent>;
1447
1522
  list(params?: ListEventsParams): PageIterator<CalendarEvent>;
1448
1523
  /**
1449
1524
  * List events across all of the organization's calendars (`GET /v1/events`),
@@ -1451,7 +1526,7 @@ declare class EventsClient {
1451
1526
  * calendars. `q` searches titles and needs a window of at most 31 days.
1452
1527
  */
1453
1528
  listAll(params?: ListOrgEventsParams): PageIterator<CalendarEvent>;
1454
- update(calendarId: string, eventId: string, params: UpdateEventParams, options?: RequestOptions): Promise<CalendarEvent>;
1529
+ update(calendarId: string, eventId: string, params: UpdateEventParams, options?: RequestOptions): APIPromise<CalendarEvent>;
1455
1530
  /**
1456
1531
  * Delete an event (or, for a recurring series, the whole series). Pass
1457
1532
  * `occurrence_start` to cancel just one occurrence of a recurring series
@@ -1460,17 +1535,17 @@ declare class EventsClient {
1460
1535
  * the timestamp is not an active occurrence, or 409 if the event is not a
1461
1536
  * recurring series.
1462
1537
  */
1463
- delete(calendarId: string, eventId: string, options?: DeleteEventOptions): Promise<CalendarEvent | void>;
1538
+ delete(calendarId: string, eventId: string, options?: DeleteEventOptions): APIPromise<CalendarEvent | void>;
1464
1539
  /**
1465
1540
  * Fetch an event by ID alone. The calendar is resolved internally from the
1466
1541
  * event, so no calendar ID is required.
1467
1542
  */
1468
- getById(eventId: string, options?: RequestOptions): Promise<CalendarEvent>;
1543
+ getById(eventId: string, options?: RequestOptions): APIPromise<CalendarEvent>;
1469
1544
  /**
1470
1545
  * Update an event by ID alone. The calendar is resolved internally from the
1471
1546
  * event, so no calendar ID is required.
1472
1547
  */
1473
- updateById(eventId: string, params: UpdateEventParams, options?: RequestOptions): Promise<CalendarEvent>;
1548
+ updateById(eventId: string, params: UpdateEventParams, options?: RequestOptions): APIPromise<CalendarEvent>;
1474
1549
  /**
1475
1550
  * Delete an event by ID alone. The calendar is resolved internally from the
1476
1551
  * event, so no calendar ID is required. Pass `occurrence_start` to cancel
@@ -1479,45 +1554,45 @@ declare class EventsClient {
1479
1554
  * `occurrence_start`, fails with 400 if the timestamp is not an active
1480
1555
  * occurrence, or 409 if the event is not a recurring series.
1481
1556
  */
1482
- deleteById(eventId: string, options?: DeleteEventOptions): Promise<CalendarEvent | void>;
1557
+ deleteById(eventId: string, options?: DeleteEventOptions): APIPromise<CalendarEvent | void>;
1483
1558
  /**
1484
1559
  * Promote a held event (status='hold') to status='confirmed'. Fails with 409
1485
1560
  * if the event is not a hold, or if the hold has already expired.
1486
1561
  */
1487
- confirm(eventId: string, options?: RequestOptions): Promise<CalendarEvent>;
1562
+ confirm(eventId: string, options?: RequestOptions): APIPromise<CalendarEvent>;
1488
1563
  /**
1489
1564
  * Manually release a held event before its TTL, freeing the slot. Fails with
1490
1565
  * 409 if the event is not a hold.
1491
1566
  */
1492
- release(eventId: string, options?: RequestOptions): Promise<CalendarEvent>;
1567
+ release(eventId: string, options?: RequestOptions): APIPromise<CalendarEvent>;
1493
1568
  }
1494
1569
 
1495
1570
  declare class AvailabilityClient {
1496
1571
  private readonly client;
1497
1572
  constructor(client: CoreClient);
1498
- forAgent(agentId: string, params: AvailabilityParams, options?: RequestOptions): Promise<AvailabilityResponse>;
1499
- forCalendar(calendarId: string, params: AvailabilityParams, options?: RequestOptions): Promise<CalendarAvailabilityResponse>;
1500
- check(params: CrossAgentAvailabilityParams, options?: RequestOptions): Promise<AvailabilityResponse>;
1573
+ forAgent(agentId: string, params: AvailabilityParams, options?: RequestOptions): APIPromise<AvailabilityResponse>;
1574
+ forCalendar(calendarId: string, params: AvailabilityParams, options?: RequestOptions): APIPromise<CalendarAvailabilityResponse>;
1575
+ check(params: CrossAgentAvailabilityParams, options?: RequestOptions): APIPromise<AvailabilityResponse>;
1501
1576
  }
1502
1577
 
1503
1578
  declare class WebhooksClient {
1504
1579
  private readonly client;
1505
1580
  constructor(client: CoreClient);
1506
- create(params: CreateWebhookParams, options?: RequestOptions): Promise<Webhook>;
1507
- get(id: string, options?: RequestOptions): Promise<Webhook>;
1581
+ create(params: CreateWebhookParams, options?: RequestOptions): APIPromise<Webhook>;
1582
+ get(id: string, options?: RequestOptions): APIPromise<Webhook>;
1508
1583
  list(params?: ListWebhooksParams): PageIterator<Webhook>;
1509
- update(id: string, params: UpdateWebhookParams, options?: RequestOptions): Promise<Webhook>;
1510
- delete(id: string, options?: RequestOptions): Promise<void>;
1511
- listDeliveries(webhookId: string, params?: ListWebhookDeliveriesParams, options?: RequestOptions): Promise<WebhookDeliveryListResponse>;
1584
+ update(id: string, params: UpdateWebhookParams, options?: RequestOptions): APIPromise<Webhook>;
1585
+ delete(id: string, options?: RequestOptions): APIPromise<void>;
1586
+ listDeliveries(webhookId: string, params?: ListWebhookDeliveriesParams, options?: RequestOptions): APIPromise<WebhookDeliveryListResponse>;
1512
1587
  /** One delivery with its payload and every attempt, oldest first. */
1513
- getDelivery(webhookId: string, deliveryId: string, options?: RequestOptions): Promise<WebhookDeliveryDetail>;
1588
+ getDelivery(webhookId: string, deliveryId: string, options?: RequestOptions): APIPromise<WebhookDeliveryDetail>;
1514
1589
  /**
1515
1590
  * Send a signed sample payload of one event type to the endpoint. The
1516
1591
  * delivery is marked `is_test`, carries `X-Chronary-Test: 1`, makes one
1517
1592
  * attempt and does not count toward the monthly quota. Poll `getDelivery`
1518
1593
  * with the returned `delivery_id` for the result. Limited to 10 per minute.
1519
1594
  */
1520
- sendTest(webhookId: string, params: SendTestWebhookParams, options?: RequestOptions): Promise<WebhookTestSent>;
1595
+ sendTest(webhookId: string, params: SendTestWebhookParams, options?: RequestOptions): APIPromise<WebhookTestSent>;
1521
1596
  /**
1522
1597
  * Send a `failed` or `dropped` delivery again as a new delivery with its
1523
1598
  * own `delivery_id` (Developer or Pro). The stored payload goes out unchanged, signed
@@ -1527,7 +1602,7 @@ declare class WebhooksClient {
1527
1602
  * `Idempotency-Key` (generated, or `options.idempotencyKey`), so a retry
1528
1603
  * returns the same replay. Limited to 30 per minute.
1529
1604
  */
1530
- replayDelivery(webhookId: string, deliveryId: string, options?: RequestOptions): Promise<WebhookReplaySent>;
1605
+ replayDelivery(webhookId: string, deliveryId: string, options?: RequestOptions): APIPromise<WebhookReplaySent>;
1531
1606
  /**
1532
1607
  * Rotate the endpoint's signing secret (Developer or Pro). The new secret is returned
1533
1608
  * once and signs `X-Signature` from the next attempt. The replaced secret
@@ -1535,69 +1610,69 @@ declare class WebhooksClient {
1535
1610
  * (default `24h`; `now` drops it at once), so receivers can switch
1536
1611
  * without rejecting deliveries. `verifySignature` accepts either header.
1537
1612
  */
1538
- rotateSecret(webhookId: string, params?: RotateWebhookSecretParams, options?: RequestOptions): Promise<RotatedWebhookSecret>;
1613
+ rotateSecret(webhookId: string, params?: RotateWebhookSecretParams, options?: RequestOptions): APIPromise<RotatedWebhookSecret>;
1539
1614
  }
1540
1615
 
1541
1616
  declare class ICalSubscriptionsClient {
1542
1617
  private readonly client;
1543
1618
  constructor(client: CoreClient);
1544
- create(agentId: string, params: CreateICalSubscriptionParams, options?: RequestOptions): Promise<ICalSubscription>;
1545
- get(id: string, options?: RequestOptions): Promise<ICalSubscription>;
1619
+ create(agentId: string, params: CreateICalSubscriptionParams, options?: RequestOptions): APIPromise<ICalSubscription>;
1620
+ get(id: string, options?: RequestOptions): APIPromise<ICalSubscription>;
1546
1621
  list(params: ListICalSubscriptionsParams & {
1547
1622
  agentId: string;
1548
1623
  }): PageIterator<ICalSubscription>;
1549
- update(id: string, params: UpdateICalSubscriptionParams, options?: RequestOptions): Promise<ICalSubscription>;
1550
- delete(id: string, options?: RequestOptions): Promise<void>;
1624
+ update(id: string, params: UpdateICalSubscriptionParams, options?: RequestOptions): APIPromise<ICalSubscription>;
1625
+ delete(id: string, options?: RequestOptions): APIPromise<void>;
1551
1626
  /**
1552
1627
  * Start an immediate fetch of the feed. Resolves with `{ status: 'syncing' }`
1553
1628
  * as soon as the fetch has started; read the subscription a few seconds later
1554
1629
  * for `last_synced_at` / `last_error`. A paused feed rejects with 409, and a
1555
1630
  * second sync of the same feed within a minute rejects with 429.
1556
1631
  */
1557
- sync(id: string, options?: RequestOptions): Promise<{
1632
+ sync(id: string, options?: RequestOptions): APIPromise<{
1558
1633
  status: string;
1559
1634
  }>;
1560
1635
  /** Stop polling the feed until it is resumed. Pausing a paused feed changes nothing. */
1561
- pause(id: string, options?: RequestOptions): Promise<ICalSubscription>;
1636
+ pause(id: string, options?: RequestOptions): APIPromise<ICalSubscription>;
1562
1637
  /** Return a paused or failing feed to polling and clear `last_error`. */
1563
- resume(id: string, options?: RequestOptions): Promise<ICalSubscription>;
1638
+ resume(id: string, options?: RequestOptions): APIPromise<ICalSubscription>;
1564
1639
  }
1565
1640
 
1566
1641
  declare class SchedulingClient {
1567
1642
  private readonly client;
1568
1643
  constructor(client: CoreClient);
1569
- create(params: CreateProposalParams, options?: RequestOptions): Promise<ProposalSummary>;
1644
+ create(params: CreateProposalParams, options?: RequestOptions): APIPromise<ProposalSummary>;
1570
1645
  list(params?: ListProposalsParams): PageIterator<ProposalSummary>;
1571
- get(id: string, options?: RequestOptions): Promise<Proposal>;
1572
- respond(id: string, params: RespondToProposalParams, options?: RequestOptions): Promise<ProposalResponse>;
1573
- resolve(id: string, options?: RequestOptions): Promise<ResolveProposalResponse>;
1574
- cancel(id: string, options?: RequestOptions): Promise<CancelProposalResponse>;
1646
+ get(id: string, options?: RequestOptions): APIPromise<Proposal>;
1647
+ respond(id: string, params: RespondToProposalParams, options?: RequestOptions): APIPromise<ProposalResponse>;
1648
+ resolve(id: string, options?: RequestOptions): APIPromise<ResolveProposalResponse>;
1649
+ cancel(id: string, options?: RequestOptions): APIPromise<CancelProposalResponse>;
1575
1650
  }
1576
1651
 
1577
1652
  declare class UsageClient {
1578
1653
  private readonly client;
1579
1654
  constructor(client: CoreClient);
1580
- get(options?: RequestOptions): Promise<Usage>;
1655
+ get(options?: RequestOptions): APIPromise<Usage>;
1581
1656
  /**
1582
1657
  * Monthly totals for the last 1-12 UTC calendar months (default 6), oldest
1583
1658
  * first, ending with the current partial month. Org-level keys only; not
1584
1659
  * counted toward API calls.
1585
1660
  */
1586
- history(params?: UsageHistoryParams, options?: RequestOptions): Promise<UsageHistory>;
1661
+ history(params?: UsageHistoryParams, options?: RequestOptions): APIPromise<UsageHistory>;
1587
1662
  }
1588
1663
 
1589
1664
  declare class AuditLogClient {
1590
1665
  private readonly client;
1591
1666
  constructor(client: CoreClient);
1592
- list(params?: ListAuditLogParams, options?: RequestOptions): Promise<AuditLogResponse>;
1667
+ list(params?: ListAuditLogParams, options?: RequestOptions): APIPromise<AuditLogResponse>;
1593
1668
  }
1594
1669
 
1595
1670
  declare class KeysClient {
1596
1671
  private readonly client;
1597
1672
  constructor(client: CoreClient);
1598
- create(params: CreateScopedApiKeyParams, options?: RequestOptions): Promise<CreatedScopedApiKey>;
1599
- list(options?: RequestOptions): Promise<ScopedApiKey[]>;
1600
- delete(id: string, options?: RequestOptions): Promise<void>;
1673
+ create(params: CreateScopedApiKeyParams, options?: RequestOptions): APIPromise<CreatedScopedApiKey>;
1674
+ list(options?: RequestOptions): APIPromise<ScopedApiKey[]>;
1675
+ delete(id: string, options?: RequestOptions): APIPromise<void>;
1601
1676
  }
1602
1677
 
1603
1678
  declare class AgentAuthClient {
@@ -1622,7 +1697,7 @@ declare class AgentAuthClient {
1622
1697
  * the currently-published version — retry with the value from the
1623
1698
  * `current_version` field on the error body.
1624
1699
  */
1625
- signUp(params: AgentSignUpParams, options?: RequestOptions): Promise<AgentSignUpResponse>;
1700
+ signUp(params: AgentSignUpParams, options?: RequestOptions): APIPromise<AgentSignUpResponse>;
1626
1701
  /**
1627
1702
  * Submit the OTP sent during `signUp()` to unlock the API key.
1628
1703
  *
@@ -1635,7 +1710,7 @@ declare class AgentAuthClient {
1635
1710
  * API returns 400 for invalid/expired OTPs, which surfaces as a
1636
1711
  * generic `ChronaryError` with the original message.
1637
1712
  */
1638
- verify(params: AgentVerifyParams, options?: RequestOptions): Promise<AgentVerifyResponse>;
1713
+ verify(params: AgentVerifyParams, options?: RequestOptions): APIPromise<AgentVerifyResponse>;
1639
1714
  }
1640
1715
  /**
1641
1716
  * Type guard — narrows an `AgentSignUpResponse` to the new-org branch.
@@ -1665,7 +1740,7 @@ declare class WaitlistClient {
1665
1740
  * @throws ChronaryError (429 `rate_limit_error`) on the per-IP / per-email
1666
1741
  * waitlist limiter.
1667
1742
  */
1668
- join(params: WaitlistJoinParams, options?: RequestOptions): Promise<WaitlistJoinResponse>;
1743
+ join(params: WaitlistJoinParams, options?: RequestOptions): APIPromise<WaitlistJoinResponse>;
1669
1744
  }
1670
1745
 
1671
1746
  declare class FeedbackClient {
@@ -1679,7 +1754,7 @@ declare class FeedbackClient {
1679
1754
  * HTTP 429 with a `Retry-After` header set to the seconds until the
1680
1755
  * next UTC midnight.
1681
1756
  */
1682
- submit(params: SubmitFeedbackParams, options?: RequestOptions): Promise<FeedbackAcceptedResponse>;
1757
+ submit(params: SubmitFeedbackParams, options?: RequestOptions): APIPromise<FeedbackAcceptedResponse>;
1683
1758
  }
1684
1759
 
1685
1760
  declare class PlansClient {
@@ -1692,7 +1767,7 @@ declare class PlansClient {
1692
1767
  * tier with `custom_pricing: true`. No authentication required.
1693
1768
  * Responses are cacheable for 5 minutes at the edge.
1694
1769
  */
1695
- list(options?: RequestOptions): Promise<PlansListResponse>;
1770
+ list(options?: RequestOptions): APIPromise<PlansListResponse>;
1696
1771
  }
1697
1772
 
1698
1773
  declare class AccountClient {
@@ -1714,7 +1789,7 @@ declare class AccountClient {
1714
1789
  *
1715
1790
  * **Rate limit:** 10 exports/hour/org.
1716
1791
  */
1717
- export(options?: RequestOptions): Promise<DataExport>;
1792
+ export(options?: RequestOptions): APIPromise<DataExport>;
1718
1793
  }
1719
1794
 
1720
1795
  declare class TermsClient {
@@ -1732,7 +1807,7 @@ declare class TermsClient {
1732
1807
  * keys cannot accept org-wide terms (403). A stale version returns 409
1733
1808
  * `tos_version_stale` with the current version in the error body.
1734
1809
  */
1735
- accept(params: AcceptTermsParams, options?: RequestOptions): Promise<AcceptTermsResult>;
1810
+ accept(params: AcceptTermsParams, options?: RequestOptions): APIPromise<AcceptTermsResult>;
1736
1811
  }
1737
1812
 
1738
1813
  interface CreateConnectionLinkParams {
@@ -1762,13 +1837,13 @@ interface ListConnectionLinksParams {
1762
1837
  declare class ConnectionLinksClient {
1763
1838
  private readonly client;
1764
1839
  constructor(client: CoreClient);
1765
- create(calendarId: string, params: CreateConnectionLinkParams, options?: RequestOptions): Promise<ConnectionLink>;
1840
+ create(calendarId: string, params: CreateConnectionLinkParams, options?: RequestOptions): APIPromise<ConnectionLink>;
1766
1841
  /** Setup links, newest first. An agent-scoped key sees only its own calendars' links. */
1767
- list(params?: ListConnectionLinksParams, options?: RequestOptions): Promise<{
1842
+ list(params?: ListConnectionLinksParams, options?: RequestOptions): APIPromise<{
1768
1843
  data: ConnectionLink[];
1769
1844
  }>;
1770
- get(id: string, options?: RequestOptions): Promise<ConnectionLink>;
1771
- cancel(id: string, options?: RequestOptions): Promise<void>;
1845
+ get(id: string, options?: RequestOptions): APIPromise<ConnectionLink>;
1846
+ cancel(id: string, options?: RequestOptions): APIPromise<void>;
1772
1847
  }
1773
1848
 
1774
1849
  declare class UpgradeRequestsClient {
@@ -1779,24 +1854,24 @@ declare class UpgradeRequestsClient {
1779
1854
  * Returns an `approval_url` to hand to your human. Honors `idempotencyKey`;
1780
1855
  * if `reused` is true a request is already pending — poll it instead.
1781
1856
  */
1782
- create(params?: CreateUpgradeRequestParams, options?: RequestOptions): Promise<UpgradeRequest>;
1857
+ create(params?: CreateUpgradeRequestParams, options?: RequestOptions): APIPromise<UpgradeRequest>;
1783
1858
  /** Poll an upgrade request (at most once a minute). */
1784
- get(id: string, options?: RequestOptions): Promise<UpgradeRequest>;
1859
+ get(id: string, options?: RequestOptions): APIPromise<UpgradeRequest>;
1785
1860
  /** Withdraw a pending upgrade request. */
1786
- cancel(id: string, options?: RequestOptions): Promise<UpgradeRequest>;
1861
+ cancel(id: string, options?: RequestOptions): APIPromise<UpgradeRequest>;
1787
1862
  }
1788
1863
  declare class BillingClient {
1789
1864
  private readonly client;
1790
1865
  readonly upgradeRequests: UpgradeRequestsClient;
1791
1866
  constructor(client: CoreClient);
1792
1867
  /** Read-only billing summary for the org (plan, status, upgrade options, pending upgrade request). */
1793
- get(options?: RequestOptions): Promise<BillingSummary>;
1868
+ get(options?: RequestOptions): APIPromise<BillingSummary>;
1794
1869
  }
1795
1870
 
1796
1871
  declare function verifySignature(rawBody: string, headers: Headers | Record<string, string>, secret: string, options?: VerifyOptions): Promise<void>;
1797
1872
  declare function constructEvent(rawBody: string, headers: Headers | Record<string, string>, secret: string, options?: VerifyOptions): Promise<WebhookEvent>;
1798
1873
 
1799
- declare const VERSION = "0.9.0";
1874
+ declare const VERSION = "0.11.0";
1800
1875
 
1801
1876
  declare class ChronaryError extends Error {
1802
1877
  readonly status: number;
@@ -1874,4 +1949,4 @@ declare class Chronary {
1874
1949
  }
1875
1950
 
1876
1951
  export { APIPromise, AuthenticationError, BillingClient, BookingPagesClient, Chronary, ChronaryError, ConnectionError, ConnectionLinksClient, CoreClient, NotFoundError, PageIterator, PlanRequiredError, QuotaExceededError, RateLimitError, TimeoutError, UpgradeRequestsClient, VERSION, ValidationError, constructEvent, Chronary as default, isAgentSignUpNewOrg, verifySignature };
1877
- export type { AcceptTermsParams, AcceptTermsResult, Agent, AgentSignUpExistingOrgResponse, AgentSignUpNewOrgResponse, AgentSignUpParams, AgentSignUpResponse, AgentSignUpWaitlistedResponse, AgentStatus, AgentVerifyParams, AgentVerifyResponse, AppInfo, AuditActorType, AuditCategory, AuditLogEntry, AuditLogResponse, AuditStatusClass, AvailabilityParams, AvailabilityResponse, AvailabilityRules, AvailabilitySlot, AvailabilitySourceState, AvailabilitySources, AvailabilityState, AvailabilityWarning, BillingCredit, BillingInterval, BillingOffer, BillingPastDue, BillingPrice, BillingSummary, BillingUpgradeOption, Booking, BookingList, BookingPage, BookingSlot, BookingSlotsResponse, BookingSubmissionEvent, BookingSubmissionResult, BusyBlock, Calendar, CalendarAvailabilityResponse, CalendarContext, CalendarEvent, CancelProposalResponse, ChronaryConfig, ConnectionLink, ConnectionLinkStatus, CreateAgentParams, CreateBookingPageParams, CreateCalendarParams, CreateConnectionLinkParams, CreateEventParams, CreateICalSubscriptionParams, CreateProposalParams, CreateScopedApiKeyParams, CreateUpgradeRequestParams, CreateWebhookParams, CreatedScopedApiKey, CrossAgentAvailabilityParams, DataExport, DeleteEventOptions, FeedbackAcceptedResponse, FeedbackType, ICalSubscription, KeyExpiresIn, ListAgentsParams, ListAuditLogParams, ListBookingPagesParams, ListBookingsParams, ListCalendarsParams, ListConnectionLinksParams, ListEventsParams, ListICalSubscriptionsParams, ListOrgEventsParams, ListProposalsParams, ListWebhookDeliveriesParams, ListWebhooksParams, LogLevel, Page, PageResponse, Plan, PlanId, PlanLimits, PlansListResponse, Proposal, ProposalResponse, ProposalResponseAction, ProposalSlot, ProposalStatus, ProposalSummary, QuotaSnapshot, RawResponse, RequestOptions, ResolveProposalResponse, RespondToProposalParams, RotateWebhookSecretParams, RotatedWebhookSecret, ScopedApiKey, SendTestWebhookParams, SetAvailabilityRulesParams, SlotDuration, SubmitBookingParams, SubmitFeedbackParams, UpdateAgentParams, UpdateBookingPageParams, UpdateCalendarParams, UpdateEventParams, UpdateICalSubscriptionParams, UpdateWebhookParams, UpgradeRequest, UpgradeRequestStatus, Usage, UsageHistory, UsageHistoryMonth, UsageHistoryParams, UsageMetric, VerifyOptions, WaitlistJoinParams, WaitlistJoinResponse, WaitlistedOrg, Webhook, WebhookAttemptErrorCode, WebhookDeactivatedReason, WebhookDelivery, WebhookDeliveryAttempt, WebhookDeliveryDetail, WebhookDeliveryErrorCode, WebhookDeliveryListResponse, WebhookDeliveryStats, WebhookDeliveryStatus, WebhookEvent, WebhookEventType, WebhookReplaySent, WebhookSecretExpiry, WebhookTestSent, WithResponse, WorkingHours, WorkingHoursDay };
1952
+ export type { AcceptTermsParams, AcceptTermsResult, Agent, AgentSignUpExistingOrgResponse, AgentSignUpNewOrgResponse, AgentSignUpParams, AgentSignUpResponse, AgentSignUpWaitlistedResponse, AgentStatus, AgentVerifyParams, AgentVerifyResponse, AppInfo, AuditActorType, AuditCategory, AuditLogEntry, AuditLogResponse, AuditStatusClass, AvailabilityParams, AvailabilityResponse, AvailabilityRules, AvailabilitySlot, AvailabilitySourceState, AvailabilitySources, AvailabilityState, AvailabilityWarning, BillingCredit, BillingInterval, BillingOffer, BillingPastDue, BillingPrice, BillingSummary, BillingUpgradeOption, Booking, BookingList, BookingPage, BookingSlot, BookingSlotsResponse, BookingSubmissionEvent, BookingSubmissionResult, BusyBlock, Calendar, CalendarAvailabilityResponse, CalendarContext, CalendarEvent, CancelProposalResponse, ChronaryConfig, ConnectionLink, ConnectionLinkStatus, CreateAgentParams, CreateBookingPageParams, CreateCalendarParams, CreateConnectionLinkParams, CreateEventParams, CreateICalSubscriptionParams, CreateProposalParams, CreateScopedApiKeyParams, CreateUpgradeRequestParams, CreateWebhookParams, CreatedScopedApiKey, CrossAgentAvailabilityParams, CrossCalendarQueriesUsage, DataExport, DeleteEventOptions, FeedbackAcceptedResponse, FeedbackType, HoldsUsage, ICalSubscription, KeyExpiresIn, ListAgentsParams, ListAuditLogParams, ListBookingPagesParams, ListBookingsParams, ListCalendarsParams, ListConnectionLinksParams, ListEventsParams, ListICalSubscriptionsParams, ListOrgEventsParams, ListProposalsParams, ListWebhookDeliveriesParams, ListWebhooksParams, LogLevel, Page, PageResponse, Plan, PlanId, PlanLimits, PlansListResponse, Proposal, ProposalResponse, ProposalResponseAction, ProposalSlot, ProposalStatus, ProposalSummary, QuotaSnapshot, RawResponse, RequestOptions, ResolveProposalResponse, RespondToProposalParams, RotateWebhookSecretParams, RotatedWebhookSecret, ScopedApiKey, ScopedKeysUsage, SendTestWebhookParams, SetAvailabilityRulesParams, SlotDuration, SubmitBookingParams, SubmitFeedbackParams, UpdateAgentParams, UpdateBookingPageParams, UpdateCalendarParams, UpdateEventParams, UpdateICalSubscriptionParams, UpdateWebhookParams, UpgradeRequest, UpgradeRequestStatus, Usage, UsageHistory, UsageHistoryMonth, UsageHistoryParams, UsageMetric, VerifyOptions, WaitlistJoinParams, WaitlistJoinResponse, WaitlistedOrg, Webhook, WebhookAttemptErrorCode, WebhookDeactivatedReason, WebhookDelivery, WebhookDeliveryAttempt, WebhookDeliveryDetail, WebhookDeliveryErrorCode, WebhookDeliveryListResponse, WebhookDeliveryStats, WebhookDeliveryStatus, WebhookEvent, WebhookEventType, WebhookReplaySent, WebhookSecretExpiry, WebhookTestSent, WithResponse, WorkingHours, WorkingHoursDay };