@chronary/sdk 0.8.1 → 0.10.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.cts 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
  /**
@@ -356,7 +377,7 @@ interface CreateEventParams {
356
377
  * RFC 5545 RRULE subset (no "RRULE:" prefix), e.g. "FREQ=WEEKLY;BYDAY=MO,WE;COUNT=12" —
357
378
  * makes the event a recurring series master. Not allowed with status='hold'.
358
379
  * Fails with 400 on an invalid rule; 429 when the plan's active
359
- * recurring-series cap is reached (free: 5, Pro: 250 — see
380
+ * recurring-series cap is reached (free: 1, Pro: 250 — see
360
381
  * `usage.recurring_events`); 403 plan_required when the series is unbounded
361
382
  * or ends more than 90 days out on the free plan (Pro allows unbounded).
362
383
  */
@@ -378,7 +399,7 @@ interface UpdateEventParams {
378
399
  * "RRULE:" prefix). null clears the rule, turning the series back into a
379
400
  * one-off event. Fails with 400 on an invalid rule; 429 when converting a
380
401
  * one-off to recurring and the plan's active recurring-series cap is
381
- * reached (free: 5, Pro: 250); 403 plan_required when the series is
402
+ * reached (free: 1, Pro: 250); 403 plan_required when the series is
382
403
  * unbounded or ends more than 90 days out on the free plan (Pro allows
383
404
  * unbounded).
384
405
  */
@@ -877,6 +898,14 @@ interface HoldsUsage {
877
898
  interface CrossCalendarQueriesUsage {
878
899
  used: number;
879
900
  }
901
+ /**
902
+ * Active agent-scoped (`chr_ak_*`) keys. `count` is a direct count (the name
903
+ * predates the plan cap); `limit` is the plan cap (`null` = unlimited).
904
+ */
905
+ interface ScopedKeysUsage {
906
+ count: number;
907
+ limit: number | null;
908
+ }
880
909
  interface Usage {
881
910
  period_start: string;
882
911
  period_end: string;
@@ -889,14 +918,19 @@ interface Usage {
889
918
  calendars: UsageMetric;
890
919
  events: UsageMetric;
891
920
  api_calls: UsageMetric;
921
+ /** Webhook deliveries this month. */
892
922
  webhooks: UsageMetric;
923
+ /** Registered webhook endpoints vs. the plan cap (null = unlimited). */
924
+ webhook_endpoints: UsageMetric;
893
925
  availability_queries: UsageMetric;
894
926
  ical_subscriptions: UsageMetric;
895
927
  proposals: UsageMetric;
896
- /** Active recurring series masters vs. the plan cap (free: 5, Pro: 250; null = unlimited). */
928
+ /** Active recurring series masters vs. the plan cap (free: 1, Pro: 250; null = unlimited). */
897
929
  recurring_events: UsageMetric;
898
930
  /** Active booking pages vs. the plan cap (free: 1, Pro: 25; null = unlimited). */
899
931
  booking_pages: UsageMetric;
932
+ /** Active agent-scoped keys vs. the plan cap. */
933
+ scoped_keys: ScopedKeysUsage;
900
934
  holds: HoldsUsage;
901
935
  cross_calendar_queries: CrossCalendarQueriesUsage;
902
936
  }
@@ -1373,11 +1407,11 @@ declare class AgentsClient {
1373
1407
  * Register your agent with Chronary. Creates a Chronary identity for an agent
1374
1408
  * that already exists in your system, so it can own calendars, events, and webhooks.
1375
1409
  */
1376
- create(params: CreateAgentParams, options?: RequestOptions): Promise<Agent>;
1377
- get(id: string, options?: RequestOptions): Promise<Agent>;
1410
+ create(params: CreateAgentParams, options?: RequestOptions): APIPromise<Agent>;
1411
+ get(id: string, options?: RequestOptions): APIPromise<Agent>;
1378
1412
  list(params?: ListAgentsParams): PageIterator<Agent>;
1379
- update(id: string, params: UpdateAgentParams, options?: RequestOptions): Promise<Agent>;
1380
- delete(id: string, options?: RequestOptions): Promise<void>;
1413
+ update(id: string, params: UpdateAgentParams, options?: RequestOptions): APIPromise<Agent>;
1414
+ delete(id: string, options?: RequestOptions): APIPromise<void>;
1381
1415
  }
1382
1416
 
1383
1417
  declare class CalendarsClient {
@@ -1385,43 +1419,43 @@ declare class CalendarsClient {
1385
1419
  constructor(client: CoreClient);
1386
1420
  create(params: CreateCalendarParams & {
1387
1421
  agentId?: string;
1388
- }, options?: RequestOptions): Promise<Calendar>;
1389
- get(id: string, options?: RequestOptions): Promise<Calendar>;
1422
+ }, options?: RequestOptions): APIPromise<Calendar>;
1423
+ get(id: string, options?: RequestOptions): APIPromise<Calendar>;
1390
1424
  list(params?: ListCalendarsParams): PageIterator<Calendar>;
1391
- update(id: string, params: UpdateCalendarParams, options?: RequestOptions): Promise<Calendar>;
1392
- delete(id: string, options?: RequestOptions): Promise<void>;
1425
+ update(id: string, params: UpdateCalendarParams, options?: RequestOptions): APIPromise<Calendar>;
1426
+ delete(id: string, options?: RequestOptions): APIPromise<void>;
1393
1427
  /**
1394
1428
  * Regenerate the calendar's iCal subscribe URL. The old URL stops working
1395
1429
  * (copies cached elsewhere can be served for up to 5 minutes); returns the
1396
1430
  * calendar with its new `ical_url`. Organization keys only.
1397
1431
  */
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>;
1432
+ rotateIcalToken(id: string, options?: RequestOptions): APIPromise<Calendar>;
1433
+ getContext(id: string, options?: RequestOptions): APIPromise<CalendarContext>;
1434
+ setAvailabilityRules(id: string, params: SetAvailabilityRulesParams, options?: RequestOptions): APIPromise<AvailabilityRules>;
1435
+ getAvailabilityRules(id: string, options?: RequestOptions): APIPromise<AvailabilityRules>;
1436
+ deleteAvailabilityRules(id: string, options?: RequestOptions): APIPromise<void>;
1403
1437
  }
1404
1438
 
1405
1439
  declare class BookingPagesClient {
1406
1440
  private readonly client;
1407
1441
  constructor(client: CoreClient);
1408
- create(params: CreateBookingPageParams, options?: RequestOptions): Promise<BookingPage>;
1409
- get(id: string, options?: RequestOptions): Promise<BookingPage>;
1442
+ create(params: CreateBookingPageParams, options?: RequestOptions): APIPromise<BookingPage>;
1443
+ get(id: string, options?: RequestOptions): APIPromise<BookingPage>;
1410
1444
  list(params?: ListBookingPagesParams): PageIterator<BookingPage>;
1411
- update(id: string, params: UpdateBookingPageParams, options?: RequestOptions): Promise<BookingPage>;
1412
- delete(id: string, options?: RequestOptions): Promise<void>;
1445
+ update(id: string, params: UpdateBookingPageParams, options?: RequestOptions): APIPromise<BookingPage>;
1446
+ delete(id: string, options?: RequestOptions): APIPromise<void>;
1413
1447
  /**
1414
1448
  * One page of the bookings made through a booking page, newest start first,
1415
1449
  * with the invitee's details. Pass the returned `next_cursor` as `cursor`
1416
1450
  * for the next page (null on the last page). Bookings made before this
1417
1451
  * endpoint was released are not linked to their page.
1418
1452
  */
1419
- listBookings(id: string, params?: ListBookingsParams, options?: RequestOptions): Promise<BookingList>;
1453
+ listBookings(id: string, params?: ListBookingsParams, options?: RequestOptions): APIPromise<BookingList>;
1420
1454
  /**
1421
1455
  * Replace the page's public link. The old `/book/<slug>` stops working at
1422
1456
  * once; returns the page with its new `slug` and `booking_url`.
1423
1457
  */
1424
- rotateSlug(id: string, options?: RequestOptions): Promise<BookingPage>;
1458
+ rotateSlug(id: string, options?: RequestOptions): APIPromise<BookingPage>;
1425
1459
  /**
1426
1460
  * Public: list available slots for a booking page by its slug. No API key is
1427
1461
  * required for this endpoint (the slug is the credential); any key set on the
@@ -1430,20 +1464,20 @@ declare class BookingPagesClient {
1430
1464
  listSlots(slug: string, params?: {
1431
1465
  from?: string;
1432
1466
  to?: string;
1433
- }, options?: RequestOptions): Promise<BookingSlotsResponse>;
1467
+ }, options?: RequestOptions): APIPromise<BookingSlotsResponse>;
1434
1468
  /**
1435
1469
  * Public: submit a booking against a page's slug. Creates a confirmed event
1436
1470
  * on the underlying calendar and fires an `event.created` webhook with a
1437
1471
  * `booking_page_id` correlation field.
1438
1472
  */
1439
- submit(slug: string, params: SubmitBookingParams, options?: RequestOptions): Promise<BookingSubmissionResult>;
1473
+ submit(slug: string, params: SubmitBookingParams, options?: RequestOptions): APIPromise<BookingSubmissionResult>;
1440
1474
  }
1441
1475
 
1442
1476
  declare class EventsClient {
1443
1477
  private readonly client;
1444
1478
  constructor(client: CoreClient);
1445
- create(calendarId: string, params: CreateEventParams, options?: RequestOptions): Promise<CalendarEvent>;
1446
- get(calendarId: string, eventId: string, options?: RequestOptions): Promise<CalendarEvent>;
1479
+ create(calendarId: string, params: CreateEventParams, options?: RequestOptions): APIPromise<CalendarEvent>;
1480
+ get(calendarId: string, eventId: string, options?: RequestOptions): APIPromise<CalendarEvent>;
1447
1481
  list(params?: ListEventsParams): PageIterator<CalendarEvent>;
1448
1482
  /**
1449
1483
  * List events across all of the organization's calendars (`GET /v1/events`),
@@ -1451,7 +1485,7 @@ declare class EventsClient {
1451
1485
  * calendars. `q` searches titles and needs a window of at most 31 days.
1452
1486
  */
1453
1487
  listAll(params?: ListOrgEventsParams): PageIterator<CalendarEvent>;
1454
- update(calendarId: string, eventId: string, params: UpdateEventParams, options?: RequestOptions): Promise<CalendarEvent>;
1488
+ update(calendarId: string, eventId: string, params: UpdateEventParams, options?: RequestOptions): APIPromise<CalendarEvent>;
1455
1489
  /**
1456
1490
  * Delete an event (or, for a recurring series, the whole series). Pass
1457
1491
  * `occurrence_start` to cancel just one occurrence of a recurring series
@@ -1460,17 +1494,17 @@ declare class EventsClient {
1460
1494
  * the timestamp is not an active occurrence, or 409 if the event is not a
1461
1495
  * recurring series.
1462
1496
  */
1463
- delete(calendarId: string, eventId: string, options?: DeleteEventOptions): Promise<CalendarEvent | void>;
1497
+ delete(calendarId: string, eventId: string, options?: DeleteEventOptions): APIPromise<CalendarEvent | void>;
1464
1498
  /**
1465
1499
  * Fetch an event by ID alone. The calendar is resolved internally from the
1466
1500
  * event, so no calendar ID is required.
1467
1501
  */
1468
- getById(eventId: string, options?: RequestOptions): Promise<CalendarEvent>;
1502
+ getById(eventId: string, options?: RequestOptions): APIPromise<CalendarEvent>;
1469
1503
  /**
1470
1504
  * Update an event by ID alone. The calendar is resolved internally from the
1471
1505
  * event, so no calendar ID is required.
1472
1506
  */
1473
- updateById(eventId: string, params: UpdateEventParams, options?: RequestOptions): Promise<CalendarEvent>;
1507
+ updateById(eventId: string, params: UpdateEventParams, options?: RequestOptions): APIPromise<CalendarEvent>;
1474
1508
  /**
1475
1509
  * Delete an event by ID alone. The calendar is resolved internally from the
1476
1510
  * event, so no calendar ID is required. Pass `occurrence_start` to cancel
@@ -1479,45 +1513,45 @@ declare class EventsClient {
1479
1513
  * `occurrence_start`, fails with 400 if the timestamp is not an active
1480
1514
  * occurrence, or 409 if the event is not a recurring series.
1481
1515
  */
1482
- deleteById(eventId: string, options?: DeleteEventOptions): Promise<CalendarEvent | void>;
1516
+ deleteById(eventId: string, options?: DeleteEventOptions): APIPromise<CalendarEvent | void>;
1483
1517
  /**
1484
1518
  * Promote a held event (status='hold') to status='confirmed'. Fails with 409
1485
1519
  * if the event is not a hold, or if the hold has already expired.
1486
1520
  */
1487
- confirm(eventId: string, options?: RequestOptions): Promise<CalendarEvent>;
1521
+ confirm(eventId: string, options?: RequestOptions): APIPromise<CalendarEvent>;
1488
1522
  /**
1489
1523
  * Manually release a held event before its TTL, freeing the slot. Fails with
1490
1524
  * 409 if the event is not a hold.
1491
1525
  */
1492
- release(eventId: string, options?: RequestOptions): Promise<CalendarEvent>;
1526
+ release(eventId: string, options?: RequestOptions): APIPromise<CalendarEvent>;
1493
1527
  }
1494
1528
 
1495
1529
  declare class AvailabilityClient {
1496
1530
  private readonly client;
1497
1531
  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>;
1532
+ forAgent(agentId: string, params: AvailabilityParams, options?: RequestOptions): APIPromise<AvailabilityResponse>;
1533
+ forCalendar(calendarId: string, params: AvailabilityParams, options?: RequestOptions): APIPromise<CalendarAvailabilityResponse>;
1534
+ check(params: CrossAgentAvailabilityParams, options?: RequestOptions): APIPromise<AvailabilityResponse>;
1501
1535
  }
1502
1536
 
1503
1537
  declare class WebhooksClient {
1504
1538
  private readonly client;
1505
1539
  constructor(client: CoreClient);
1506
- create(params: CreateWebhookParams, options?: RequestOptions): Promise<Webhook>;
1507
- get(id: string, options?: RequestOptions): Promise<Webhook>;
1540
+ create(params: CreateWebhookParams, options?: RequestOptions): APIPromise<Webhook>;
1541
+ get(id: string, options?: RequestOptions): APIPromise<Webhook>;
1508
1542
  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>;
1543
+ update(id: string, params: UpdateWebhookParams, options?: RequestOptions): APIPromise<Webhook>;
1544
+ delete(id: string, options?: RequestOptions): APIPromise<void>;
1545
+ listDeliveries(webhookId: string, params?: ListWebhookDeliveriesParams, options?: RequestOptions): APIPromise<WebhookDeliveryListResponse>;
1512
1546
  /** One delivery with its payload and every attempt, oldest first. */
1513
- getDelivery(webhookId: string, deliveryId: string, options?: RequestOptions): Promise<WebhookDeliveryDetail>;
1547
+ getDelivery(webhookId: string, deliveryId: string, options?: RequestOptions): APIPromise<WebhookDeliveryDetail>;
1514
1548
  /**
1515
1549
  * Send a signed sample payload of one event type to the endpoint. The
1516
1550
  * delivery is marked `is_test`, carries `X-Chronary-Test: 1`, makes one
1517
1551
  * attempt and does not count toward the monthly quota. Poll `getDelivery`
1518
1552
  * with the returned `delivery_id` for the result. Limited to 10 per minute.
1519
1553
  */
1520
- sendTest(webhookId: string, params: SendTestWebhookParams, options?: RequestOptions): Promise<WebhookTestSent>;
1554
+ sendTest(webhookId: string, params: SendTestWebhookParams, options?: RequestOptions): APIPromise<WebhookTestSent>;
1521
1555
  /**
1522
1556
  * Send a `failed` or `dropped` delivery again as a new delivery with its
1523
1557
  * own `delivery_id` (Developer or Pro). The stored payload goes out unchanged, signed
@@ -1527,7 +1561,7 @@ declare class WebhooksClient {
1527
1561
  * `Idempotency-Key` (generated, or `options.idempotencyKey`), so a retry
1528
1562
  * returns the same replay. Limited to 30 per minute.
1529
1563
  */
1530
- replayDelivery(webhookId: string, deliveryId: string, options?: RequestOptions): Promise<WebhookReplaySent>;
1564
+ replayDelivery(webhookId: string, deliveryId: string, options?: RequestOptions): APIPromise<WebhookReplaySent>;
1531
1565
  /**
1532
1566
  * Rotate the endpoint's signing secret (Developer or Pro). The new secret is returned
1533
1567
  * once and signs `X-Signature` from the next attempt. The replaced secret
@@ -1535,69 +1569,69 @@ declare class WebhooksClient {
1535
1569
  * (default `24h`; `now` drops it at once), so receivers can switch
1536
1570
  * without rejecting deliveries. `verifySignature` accepts either header.
1537
1571
  */
1538
- rotateSecret(webhookId: string, params?: RotateWebhookSecretParams, options?: RequestOptions): Promise<RotatedWebhookSecret>;
1572
+ rotateSecret(webhookId: string, params?: RotateWebhookSecretParams, options?: RequestOptions): APIPromise<RotatedWebhookSecret>;
1539
1573
  }
1540
1574
 
1541
1575
  declare class ICalSubscriptionsClient {
1542
1576
  private readonly client;
1543
1577
  constructor(client: CoreClient);
1544
- create(agentId: string, params: CreateICalSubscriptionParams, options?: RequestOptions): Promise<ICalSubscription>;
1545
- get(id: string, options?: RequestOptions): Promise<ICalSubscription>;
1578
+ create(agentId: string, params: CreateICalSubscriptionParams, options?: RequestOptions): APIPromise<ICalSubscription>;
1579
+ get(id: string, options?: RequestOptions): APIPromise<ICalSubscription>;
1546
1580
  list(params: ListICalSubscriptionsParams & {
1547
1581
  agentId: string;
1548
1582
  }): PageIterator<ICalSubscription>;
1549
- update(id: string, params: UpdateICalSubscriptionParams, options?: RequestOptions): Promise<ICalSubscription>;
1550
- delete(id: string, options?: RequestOptions): Promise<void>;
1583
+ update(id: string, params: UpdateICalSubscriptionParams, options?: RequestOptions): APIPromise<ICalSubscription>;
1584
+ delete(id: string, options?: RequestOptions): APIPromise<void>;
1551
1585
  /**
1552
1586
  * Start an immediate fetch of the feed. Resolves with `{ status: 'syncing' }`
1553
1587
  * as soon as the fetch has started; read the subscription a few seconds later
1554
1588
  * for `last_synced_at` / `last_error`. A paused feed rejects with 409, and a
1555
1589
  * second sync of the same feed within a minute rejects with 429.
1556
1590
  */
1557
- sync(id: string, options?: RequestOptions): Promise<{
1591
+ sync(id: string, options?: RequestOptions): APIPromise<{
1558
1592
  status: string;
1559
1593
  }>;
1560
1594
  /** Stop polling the feed until it is resumed. Pausing a paused feed changes nothing. */
1561
- pause(id: string, options?: RequestOptions): Promise<ICalSubscription>;
1595
+ pause(id: string, options?: RequestOptions): APIPromise<ICalSubscription>;
1562
1596
  /** Return a paused or failing feed to polling and clear `last_error`. */
1563
- resume(id: string, options?: RequestOptions): Promise<ICalSubscription>;
1597
+ resume(id: string, options?: RequestOptions): APIPromise<ICalSubscription>;
1564
1598
  }
1565
1599
 
1566
1600
  declare class SchedulingClient {
1567
1601
  private readonly client;
1568
1602
  constructor(client: CoreClient);
1569
- create(params: CreateProposalParams, options?: RequestOptions): Promise<ProposalSummary>;
1603
+ create(params: CreateProposalParams, options?: RequestOptions): APIPromise<ProposalSummary>;
1570
1604
  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>;
1605
+ get(id: string, options?: RequestOptions): APIPromise<Proposal>;
1606
+ respond(id: string, params: RespondToProposalParams, options?: RequestOptions): APIPromise<ProposalResponse>;
1607
+ resolve(id: string, options?: RequestOptions): APIPromise<ResolveProposalResponse>;
1608
+ cancel(id: string, options?: RequestOptions): APIPromise<CancelProposalResponse>;
1575
1609
  }
1576
1610
 
1577
1611
  declare class UsageClient {
1578
1612
  private readonly client;
1579
1613
  constructor(client: CoreClient);
1580
- get(options?: RequestOptions): Promise<Usage>;
1614
+ get(options?: RequestOptions): APIPromise<Usage>;
1581
1615
  /**
1582
1616
  * Monthly totals for the last 1-12 UTC calendar months (default 6), oldest
1583
1617
  * first, ending with the current partial month. Org-level keys only; not
1584
1618
  * counted toward API calls.
1585
1619
  */
1586
- history(params?: UsageHistoryParams, options?: RequestOptions): Promise<UsageHistory>;
1620
+ history(params?: UsageHistoryParams, options?: RequestOptions): APIPromise<UsageHistory>;
1587
1621
  }
1588
1622
 
1589
1623
  declare class AuditLogClient {
1590
1624
  private readonly client;
1591
1625
  constructor(client: CoreClient);
1592
- list(params?: ListAuditLogParams, options?: RequestOptions): Promise<AuditLogResponse>;
1626
+ list(params?: ListAuditLogParams, options?: RequestOptions): APIPromise<AuditLogResponse>;
1593
1627
  }
1594
1628
 
1595
1629
  declare class KeysClient {
1596
1630
  private readonly client;
1597
1631
  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>;
1632
+ create(params: CreateScopedApiKeyParams, options?: RequestOptions): APIPromise<CreatedScopedApiKey>;
1633
+ list(options?: RequestOptions): APIPromise<ScopedApiKey[]>;
1634
+ delete(id: string, options?: RequestOptions): APIPromise<void>;
1601
1635
  }
1602
1636
 
1603
1637
  declare class AgentAuthClient {
@@ -1622,7 +1656,7 @@ declare class AgentAuthClient {
1622
1656
  * the currently-published version — retry with the value from the
1623
1657
  * `current_version` field on the error body.
1624
1658
  */
1625
- signUp(params: AgentSignUpParams, options?: RequestOptions): Promise<AgentSignUpResponse>;
1659
+ signUp(params: AgentSignUpParams, options?: RequestOptions): APIPromise<AgentSignUpResponse>;
1626
1660
  /**
1627
1661
  * Submit the OTP sent during `signUp()` to unlock the API key.
1628
1662
  *
@@ -1635,7 +1669,7 @@ declare class AgentAuthClient {
1635
1669
  * API returns 400 for invalid/expired OTPs, which surfaces as a
1636
1670
  * generic `ChronaryError` with the original message.
1637
1671
  */
1638
- verify(params: AgentVerifyParams, options?: RequestOptions): Promise<AgentVerifyResponse>;
1672
+ verify(params: AgentVerifyParams, options?: RequestOptions): APIPromise<AgentVerifyResponse>;
1639
1673
  }
1640
1674
  /**
1641
1675
  * Type guard — narrows an `AgentSignUpResponse` to the new-org branch.
@@ -1665,7 +1699,7 @@ declare class WaitlistClient {
1665
1699
  * @throws ChronaryError (429 `rate_limit_error`) on the per-IP / per-email
1666
1700
  * waitlist limiter.
1667
1701
  */
1668
- join(params: WaitlistJoinParams, options?: RequestOptions): Promise<WaitlistJoinResponse>;
1702
+ join(params: WaitlistJoinParams, options?: RequestOptions): APIPromise<WaitlistJoinResponse>;
1669
1703
  }
1670
1704
 
1671
1705
  declare class FeedbackClient {
@@ -1679,7 +1713,7 @@ declare class FeedbackClient {
1679
1713
  * HTTP 429 with a `Retry-After` header set to the seconds until the
1680
1714
  * next UTC midnight.
1681
1715
  */
1682
- submit(params: SubmitFeedbackParams, options?: RequestOptions): Promise<FeedbackAcceptedResponse>;
1716
+ submit(params: SubmitFeedbackParams, options?: RequestOptions): APIPromise<FeedbackAcceptedResponse>;
1683
1717
  }
1684
1718
 
1685
1719
  declare class PlansClient {
@@ -1692,7 +1726,7 @@ declare class PlansClient {
1692
1726
  * tier with `custom_pricing: true`. No authentication required.
1693
1727
  * Responses are cacheable for 5 minutes at the edge.
1694
1728
  */
1695
- list(options?: RequestOptions): Promise<PlansListResponse>;
1729
+ list(options?: RequestOptions): APIPromise<PlansListResponse>;
1696
1730
  }
1697
1731
 
1698
1732
  declare class AccountClient {
@@ -1714,7 +1748,7 @@ declare class AccountClient {
1714
1748
  *
1715
1749
  * **Rate limit:** 10 exports/hour/org.
1716
1750
  */
1717
- export(options?: RequestOptions): Promise<DataExport>;
1751
+ export(options?: RequestOptions): APIPromise<DataExport>;
1718
1752
  }
1719
1753
 
1720
1754
  declare class TermsClient {
@@ -1732,7 +1766,7 @@ declare class TermsClient {
1732
1766
  * keys cannot accept org-wide terms (403). A stale version returns 409
1733
1767
  * `tos_version_stale` with the current version in the error body.
1734
1768
  */
1735
- accept(params: AcceptTermsParams, options?: RequestOptions): Promise<AcceptTermsResult>;
1769
+ accept(params: AcceptTermsParams, options?: RequestOptions): APIPromise<AcceptTermsResult>;
1736
1770
  }
1737
1771
 
1738
1772
  interface CreateConnectionLinkParams {
@@ -1762,13 +1796,13 @@ interface ListConnectionLinksParams {
1762
1796
  declare class ConnectionLinksClient {
1763
1797
  private readonly client;
1764
1798
  constructor(client: CoreClient);
1765
- create(calendarId: string, params: CreateConnectionLinkParams, options?: RequestOptions): Promise<ConnectionLink>;
1799
+ create(calendarId: string, params: CreateConnectionLinkParams, options?: RequestOptions): APIPromise<ConnectionLink>;
1766
1800
  /** Setup links, newest first. An agent-scoped key sees only its own calendars' links. */
1767
- list(params?: ListConnectionLinksParams, options?: RequestOptions): Promise<{
1801
+ list(params?: ListConnectionLinksParams, options?: RequestOptions): APIPromise<{
1768
1802
  data: ConnectionLink[];
1769
1803
  }>;
1770
- get(id: string, options?: RequestOptions): Promise<ConnectionLink>;
1771
- cancel(id: string, options?: RequestOptions): Promise<void>;
1804
+ get(id: string, options?: RequestOptions): APIPromise<ConnectionLink>;
1805
+ cancel(id: string, options?: RequestOptions): APIPromise<void>;
1772
1806
  }
1773
1807
 
1774
1808
  declare class UpgradeRequestsClient {
@@ -1779,24 +1813,24 @@ declare class UpgradeRequestsClient {
1779
1813
  * Returns an `approval_url` to hand to your human. Honors `idempotencyKey`;
1780
1814
  * if `reused` is true a request is already pending — poll it instead.
1781
1815
  */
1782
- create(params?: CreateUpgradeRequestParams, options?: RequestOptions): Promise<UpgradeRequest>;
1816
+ create(params?: CreateUpgradeRequestParams, options?: RequestOptions): APIPromise<UpgradeRequest>;
1783
1817
  /** Poll an upgrade request (at most once a minute). */
1784
- get(id: string, options?: RequestOptions): Promise<UpgradeRequest>;
1818
+ get(id: string, options?: RequestOptions): APIPromise<UpgradeRequest>;
1785
1819
  /** Withdraw a pending upgrade request. */
1786
- cancel(id: string, options?: RequestOptions): Promise<UpgradeRequest>;
1820
+ cancel(id: string, options?: RequestOptions): APIPromise<UpgradeRequest>;
1787
1821
  }
1788
1822
  declare class BillingClient {
1789
1823
  private readonly client;
1790
1824
  readonly upgradeRequests: UpgradeRequestsClient;
1791
1825
  constructor(client: CoreClient);
1792
1826
  /** Read-only billing summary for the org (plan, status, upgrade options, pending upgrade request). */
1793
- get(options?: RequestOptions): Promise<BillingSummary>;
1827
+ get(options?: RequestOptions): APIPromise<BillingSummary>;
1794
1828
  }
1795
1829
 
1796
1830
  declare function verifySignature(rawBody: string, headers: Headers | Record<string, string>, secret: string, options?: VerifyOptions): Promise<void>;
1797
1831
  declare function constructEvent(rawBody: string, headers: Headers | Record<string, string>, secret: string, options?: VerifyOptions): Promise<WebhookEvent>;
1798
1832
 
1799
- declare const VERSION = "0.8.1";
1833
+ declare const VERSION = "0.10.0";
1800
1834
 
1801
1835
  declare class ChronaryError extends Error {
1802
1836
  readonly status: number;
@@ -1874,4 +1908,4 @@ declare class Chronary {
1874
1908
  }
1875
1909
 
1876
1910
  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 };
1911
+ 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 };