@chronary/sdk 0.7.1 → 0.9.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/CHANGELOG.md +29 -0
- package/README.md +11 -4
- package/dist/index.cjs +317 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +618 -44
- package/dist/index.d.ts +618 -44
- package/dist/index.js +314 -47
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -122,6 +122,10 @@ interface Agent {
|
|
|
122
122
|
metadata: Record<string, unknown>;
|
|
123
123
|
createdAt: string;
|
|
124
124
|
updatedAt: string;
|
|
125
|
+
/** Live calendars owned by the agent; only with `list({ include_counts: true })`. */
|
|
126
|
+
calendar_count?: number;
|
|
127
|
+
/** Live Agent keys for the agent; only with `list({ include_counts: true })`. */
|
|
128
|
+
scoped_key_count?: number;
|
|
125
129
|
}
|
|
126
130
|
interface CreateAgentParams {
|
|
127
131
|
name: string;
|
|
@@ -137,7 +141,16 @@ interface UpdateAgentParams {
|
|
|
137
141
|
}
|
|
138
142
|
interface ListAgentsParams {
|
|
139
143
|
type?: 'ai' | 'human' | 'resource';
|
|
144
|
+
/** Setting a status (including `decommissioned`) returns agents in that status only. */
|
|
140
145
|
status?: 'active' | 'paused' | 'decommissioned';
|
|
146
|
+
/** Case-insensitive substring of the agent name, or an exact agent id. */
|
|
147
|
+
q?: string;
|
|
148
|
+
/** `created_at` (default): newest first. `name`: A to Z. */
|
|
149
|
+
sort?: 'created_at' | 'name';
|
|
150
|
+
/** Decommissioned (deleted) agents are left out unless this is true. */
|
|
151
|
+
include_decommissioned?: boolean;
|
|
152
|
+
/** Add `calendar_count` and `scoped_key_count` to each agent. */
|
|
153
|
+
include_counts?: boolean;
|
|
141
154
|
limit?: number;
|
|
142
155
|
offset?: number;
|
|
143
156
|
}
|
|
@@ -177,6 +190,8 @@ interface UpdateCalendarParams {
|
|
|
177
190
|
interface ListCalendarsParams {
|
|
178
191
|
agentId?: string;
|
|
179
192
|
include?: 'all';
|
|
193
|
+
/** Case-insensitive substring of the calendar name, or an exact calendar id. Org-wide list only (not with `agentId`). */
|
|
194
|
+
q?: string;
|
|
180
195
|
limit?: number;
|
|
181
196
|
offset?: number;
|
|
182
197
|
}
|
|
@@ -228,6 +243,35 @@ interface UpdateBookingPageParams {
|
|
|
228
243
|
interface ListBookingPagesParams {
|
|
229
244
|
limit?: number;
|
|
230
245
|
offset?: number;
|
|
246
|
+
/** Only pages bound to this calendar. */
|
|
247
|
+
calendar_id?: string;
|
|
248
|
+
}
|
|
249
|
+
/** A booking made through a booking page: the event it created plus the invitee's details. */
|
|
250
|
+
interface Booking {
|
|
251
|
+
/** The event the booking created (`evt_…`). */
|
|
252
|
+
id: string;
|
|
253
|
+
booking_page_id: string;
|
|
254
|
+
calendar_id: string;
|
|
255
|
+
start_time: string;
|
|
256
|
+
end_time: string;
|
|
257
|
+
/** The event status, e.g. `confirmed`, or `cancelled` once cancelled. */
|
|
258
|
+
status: string;
|
|
259
|
+
invitee_name: string | null;
|
|
260
|
+
invitee_email: string | null;
|
|
261
|
+
invitee_notes: string | null;
|
|
262
|
+
/** When the booking was made. */
|
|
263
|
+
created_at: string;
|
|
264
|
+
}
|
|
265
|
+
interface ListBookingsParams {
|
|
266
|
+
/** Page size (1–100). Defaults to 50. */
|
|
267
|
+
limit?: number;
|
|
268
|
+
/** The `next_cursor` from the previous page. */
|
|
269
|
+
cursor?: string;
|
|
270
|
+
}
|
|
271
|
+
interface BookingList {
|
|
272
|
+
data: Booking[];
|
|
273
|
+
/** Pass as `cursor` for the next page; null on the last page. */
|
|
274
|
+
next_cursor: string | null;
|
|
231
275
|
}
|
|
232
276
|
/** A single bookable slot returned by the public slots endpoint. */
|
|
233
277
|
interface BookingSlot {
|
|
@@ -288,7 +332,8 @@ interface CalendarEvent {
|
|
|
288
332
|
/** Present only on expanded instances: the occurrence start this instance was generated for. */
|
|
289
333
|
originalStartTime?: string;
|
|
290
334
|
holdExpiresAt: string | null;
|
|
291
|
-
|
|
335
|
+
/** Hold conflict priority (0-100). Never null: 0 unless set on a hold. */
|
|
336
|
+
holdPriority: number;
|
|
292
337
|
deletedAt: string | null;
|
|
293
338
|
createdAt: string;
|
|
294
339
|
updatedAt: string;
|
|
@@ -311,7 +356,7 @@ interface CreateEventParams {
|
|
|
311
356
|
* RFC 5545 RRULE subset (no "RRULE:" prefix), e.g. "FREQ=WEEKLY;BYDAY=MO,WE;COUNT=12" —
|
|
312
357
|
* makes the event a recurring series master. Not allowed with status='hold'.
|
|
313
358
|
* Fails with 400 on an invalid rule; 429 when the plan's active
|
|
314
|
-
* recurring-series cap is reached (free:
|
|
359
|
+
* recurring-series cap is reached (free: 1, Pro: 250 — see
|
|
315
360
|
* `usage.recurring_events`); 403 plan_required when the series is unbounded
|
|
316
361
|
* or ends more than 90 days out on the free plan (Pro allows unbounded).
|
|
317
362
|
*/
|
|
@@ -333,7 +378,7 @@ interface UpdateEventParams {
|
|
|
333
378
|
* "RRULE:" prefix). null clears the rule, turning the series back into a
|
|
334
379
|
* one-off event. Fails with 400 on an invalid rule; 429 when converting a
|
|
335
380
|
* one-off to recurring and the plan's active recurring-series cap is
|
|
336
|
-
* reached (free:
|
|
381
|
+
* reached (free: 1, Pro: 250); 403 plan_required when the series is
|
|
337
382
|
* unbounded or ends more than 90 days out on the free plan (Pro allows
|
|
338
383
|
* unbounded).
|
|
339
384
|
*/
|
|
@@ -356,6 +401,28 @@ interface ListEventsParams {
|
|
|
356
401
|
*/
|
|
357
402
|
expand?: boolean;
|
|
358
403
|
}
|
|
404
|
+
/** Filters for `events.listAll()` — events across the organization's calendars (`GET /v1/events`). */
|
|
405
|
+
interface ListOrgEventsParams {
|
|
406
|
+
/** Only these calendars (at most 50). Sent as repeated `calendar_id` parameters. */
|
|
407
|
+
calendar_id?: string | string[];
|
|
408
|
+
/** Only this agent's calendars. */
|
|
409
|
+
agent_id?: string;
|
|
410
|
+
start_after?: string;
|
|
411
|
+
start_before?: string;
|
|
412
|
+
status?: EventStatus;
|
|
413
|
+
source?: 'internal' | 'external_ical';
|
|
414
|
+
/**
|
|
415
|
+
* Case-insensitive title search. Requires both `start_after` and
|
|
416
|
+
* `start_before`, at most 31 days apart; a window with more than 2,000
|
|
417
|
+
* events returns 400.
|
|
418
|
+
*/
|
|
419
|
+
q?: string;
|
|
420
|
+
/** Expand recurring series within the window (both bounds required, max 366 days). */
|
|
421
|
+
expand?: boolean;
|
|
422
|
+
/** Page size, at most 100. */
|
|
423
|
+
limit?: number;
|
|
424
|
+
offset?: number;
|
|
425
|
+
}
|
|
359
426
|
/** Options for event delete calls — `RequestOptions` plus recurrence controls. */
|
|
360
427
|
interface DeleteEventOptions extends RequestOptions {
|
|
361
428
|
/**
|
|
@@ -477,8 +544,57 @@ interface Webhook {
|
|
|
477
544
|
active: boolean;
|
|
478
545
|
consecutiveFailures: number;
|
|
479
546
|
firstFailureAt: string | null;
|
|
547
|
+
/** Set while a scheduled account deletion has paused this endpoint (`active` is then false). */
|
|
548
|
+
deletionPausedAt?: string | null;
|
|
549
|
+
/** When the endpoint last went inactive; null while it is active. Cleared on re-enable. */
|
|
550
|
+
deactivatedAt?: string | null;
|
|
551
|
+
/** Why the endpoint is inactive; null while it is active. */
|
|
552
|
+
deactivatedReason?: WebhookDeactivatedReason | null;
|
|
553
|
+
/**
|
|
554
|
+
* While a secret rotation's grace window is open, when the replaced secret
|
|
555
|
+
* stops working; deliveries until then also carry `X-Signature-Previous`.
|
|
556
|
+
* Null when no window is open.
|
|
557
|
+
*/
|
|
558
|
+
previousSecretExpiresAt?: string | null;
|
|
480
559
|
createdAt: string;
|
|
481
560
|
}
|
|
561
|
+
/** Why a webhook endpoint is inactive. */
|
|
562
|
+
type WebhookDeactivatedReason = 'manual' | 'circuit_breaker' | 'unsafe_destination_url' | 'account_deletion';
|
|
563
|
+
interface SendTestWebhookParams {
|
|
564
|
+
/** Event type whose sample payload to send. The endpoint must subscribe to it. */
|
|
565
|
+
event_type: string;
|
|
566
|
+
}
|
|
567
|
+
/** When the replaced secret stops working after `webhooks.rotateSecret`; `now` keeps none. */
|
|
568
|
+
type WebhookSecretExpiry = 'now' | '1h' | '24h' | '7d';
|
|
569
|
+
interface RotateWebhookSecretParams {
|
|
570
|
+
/** When the old secret stops signing `X-Signature-Previous`. Default `24h`, at most `7d`. */
|
|
571
|
+
expire_old_in?: WebhookSecretExpiry;
|
|
572
|
+
}
|
|
573
|
+
/** Returned by `webhooks.rotateSecret`: the new secret, shown once. */
|
|
574
|
+
interface RotatedWebhookSecret {
|
|
575
|
+
webhook_id: string;
|
|
576
|
+
secret: string;
|
|
577
|
+
/** When the replaced secret stops working; null when `expire_old_in` was `now`. */
|
|
578
|
+
previous_secret_expires_at: string | null;
|
|
579
|
+
}
|
|
580
|
+
/** Returned by `webhooks.sendTest`: the queued test delivery. */
|
|
581
|
+
interface WebhookTestSent {
|
|
582
|
+
delivery_id: string;
|
|
583
|
+
webhook_id: string;
|
|
584
|
+
event_type: string;
|
|
585
|
+
status: 'pending';
|
|
586
|
+
is_test: true;
|
|
587
|
+
}
|
|
588
|
+
/** Returned by `webhooks.replayDelivery`: the new delivery the replay queued. */
|
|
589
|
+
interface WebhookReplaySent {
|
|
590
|
+
/** The new delivery; poll `getDelivery` with it. */
|
|
591
|
+
delivery_id: string;
|
|
592
|
+
webhook_id: string;
|
|
593
|
+
event_type: string;
|
|
594
|
+
status: 'pending';
|
|
595
|
+
/** The first delivery of the chain, sent as `X-Chronary-Replay-Of`. */
|
|
596
|
+
replay_of_delivery_id: string;
|
|
597
|
+
}
|
|
482
598
|
interface CreateWebhookParams {
|
|
483
599
|
url: string;
|
|
484
600
|
events: string[];
|
|
@@ -492,34 +608,108 @@ interface ListWebhooksParams {
|
|
|
492
608
|
limit?: number;
|
|
493
609
|
offset?: number;
|
|
494
610
|
}
|
|
611
|
+
/**
|
|
612
|
+
* A delivery's state. `dropped` is a delivery the Free plan monthly limit
|
|
613
|
+
* stopped: never sent, counted or retried, with `last_error_code: 'quota_exceeded'`.
|
|
614
|
+
*/
|
|
615
|
+
type WebhookDeliveryStatus = 'pending' | 'delivered' | 'failed' | 'dropped';
|
|
495
616
|
interface WebhookDelivery {
|
|
496
617
|
id: string;
|
|
497
618
|
subscription_id: string;
|
|
498
619
|
event_type: string;
|
|
499
|
-
status:
|
|
620
|
+
status: WebhookDeliveryStatus;
|
|
500
621
|
attempts: number;
|
|
501
622
|
last_attempt_at: string | null;
|
|
502
623
|
next_retry_at: string | null;
|
|
503
624
|
created_at: string;
|
|
625
|
+
/** HTTP status of the most recent attempt; null when no response was received. */
|
|
626
|
+
last_response_status: number | null;
|
|
627
|
+
/** Why the most recent attempt failed; null on success or before the first attempt. */
|
|
628
|
+
last_error_code: WebhookDeliveryErrorCode | null;
|
|
629
|
+
/** Time to response headers of the most recent attempt, in milliseconds. */
|
|
630
|
+
last_duration_ms: number | null;
|
|
631
|
+
/** True for a test event sent with `webhooks.sendTest`. */
|
|
632
|
+
is_test: boolean;
|
|
633
|
+
/**
|
|
634
|
+
* Set on a replay sent with `webhooks.replayDelivery`: the first delivery of
|
|
635
|
+
* the chain (the original, even when a replay is replayed). Null otherwise.
|
|
636
|
+
*/
|
|
637
|
+
replay_of_delivery_id: string | null;
|
|
504
638
|
payload?: Record<string, unknown>;
|
|
505
639
|
}
|
|
640
|
+
/** Why one delivery attempt failed. */
|
|
641
|
+
type WebhookAttemptErrorCode = 'timeout' | 'connection_error' | 'tls_error' | 'redirect_not_followed' | 'unsafe_destination_url' | 'non_2xx';
|
|
642
|
+
/** Codes a delivery's `last_error_code` can hold. */
|
|
643
|
+
type WebhookDeliveryErrorCode = WebhookAttemptErrorCode | 'endpoint_disabled' | 'quota_exceeded';
|
|
644
|
+
/** One HTTP attempt of a webhook delivery. */
|
|
645
|
+
interface WebhookDeliveryAttempt {
|
|
646
|
+
id: string;
|
|
647
|
+
/** 1-based. */
|
|
648
|
+
attempt_number: number;
|
|
649
|
+
started_at: string;
|
|
650
|
+
/** Null when no request was made. */
|
|
651
|
+
duration_ms: number | null;
|
|
652
|
+
/** Null when no response was received. */
|
|
653
|
+
response_status: number | null;
|
|
654
|
+
/** Up to the first 2 KB of the response body; null when empty or redacted. */
|
|
655
|
+
response_body: string | null;
|
|
656
|
+
/** Null on success. */
|
|
657
|
+
error_code: WebhookAttemptErrorCode | null;
|
|
658
|
+
}
|
|
659
|
+
/** One webhook delivery with its payload and attempt timeline. */
|
|
660
|
+
interface WebhookDeliveryDetail extends Omit<WebhookDelivery, 'payload'> {
|
|
661
|
+
/** Attempts allowed by the organization's current plan. */
|
|
662
|
+
max_attempts: number;
|
|
663
|
+
payload: unknown;
|
|
664
|
+
/** True when the payload was redacted under the retention policy. */
|
|
665
|
+
payload_redacted: boolean;
|
|
666
|
+
/** Stable request headers; signature headers change per attempt and are not stored. */
|
|
667
|
+
request_headers: {
|
|
668
|
+
'content-type': 'application/json';
|
|
669
|
+
'x-delivery-id': string;
|
|
670
|
+
'x-chronary-event-type': string;
|
|
671
|
+
/** Only on a replay: the delivery in `replay_of_delivery_id`. */
|
|
672
|
+
'x-chronary-replay-of'?: string;
|
|
673
|
+
};
|
|
674
|
+
/** Every attempt, oldest first. */
|
|
675
|
+
attempt_log: WebhookDeliveryAttempt[];
|
|
676
|
+
}
|
|
506
677
|
interface WebhookDeliveryStats {
|
|
507
678
|
pending: number;
|
|
508
679
|
delivered: number;
|
|
509
680
|
failed: number;
|
|
681
|
+
/** Deliveries the Free plan monthly limit stopped. */
|
|
682
|
+
dropped: number;
|
|
510
683
|
}
|
|
511
684
|
interface WebhookDeliveryListResponse {
|
|
512
685
|
data: WebhookDelivery[];
|
|
686
|
+
/** Deliveries matching the filters, ignoring the cursor and offset. */
|
|
513
687
|
total: number;
|
|
514
688
|
limit: number;
|
|
515
689
|
offset: number;
|
|
690
|
+
/** Pass as `cursor` for the next page; null on the last page. */
|
|
691
|
+
next_cursor: string | null;
|
|
692
|
+
has_more: boolean;
|
|
693
|
+
/** All-time counts per status. */
|
|
516
694
|
stats: WebhookDeliveryStats;
|
|
517
695
|
}
|
|
518
696
|
interface ListWebhookDeliveriesParams {
|
|
519
697
|
limit?: number;
|
|
698
|
+
/** Cannot be combined with `cursor`. */
|
|
520
699
|
offset?: number;
|
|
521
|
-
status?:
|
|
700
|
+
status?: WebhookDeliveryStatus;
|
|
522
701
|
include_payload?: boolean;
|
|
702
|
+
/** An exact event type (`event.created`), or a prefix ending in a dot (`event.`). */
|
|
703
|
+
event_type?: string;
|
|
704
|
+
/** ISO 8601 (UTC); inclusive. */
|
|
705
|
+
created_after?: string;
|
|
706
|
+
/** ISO 8601 (UTC); exclusive. */
|
|
707
|
+
created_before?: string;
|
|
708
|
+
delivery_id?: string;
|
|
709
|
+
/** `true` for test events only, `false` to leave them out. */
|
|
710
|
+
is_test?: boolean;
|
|
711
|
+
/** The `next_cursor` from the previous page. */
|
|
712
|
+
cursor?: string;
|
|
523
713
|
}
|
|
524
714
|
interface ICalSubscription {
|
|
525
715
|
id: string;
|
|
@@ -547,7 +737,12 @@ interface ListICalSubscriptionsParams {
|
|
|
547
737
|
limit?: number;
|
|
548
738
|
offset?: number;
|
|
549
739
|
}
|
|
550
|
-
|
|
740
|
+
/**
|
|
741
|
+
* `resolving` is the brief state while a resolve creates the event; it returns
|
|
742
|
+
* to `pending` if the resolve fails. `confirmed`, `expired` and `cancelled`
|
|
743
|
+
* are terminal.
|
|
744
|
+
*/
|
|
745
|
+
type ProposalStatus = 'pending' | 'resolving' | 'confirmed' | 'expired' | 'cancelled';
|
|
551
746
|
interface ProposalSlot {
|
|
552
747
|
id?: string;
|
|
553
748
|
start_time: string;
|
|
@@ -617,19 +812,36 @@ type ResolveProposalResponse = {
|
|
|
617
812
|
interface CancelProposalResponse {
|
|
618
813
|
status: 'cancelled';
|
|
619
814
|
}
|
|
815
|
+
/** Which surface created an API key. `unknown` for keys created before this was recorded. */
|
|
816
|
+
type KeyCreatedVia = 'signup' | 'console' | 'api' | 'mcp' | 'unknown';
|
|
620
817
|
interface ScopedApiKey {
|
|
621
818
|
id: string;
|
|
622
819
|
key_prefix: string;
|
|
623
820
|
agent_id: string;
|
|
624
821
|
label: string | null;
|
|
625
822
|
created_at: string;
|
|
823
|
+
/** When the key last authenticated a request. Approximate; updated at most every 5 minutes. `null` if never used. */
|
|
824
|
+
last_used_at: string | null;
|
|
825
|
+
/** The `User-Agent` of the request recorded in `last_used_at` (first 256 characters). */
|
|
826
|
+
last_used_user_agent: string | null;
|
|
827
|
+
created_via: KeyCreatedVia;
|
|
828
|
+
/** Prefix of the Organization key that created this key. Set for `api` and `mcp`, otherwise `null`. */
|
|
829
|
+
created_by_key_prefix: string | null;
|
|
830
|
+
/** Free-text note about the key, set in the console. */
|
|
831
|
+
note: string | null;
|
|
832
|
+
/** When the key stops working; after it, requests fail with 401 `key_expired`. `null` = never expires. */
|
|
833
|
+
expires_at: string | null;
|
|
626
834
|
}
|
|
627
835
|
interface CreatedScopedApiKey extends ScopedApiKey {
|
|
628
836
|
key: string;
|
|
629
837
|
}
|
|
838
|
+
/** How long a new key works (#593). Omit for a key that never expires. */
|
|
839
|
+
type KeyExpiresIn = '30d' | '60d' | '90d' | '180d' | '365d';
|
|
630
840
|
interface CreateScopedApiKeyParams {
|
|
631
841
|
agent_id: string;
|
|
632
842
|
label?: string;
|
|
843
|
+
/** When the key stops working, from now. Omit for a key that never expires. */
|
|
844
|
+
expires_in?: KeyExpiresIn;
|
|
633
845
|
}
|
|
634
846
|
interface AcceptTermsParams {
|
|
635
847
|
/** The terms-of-service version to accept; must equal the current version. */
|
|
@@ -645,15 +857,17 @@ interface UsageMetric {
|
|
|
645
857
|
}
|
|
646
858
|
/**
|
|
647
859
|
* Temporal-hold lifecycle counters for the current period. Informational —
|
|
648
|
-
* not gated by any plan limit.
|
|
649
|
-
*
|
|
650
|
-
*
|
|
651
|
-
*
|
|
860
|
+
* not gated by any plan limit. `created`, `confirmed` and `expired` are
|
|
861
|
+
* monthly counters; `expired` covers all three end-of-hold paths: TTL expiry,
|
|
862
|
+
* manual release, and priority-bump. `active` is a live count of unexpired
|
|
863
|
+
* holds, not a monthly counter.
|
|
652
864
|
*/
|
|
653
865
|
interface HoldsUsage {
|
|
654
866
|
created: number;
|
|
655
867
|
confirmed: number;
|
|
656
868
|
expired: number;
|
|
869
|
+
/** Live count of unexpired holds right now (not a monthly counter). */
|
|
870
|
+
active: number;
|
|
657
871
|
}
|
|
658
872
|
/**
|
|
659
873
|
* Availability requests that touched more than one calendar in the current
|
|
@@ -666,6 +880,10 @@ interface CrossCalendarQueriesUsage {
|
|
|
666
880
|
interface Usage {
|
|
667
881
|
period_start: string;
|
|
668
882
|
period_end: string;
|
|
883
|
+
/** First instant of the next UTC month, when monthly counters reset (ISO 8601). */
|
|
884
|
+
resets_at: string;
|
|
885
|
+
/** When this response was computed (ISO 8601). API calls can lag by up to 30 seconds. */
|
|
886
|
+
generated_at: string;
|
|
669
887
|
plan: string;
|
|
670
888
|
agents: UsageMetric;
|
|
671
889
|
calendars: UsageMetric;
|
|
@@ -675,18 +893,68 @@ interface Usage {
|
|
|
675
893
|
availability_queries: UsageMetric;
|
|
676
894
|
ical_subscriptions: UsageMetric;
|
|
677
895
|
proposals: UsageMetric;
|
|
678
|
-
/** Active recurring series masters vs. the plan cap (free:
|
|
896
|
+
/** Active recurring series masters vs. the plan cap (free: 1, Pro: 250; null = unlimited). */
|
|
679
897
|
recurring_events: UsageMetric;
|
|
680
898
|
/** Active booking pages vs. the plan cap (free: 1, Pro: 25; null = unlimited). */
|
|
681
899
|
booking_pages: UsageMetric;
|
|
682
900
|
holds: HoldsUsage;
|
|
683
901
|
cross_calendar_queries: CrossCalendarQueriesUsage;
|
|
684
902
|
}
|
|
903
|
+
interface UsageHistoryParams {
|
|
904
|
+
/** Number of UTC calendar months to return, 1-12 (default 6). */
|
|
905
|
+
months?: number;
|
|
906
|
+
}
|
|
907
|
+
interface UsageHistoryMonth {
|
|
908
|
+
/** UTC calendar month, `YYYY-MM`. */
|
|
909
|
+
period: string;
|
|
910
|
+
period_start: string;
|
|
911
|
+
period_end: string;
|
|
912
|
+
/** True only for the current, partial month (the last entry). */
|
|
913
|
+
is_current: boolean;
|
|
914
|
+
metrics: {
|
|
915
|
+
api_calls: number;
|
|
916
|
+
events: number;
|
|
917
|
+
webhook_deliveries: number;
|
|
918
|
+
availability_queries: number;
|
|
919
|
+
proposals: number;
|
|
920
|
+
holds_created: number;
|
|
921
|
+
holds_confirmed: number;
|
|
922
|
+
holds_expired: number;
|
|
923
|
+
cross_calendar_queries: number;
|
|
924
|
+
};
|
|
925
|
+
}
|
|
926
|
+
interface UsageHistory {
|
|
927
|
+
plan: string;
|
|
928
|
+
months: number;
|
|
929
|
+
/** The current plan's limits (history does not record past plans); `null` = unlimited. */
|
|
930
|
+
limits: {
|
|
931
|
+
api_calls: number | null;
|
|
932
|
+
events: number | null;
|
|
933
|
+
webhook_deliveries: number | null;
|
|
934
|
+
availability_queries: number | null;
|
|
935
|
+
proposals: number | null;
|
|
936
|
+
};
|
|
937
|
+
/** Oldest month first; the last entry is the current month. */
|
|
938
|
+
data: UsageHistoryMonth[];
|
|
939
|
+
}
|
|
940
|
+
type AuditActorType = 'session' | 'org_key' | 'agent_key' | 'system';
|
|
941
|
+
type AuditStatusClass = '2xx' | '3xx' | '4xx' | '5xx';
|
|
942
|
+
type AuditCategory = 'account' | 'keys' | 'agents' | 'calendars' | 'events' | 'scheduling' | 'webhooks' | 'human_calendars' | 'billing' | 'security';
|
|
685
943
|
interface AuditLogEntry {
|
|
686
944
|
id: string;
|
|
687
945
|
action: string;
|
|
688
|
-
/** First 20 chars of the actor API key. Never the full key. */
|
|
946
|
+
/** First 20 chars of the actor API key. Never the full key; null for console sessions. */
|
|
689
947
|
actor_key_prefix: string | null;
|
|
948
|
+
/**
|
|
949
|
+
* Who acted: a console `session`, the Organization key (`org_key`), an
|
|
950
|
+
* Agent key (`agent_key`), or Chronary itself (`system`). Null on older
|
|
951
|
+
* entries that could not be attributed.
|
|
952
|
+
*/
|
|
953
|
+
actor_type: AuditActorType | null;
|
|
954
|
+
/** API key id for a key, the organization id for a console session, null for the system. */
|
|
955
|
+
actor_id: string | null;
|
|
956
|
+
/** Display name: key label (or key prefix), session email, or "Chronary". */
|
|
957
|
+
actor_label: string | null;
|
|
690
958
|
/** Scoped-key agent ID when the actor used a chr_ak_* key. */
|
|
691
959
|
agent_id: string | null;
|
|
692
960
|
/** Entity IDs extracted from the request path (e.g. "agt_1/cal_2"). */
|
|
@@ -705,10 +973,25 @@ interface ListAuditLogParams {
|
|
|
705
973
|
from?: string;
|
|
706
974
|
/** Upper bound (inclusive, ISO-8601). Defaults to now. */
|
|
707
975
|
to?: string;
|
|
708
|
-
/**
|
|
976
|
+
/**
|
|
977
|
+
* Filter by exact action name, e.g. "agent.create". Legacy names
|
|
978
|
+
* (key.create, key.delete, key.regenerate) are matched by their current names.
|
|
979
|
+
*/
|
|
709
980
|
action?: string;
|
|
710
981
|
/** Filter by the first 20 chars of the actor API key. */
|
|
711
982
|
actor_key_prefix?: string;
|
|
983
|
+
/** Filter by who acted. */
|
|
984
|
+
actor_type?: AuditActorType;
|
|
985
|
+
/** Filter by actor id (an API key id, or the organization id for console sessions). */
|
|
986
|
+
actor_id?: string;
|
|
987
|
+
/** Filter by the request id of the original call. */
|
|
988
|
+
request_id?: string;
|
|
989
|
+
/** Filter by an entity id the request touched, or a bare id prefix such as "cal_". */
|
|
990
|
+
resource?: string;
|
|
991
|
+
/** Filter by response status class. */
|
|
992
|
+
status_class?: AuditStatusClass;
|
|
993
|
+
/** Filter by action category (legacy action names included). */
|
|
994
|
+
category?: AuditCategory;
|
|
712
995
|
/** Opaque cursor from a previous response for keyset pagination. */
|
|
713
996
|
cursor?: string;
|
|
714
997
|
/** Page size (1–200). Defaults to 50. */
|
|
@@ -722,7 +1005,7 @@ interface AuditLogResponse {
|
|
|
722
1005
|
};
|
|
723
1006
|
/**
|
|
724
1007
|
* Audit-log retention window for the caller's plan (days).
|
|
725
|
-
* Null =
|
|
1008
|
+
* Null = no fixed window (Custom plan: per contract).
|
|
726
1009
|
*/
|
|
727
1010
|
retention_days: number | null;
|
|
728
1011
|
/**
|
|
@@ -731,7 +1014,7 @@ interface AuditLogResponse {
|
|
|
731
1014
|
*/
|
|
732
1015
|
range_clamped: boolean;
|
|
733
1016
|
}
|
|
734
|
-
type PlanId = 'free' | 'pro' | 'custom';
|
|
1017
|
+
type PlanId = 'free' | 'developer' | 'pro' | 'custom';
|
|
735
1018
|
interface PlanLimits {
|
|
736
1019
|
agents: number | null;
|
|
737
1020
|
calendars: number | null;
|
|
@@ -754,11 +1037,13 @@ interface Plan {
|
|
|
754
1037
|
price: number | null;
|
|
755
1038
|
/** Lowercase ISO-4217 code. `null` for custom-priced tiers. */
|
|
756
1039
|
currency: string | null;
|
|
1040
|
+
/** Yearly amount in the smallest currency unit (10x monthly) when the plan can be billed annually. `null` for Free and custom-priced tiers. */
|
|
1041
|
+
annual_price?: number | null;
|
|
757
1042
|
/** Enforced caps. `null` for custom-priced tiers. */
|
|
758
1043
|
limits: PlanLimits | null;
|
|
759
1044
|
/** Marketing copy — not machine-readable. Use `limits` for capability checks. */
|
|
760
1045
|
display_features: string[];
|
|
761
|
-
/** Hint for UIs to highlight
|
|
1046
|
+
/** Hint for UIs to highlight one tier (currently `pro`). */
|
|
762
1047
|
recommended: boolean;
|
|
763
1048
|
/** Present and `true` for the enterprise tier. */
|
|
764
1049
|
custom_pricing?: boolean;
|
|
@@ -796,14 +1081,30 @@ interface AgentSignUpNewOrgResponse {
|
|
|
796
1081
|
interface AgentSignUpExistingOrgResponse {
|
|
797
1082
|
message: string;
|
|
798
1083
|
}
|
|
799
|
-
|
|
1084
|
+
/**
|
|
1085
|
+
* HTTP 202 while sign-ups are paused (waitlist mode or early access full). No
|
|
1086
|
+
* key is issued, and the body is the same for every address: new, already
|
|
1087
|
+
* waitlisted, or with an existing account.
|
|
1088
|
+
*/
|
|
1089
|
+
interface AgentSignUpWaitlistedResponse {
|
|
1090
|
+
waitlisted: true;
|
|
1091
|
+
message: string;
|
|
1092
|
+
}
|
|
1093
|
+
type AgentSignUpResponse = AgentSignUpNewOrgResponse | AgentSignUpExistingOrgResponse | AgentSignUpWaitlistedResponse;
|
|
800
1094
|
interface AgentVerifyParams {
|
|
801
1095
|
/** Six-digit numeric code from the verification email. */
|
|
802
1096
|
otp: string;
|
|
803
1097
|
}
|
|
804
1098
|
interface AgentVerifyResponse {
|
|
805
1099
|
verified: true;
|
|
806
|
-
/**
|
|
1100
|
+
/**
|
|
1101
|
+
* `promoted`: the org left the Sandbox tier. `capacity_full`: the email is
|
|
1102
|
+
* verified, but early access is full, so the org keeps Sandbox limits until
|
|
1103
|
+
* a spot opens (an `org.plan_changed` webhook announces the move).
|
|
1104
|
+
* `null`: the org was not on Sandbox.
|
|
1105
|
+
*/
|
|
1106
|
+
sandbox_promotion: 'promoted' | 'capacity_full' | null;
|
|
1107
|
+
/** Human-readable confirmation; explains the Sandbox hold when `capacity_full`. */
|
|
807
1108
|
message: string;
|
|
808
1109
|
}
|
|
809
1110
|
interface WaitlistJoinParams {
|
|
@@ -813,7 +1114,13 @@ interface WaitlistJoinParams {
|
|
|
813
1114
|
name?: string;
|
|
814
1115
|
/** Optional ToS version string the caller has accepted. */
|
|
815
1116
|
tos_version?: string;
|
|
1117
|
+
/** Optional "what are you building?" note, up to 200 characters. */
|
|
1118
|
+
intent?: string;
|
|
816
1119
|
}
|
|
1120
|
+
/**
|
|
1121
|
+
* @deprecated The waitlist join no longer returns the entry; see
|
|
1122
|
+
* {@link WaitlistJoinResponse}. Kept so existing imports still compile.
|
|
1123
|
+
*/
|
|
817
1124
|
interface WaitlistedOrg {
|
|
818
1125
|
id: string;
|
|
819
1126
|
name: string;
|
|
@@ -822,11 +1129,15 @@ interface WaitlistedOrg {
|
|
|
822
1129
|
waitlisted_at: string;
|
|
823
1130
|
signup_source: string;
|
|
824
1131
|
}
|
|
1132
|
+
/**
|
|
1133
|
+
* `POST /v1/waitlist` → HTTP 202. The same body for a new email, one already on
|
|
1134
|
+
* the list and one with an active account; no entry fields are returned.
|
|
1135
|
+
*/
|
|
825
1136
|
interface WaitlistJoinResponse {
|
|
826
|
-
|
|
1137
|
+
waitlisted: true;
|
|
827
1138
|
message: string;
|
|
828
1139
|
}
|
|
829
|
-
type FeedbackType = 'bug' | 'feature' | 'friction';
|
|
1140
|
+
type FeedbackType = 'bug' | 'feature' | 'friction' | 'support';
|
|
830
1141
|
interface SubmitFeedbackParams {
|
|
831
1142
|
type: FeedbackType;
|
|
832
1143
|
/** Free-text description, 10–2000 characters. */
|
|
@@ -837,7 +1148,7 @@ interface SubmitFeedbackParams {
|
|
|
837
1148
|
interface FeedbackAcceptedResponse {
|
|
838
1149
|
status: 'accepted';
|
|
839
1150
|
}
|
|
840
|
-
type WebhookEventType = 'agent.created' | 'agent.updated' | 'event.created' | 'event.updated' | 'event.deleted' | 'event.started' | 'event.ended' | 'event.reminder' | 'event.hold_created' | 'event.hold_expired' | 'event.hold_released' | 'event.hold_confirmed' | 'proposal.created' | 'proposal.responded' | 'proposal.confirmed' | 'proposal.expired' | 'proposal.cancelled' | 'webhook.deactivated';
|
|
1151
|
+
type WebhookEventType = 'agent.created' | 'agent.updated' | 'event.created' | 'event.updated' | 'event.deleted' | 'event.started' | 'event.ended' | 'event.reminder' | 'event.hold_created' | 'event.hold_expired' | 'event.hold_released' | 'event.hold_confirmed' | 'proposal.created' | 'proposal.responded' | 'proposal.confirmed' | 'proposal.expired' | 'proposal.cancelled' | 'webhook.deactivated' | 'org.plan_changed' | 'calendar_connection.reauthorization_required' | 'usage.threshold_crossed';
|
|
841
1152
|
interface WebhookEvent {
|
|
842
1153
|
type: WebhookEventType;
|
|
843
1154
|
data: Record<string, unknown>;
|
|
@@ -847,9 +1158,14 @@ interface VerifyOptions {
|
|
|
847
1158
|
}
|
|
848
1159
|
/**
|
|
849
1160
|
* Response shape for `GET /v1/auth/export` (GDPR Art. 15 + 20 portability).
|
|
850
|
-
* Encrypted fields (event titles/descriptions,
|
|
851
|
-
* are returned in plaintext.
|
|
852
|
-
*
|
|
1161
|
+
* Encrypted data fields (event titles/descriptions, Connection labels,
|
|
1162
|
+
* external calendar names) are returned in plaintext. Secrets (webhook
|
|
1163
|
+
* secrets, iCal URLs and feed tokens, Human calendar provider identifiers)
|
|
1164
|
+
* are `'[redacted]'` unless `include_secrets=true` is passed from a session
|
|
1165
|
+
* that signed in within the last 5 minutes. Sensitive fields (key hashes,
|
|
1166
|
+
* password hashes, OTP hashes, claim revocation tokens, internal scheduling
|
|
1167
|
+
* state) and Human calendar provider credentials are never exported. An
|
|
1168
|
+
* export over the synchronous size limit fails with 413 `export_too_large`.
|
|
853
1169
|
*/
|
|
854
1170
|
interface DataExport {
|
|
855
1171
|
exported_at: string;
|
|
@@ -886,8 +1202,143 @@ interface DataExport {
|
|
|
886
1202
|
account_claims_initiated: unknown[];
|
|
887
1203
|
account_claims_targeting_this_org: unknown[];
|
|
888
1204
|
feedback_submissions: unknown[];
|
|
1205
|
+
upgrade_requests: unknown[];
|
|
1206
|
+
booking_pages: unknown[];
|
|
1207
|
+
audit_log: unknown[];
|
|
1208
|
+
provider_accounts: unknown[];
|
|
1209
|
+
external_calendars: unknown[];
|
|
1210
|
+
availability_grants: unknown[];
|
|
1211
|
+
publication_bindings: unknown[];
|
|
1212
|
+
connection_setup_links: unknown[];
|
|
1213
|
+
webhook_deliveries: unknown[];
|
|
1214
|
+
}
|
|
1215
|
+
type BillingInterval = 'month' | 'year';
|
|
1216
|
+
type UpgradeRequestStatus = 'pending' | 'completed' | 'declined' | 'canceled' | 'expired';
|
|
1217
|
+
interface BillingPrice {
|
|
1218
|
+
/** Minor units (2900 = $29). */
|
|
1219
|
+
amount: number;
|
|
1220
|
+
currency: string;
|
|
1221
|
+
interval: BillingInterval;
|
|
1222
|
+
tax_exclusive: true;
|
|
1223
|
+
}
|
|
1224
|
+
interface BillingUpgradeOption {
|
|
1225
|
+
plan: 'developer' | 'pro';
|
|
1226
|
+
interval: BillingInterval;
|
|
1227
|
+
amount: number;
|
|
1228
|
+
currency: string;
|
|
1229
|
+
savings_vs_monthly: number;
|
|
1230
|
+
/**
|
|
1231
|
+
* How the owner buys it: `checkout` (no live subscription yet) or
|
|
1232
|
+
* `switch_plan` (a live subscriber moves up from the console Billing page). Agents
|
|
1233
|
+
* cannot do either; they ask with `billing.upgradeRequests.create`.
|
|
1234
|
+
*/
|
|
1235
|
+
via?: 'checkout' | 'switch_plan';
|
|
1236
|
+
}
|
|
1237
|
+
interface UpgradeRequest {
|
|
1238
|
+
id: string;
|
|
1239
|
+
status: UpgradeRequestStatus;
|
|
1240
|
+
plan: 'developer' | 'pro';
|
|
1241
|
+
interval: BillingInterval;
|
|
1242
|
+
/** Agent free text. Render as escaped plain text only. */
|
|
1243
|
+
reason: string | null;
|
|
1244
|
+
feature: string | null;
|
|
1245
|
+
metric: string | null;
|
|
1246
|
+
requested_via: 'api' | 'mcp';
|
|
1247
|
+
/** First 20 characters of the requesting key — never the full key. */
|
|
1248
|
+
requested_by_key_prefix: string | null;
|
|
1249
|
+
/** Give this URL to your human. Null once the request is terminal. */
|
|
1250
|
+
approval_url: string | null;
|
|
1251
|
+
created_at: string;
|
|
1252
|
+
expires_at: string;
|
|
1253
|
+
completed_at: string | null;
|
|
1254
|
+
declined_at: string | null;
|
|
1255
|
+
canceled_at: string | null;
|
|
1256
|
+
/** Create responses only. */
|
|
1257
|
+
owner_notification?: 'queued' | 'not_configured' | 'skipped_internal' | 'already_notified' | 'muted';
|
|
1258
|
+
/** Create responses only: true when an already-pending request was returned. */
|
|
1259
|
+
reused?: boolean;
|
|
1260
|
+
}
|
|
1261
|
+
interface BillingSummary {
|
|
1262
|
+
plan: string;
|
|
1263
|
+
plan_source: string | null;
|
|
1264
|
+
plan_expires_at: string | null;
|
|
1265
|
+
status: string | null;
|
|
1266
|
+
interval: BillingInterval | null;
|
|
1267
|
+
current_period_end: string | null;
|
|
1268
|
+
cancel_at: string | null;
|
|
1269
|
+
cancel_at_period_end: boolean;
|
|
1270
|
+
renews_at: string | null;
|
|
1271
|
+
/** A plan switch scheduled for the end of the period (Pro down to Developer): the plan it moves to. `plan` stays until then. */
|
|
1272
|
+
pending_plan?: string | null;
|
|
1273
|
+
/** Billing interval after the scheduled switch. */
|
|
1274
|
+
pending_plan_interval?: BillingInterval | null;
|
|
1275
|
+
/** When the scheduled switch takes effect. */
|
|
1276
|
+
pending_plan_at?: string | null;
|
|
1277
|
+
price: BillingPrice | null;
|
|
1278
|
+
has_billing_account: boolean;
|
|
1279
|
+
self_serve_upgrade: boolean;
|
|
1280
|
+
upgrade_options: BillingUpgradeOption[];
|
|
1281
|
+
upgrade_url: string | null;
|
|
1282
|
+
manage_url: string;
|
|
1283
|
+
contact_url: string | null;
|
|
1284
|
+
pending_upgrade_request: UpgradeRequest | null;
|
|
1285
|
+
/** Founding-member offer for early-access accounts; null otherwise. */
|
|
1286
|
+
offer: BillingOffer | null;
|
|
1287
|
+
/** While `status` is `past_due`: the failed payment. Null otherwise. */
|
|
1288
|
+
past_due: BillingPastDue | null;
|
|
1289
|
+
/** Account credit; applied automatically to the next invoices while the subscription renews. Null when there is none. */
|
|
1290
|
+
credit: BillingCredit | null;
|
|
1291
|
+
}
|
|
1292
|
+
/** Account credit, for example the unused part of a yearly period after a switch to monthly billing. */
|
|
1293
|
+
interface BillingCredit {
|
|
1294
|
+
/** Minor units (cents), always positive. */
|
|
1295
|
+
amount: number;
|
|
1296
|
+
currency: string;
|
|
1297
|
+
}
|
|
1298
|
+
/** The failed payment behind a `past_due` subscription. */
|
|
1299
|
+
interface BillingPastDue {
|
|
1300
|
+
/** Minor units (cents), tax included. */
|
|
1301
|
+
amount_due: number;
|
|
1302
|
+
currency: string;
|
|
1303
|
+
failed_at: string;
|
|
1304
|
+
/** Next automatic retry; null when no retries are left. */
|
|
1305
|
+
next_payment_attempt: string | null;
|
|
1306
|
+
/** Where a human can pay the open invoice. */
|
|
1307
|
+
hosted_invoice_url: string | null;
|
|
1308
|
+
attempt_count: number;
|
|
1309
|
+
}
|
|
1310
|
+
/**
|
|
1311
|
+
* Founding-member offer. `upcoming`: early-access account, the offer opens at
|
|
1312
|
+
* launch. `available`: free Pro until `ends_at`, subscribe before then at the
|
|
1313
|
+
* discount. `redeemed`: the subscription was created on founding terms.
|
|
1314
|
+
*/
|
|
1315
|
+
interface BillingOffer {
|
|
1316
|
+
kind: 'founding';
|
|
1317
|
+
status: 'upcoming' | 'available' | 'redeemed';
|
|
1318
|
+
ends_at: string | null;
|
|
1319
|
+
trial_until: string | null;
|
|
1320
|
+
discount_percent: number | null;
|
|
1321
|
+
discount_months: number | null;
|
|
1322
|
+
/**
|
|
1323
|
+
* redeemed: `required` while a Washington DC trial waits for the human to
|
|
1324
|
+
* choose "Continue to paid Pro" in the console (else it ends at the trial
|
|
1325
|
+
* end, unbilled); `given` once they have. Null otherwise.
|
|
1326
|
+
*/
|
|
1327
|
+
renewal_consent: 'required' | 'given' | null;
|
|
1328
|
+
}
|
|
1329
|
+
interface CreateUpgradeRequestParams {
|
|
1330
|
+
/** Billing interval to request. Defaults to `month`. */
|
|
1331
|
+
interval?: BillingInterval;
|
|
1332
|
+
/** Why the upgrade is needed (max 500 chars). Shown to the human approver. */
|
|
1333
|
+
reason?: string;
|
|
1334
|
+
/** Plan-gated feature that was blocked, e.g. `scoped_keys`. */
|
|
1335
|
+
feature?: string;
|
|
1336
|
+
/** Quota metric that was exhausted, e.g. `api_calls`. */
|
|
1337
|
+
metric?: string;
|
|
889
1338
|
}
|
|
890
1339
|
|
|
1340
|
+
/** A query parameter value; an array is sent as repeated parameters (`?k=a&k=b`). */
|
|
1341
|
+
type QueryValue = string | number | boolean | undefined | readonly string[];
|
|
891
1342
|
declare class CoreClient {
|
|
892
1343
|
readonly baseUrl: string;
|
|
893
1344
|
private readonly apiKey;
|
|
@@ -899,7 +1350,7 @@ declare class CoreClient {
|
|
|
899
1350
|
private readonly extraHeaders;
|
|
900
1351
|
constructor(config?: ChronaryConfig);
|
|
901
1352
|
private log;
|
|
902
|
-
request<T>(method: string, path: string, body?: unknown, query?: Record<string,
|
|
1353
|
+
request<T>(method: string, path: string, body?: unknown, query?: Record<string, QueryValue>, options?: RequestOptions): APIPromise<T>;
|
|
903
1354
|
private _request;
|
|
904
1355
|
private buildUrl;
|
|
905
1356
|
private buildError;
|
|
@@ -939,6 +1390,12 @@ declare class CalendarsClient {
|
|
|
939
1390
|
list(params?: ListCalendarsParams): PageIterator<Calendar>;
|
|
940
1391
|
update(id: string, params: UpdateCalendarParams, options?: RequestOptions): Promise<Calendar>;
|
|
941
1392
|
delete(id: string, options?: RequestOptions): Promise<void>;
|
|
1393
|
+
/**
|
|
1394
|
+
* Regenerate the calendar's iCal subscribe URL. The old URL stops working
|
|
1395
|
+
* (copies cached elsewhere can be served for up to 5 minutes); returns the
|
|
1396
|
+
* calendar with its new `ical_url`. Organization keys only.
|
|
1397
|
+
*/
|
|
1398
|
+
rotateIcalToken(id: string, options?: RequestOptions): Promise<Calendar>;
|
|
942
1399
|
getContext(id: string, options?: RequestOptions): Promise<CalendarContext>;
|
|
943
1400
|
setAvailabilityRules(id: string, params: SetAvailabilityRulesParams, options?: RequestOptions): Promise<AvailabilityRules>;
|
|
944
1401
|
getAvailabilityRules(id: string, options?: RequestOptions): Promise<AvailabilityRules>;
|
|
@@ -953,6 +1410,18 @@ declare class BookingPagesClient {
|
|
|
953
1410
|
list(params?: ListBookingPagesParams): PageIterator<BookingPage>;
|
|
954
1411
|
update(id: string, params: UpdateBookingPageParams, options?: RequestOptions): Promise<BookingPage>;
|
|
955
1412
|
delete(id: string, options?: RequestOptions): Promise<void>;
|
|
1413
|
+
/**
|
|
1414
|
+
* One page of the bookings made through a booking page, newest start first,
|
|
1415
|
+
* with the invitee's details. Pass the returned `next_cursor` as `cursor`
|
|
1416
|
+
* for the next page (null on the last page). Bookings made before this
|
|
1417
|
+
* endpoint was released are not linked to their page.
|
|
1418
|
+
*/
|
|
1419
|
+
listBookings(id: string, params?: ListBookingsParams, options?: RequestOptions): Promise<BookingList>;
|
|
1420
|
+
/**
|
|
1421
|
+
* Replace the page's public link. The old `/book/<slug>` stops working at
|
|
1422
|
+
* once; returns the page with its new `slug` and `booking_url`.
|
|
1423
|
+
*/
|
|
1424
|
+
rotateSlug(id: string, options?: RequestOptions): Promise<BookingPage>;
|
|
956
1425
|
/**
|
|
957
1426
|
* Public: list available slots for a booking page by its slug. No API key is
|
|
958
1427
|
* required for this endpoint (the slug is the credential); any key set on the
|
|
@@ -976,6 +1445,12 @@ declare class EventsClient {
|
|
|
976
1445
|
create(calendarId: string, params: CreateEventParams, options?: RequestOptions): Promise<CalendarEvent>;
|
|
977
1446
|
get(calendarId: string, eventId: string, options?: RequestOptions): Promise<CalendarEvent>;
|
|
978
1447
|
list(params?: ListEventsParams): PageIterator<CalendarEvent>;
|
|
1448
|
+
/**
|
|
1449
|
+
* List events across all of the organization's calendars (`GET /v1/events`),
|
|
1450
|
+
* ordered by start time. An agent-scoped key sees only its agent's
|
|
1451
|
+
* calendars. `q` searches titles and needs a window of at most 31 days.
|
|
1452
|
+
*/
|
|
1453
|
+
listAll(params?: ListOrgEventsParams): PageIterator<CalendarEvent>;
|
|
979
1454
|
update(calendarId: string, eventId: string, params: UpdateEventParams, options?: RequestOptions): Promise<CalendarEvent>;
|
|
980
1455
|
/**
|
|
981
1456
|
* Delete an event (or, for a recurring series, the whole series). Pass
|
|
@@ -1034,6 +1509,33 @@ declare class WebhooksClient {
|
|
|
1034
1509
|
update(id: string, params: UpdateWebhookParams, options?: RequestOptions): Promise<Webhook>;
|
|
1035
1510
|
delete(id: string, options?: RequestOptions): Promise<void>;
|
|
1036
1511
|
listDeliveries(webhookId: string, params?: ListWebhookDeliveriesParams, options?: RequestOptions): Promise<WebhookDeliveryListResponse>;
|
|
1512
|
+
/** One delivery with its payload and every attempt, oldest first. */
|
|
1513
|
+
getDelivery(webhookId: string, deliveryId: string, options?: RequestOptions): Promise<WebhookDeliveryDetail>;
|
|
1514
|
+
/**
|
|
1515
|
+
* Send a signed sample payload of one event type to the endpoint. The
|
|
1516
|
+
* delivery is marked `is_test`, carries `X-Chronary-Test: 1`, makes one
|
|
1517
|
+
* attempt and does not count toward the monthly quota. Poll `getDelivery`
|
|
1518
|
+
* with the returned `delivery_id` for the result. Limited to 10 per minute.
|
|
1519
|
+
*/
|
|
1520
|
+
sendTest(webhookId: string, params: SendTestWebhookParams, options?: RequestOptions): Promise<WebhookTestSent>;
|
|
1521
|
+
/**
|
|
1522
|
+
* Send a `failed` or `dropped` delivery again as a new delivery with its
|
|
1523
|
+
* own `delivery_id` (Developer or Pro). The stored payload goes out unchanged, signed
|
|
1524
|
+
* with the endpoint's current secret, with an `X-Chronary-Replay-Of`
|
|
1525
|
+
* header. It follows the normal retry schedule and counts toward the
|
|
1526
|
+
* monthly delivery quota. The endpoint must be active. Sent with an
|
|
1527
|
+
* `Idempotency-Key` (generated, or `options.idempotencyKey`), so a retry
|
|
1528
|
+
* returns the same replay. Limited to 30 per minute.
|
|
1529
|
+
*/
|
|
1530
|
+
replayDelivery(webhookId: string, deliveryId: string, options?: RequestOptions): Promise<WebhookReplaySent>;
|
|
1531
|
+
/**
|
|
1532
|
+
* Rotate the endpoint's signing secret (Developer or Pro). The new secret is returned
|
|
1533
|
+
* once and signs `X-Signature` from the next attempt. The replaced secret
|
|
1534
|
+
* keeps signing `X-Signature-Previous` until `expire_old_in` has passed
|
|
1535
|
+
* (default `24h`; `now` drops it at once), so receivers can switch
|
|
1536
|
+
* without rejecting deliveries. `verifySignature` accepts either header.
|
|
1537
|
+
*/
|
|
1538
|
+
rotateSecret(webhookId: string, params?: RotateWebhookSecretParams, options?: RequestOptions): Promise<RotatedWebhookSecret>;
|
|
1037
1539
|
}
|
|
1038
1540
|
|
|
1039
1541
|
declare class ICalSubscriptionsClient {
|
|
@@ -1046,9 +1548,19 @@ declare class ICalSubscriptionsClient {
|
|
|
1046
1548
|
}): PageIterator<ICalSubscription>;
|
|
1047
1549
|
update(id: string, params: UpdateICalSubscriptionParams, options?: RequestOptions): Promise<ICalSubscription>;
|
|
1048
1550
|
delete(id: string, options?: RequestOptions): Promise<void>;
|
|
1551
|
+
/**
|
|
1552
|
+
* Start an immediate fetch of the feed. Resolves with `{ status: 'syncing' }`
|
|
1553
|
+
* as soon as the fetch has started; read the subscription a few seconds later
|
|
1554
|
+
* for `last_synced_at` / `last_error`. A paused feed rejects with 409, and a
|
|
1555
|
+
* second sync of the same feed within a minute rejects with 429.
|
|
1556
|
+
*/
|
|
1049
1557
|
sync(id: string, options?: RequestOptions): Promise<{
|
|
1050
1558
|
status: string;
|
|
1051
1559
|
}>;
|
|
1560
|
+
/** Stop polling the feed until it is resumed. Pausing a paused feed changes nothing. */
|
|
1561
|
+
pause(id: string, options?: RequestOptions): Promise<ICalSubscription>;
|
|
1562
|
+
/** Return a paused or failing feed to polling and clear `last_error`. */
|
|
1563
|
+
resume(id: string, options?: RequestOptions): Promise<ICalSubscription>;
|
|
1052
1564
|
}
|
|
1053
1565
|
|
|
1054
1566
|
declare class SchedulingClient {
|
|
@@ -1066,6 +1578,12 @@ declare class UsageClient {
|
|
|
1066
1578
|
private readonly client;
|
|
1067
1579
|
constructor(client: CoreClient);
|
|
1068
1580
|
get(options?: RequestOptions): Promise<Usage>;
|
|
1581
|
+
/**
|
|
1582
|
+
* Monthly totals for the last 1-12 UTC calendar months (default 6), oldest
|
|
1583
|
+
* first, ending with the current partial month. Org-level keys only; not
|
|
1584
|
+
* counted toward API calls.
|
|
1585
|
+
*/
|
|
1586
|
+
history(params?: UsageHistoryParams, options?: RequestOptions): Promise<UsageHistory>;
|
|
1069
1587
|
}
|
|
1070
1588
|
|
|
1071
1589
|
declare class AuditLogClient {
|
|
@@ -1130,19 +1648,18 @@ declare class WaitlistClient {
|
|
|
1130
1648
|
private readonly client;
|
|
1131
1649
|
constructor(client: CoreClient);
|
|
1132
1650
|
/**
|
|
1133
|
-
* Join the Chronary waitlist
|
|
1134
|
-
*
|
|
1135
|
-
*
|
|
1651
|
+
* Join the Chronary waitlist. Used while open sign-up is gated. Adds the
|
|
1652
|
+
* email to the waitlist; an account is created only when a founder approves
|
|
1653
|
+
* it and the person accepts the emailed invite.
|
|
1136
1654
|
*
|
|
1137
1655
|
* No authentication required — invoke on a `Chronary` client constructed
|
|
1138
1656
|
* with no `apiKey`.
|
|
1139
1657
|
*
|
|
1140
|
-
*
|
|
1141
|
-
* the
|
|
1142
|
-
*
|
|
1658
|
+
* Always resolves to the same `{ waitlisted: true, message }` (HTTP 202),
|
|
1659
|
+
* whether the email is new, already on the list, or has an active account,
|
|
1660
|
+
* so the response can't be used to look up other people's accounts. Only a
|
|
1661
|
+
* new email is sent the confirmation email.
|
|
1143
1662
|
*
|
|
1144
|
-
* @throws ChronaryError (409 `email_taken`) when an active account already
|
|
1145
|
-
* exists for this email — direct the user to sign-in instead.
|
|
1146
1663
|
* @throws ChronaryError (409 `tos_version_stale`) when the supplied
|
|
1147
1664
|
* `tos_version` doesn't match the currently-published version.
|
|
1148
1665
|
* @throws ChronaryError (429 `rate_limit_error`) on the per-IP / per-email
|
|
@@ -1155,7 +1672,7 @@ declare class FeedbackClient {
|
|
|
1155
1672
|
private readonly client;
|
|
1156
1673
|
constructor(client: CoreClient);
|
|
1157
1674
|
/**
|
|
1158
|
-
* Submit structured feedback (bug, feature, or
|
|
1675
|
+
* Submit structured feedback (bug, feature, friction, or support) to Chronary.
|
|
1159
1676
|
*
|
|
1160
1677
|
* Rate-limited to 25 submissions per day per organization (UTC day).
|
|
1161
1678
|
* Available on all plans, including free. The 26th submission returns
|
|
@@ -1171,7 +1688,7 @@ declare class PlansClient {
|
|
|
1171
1688
|
/**
|
|
1172
1689
|
* Fetch the public plan catalog (`GET /v1/plans`).
|
|
1173
1690
|
*
|
|
1174
|
-
* Returns all sellable tiers (free,
|
|
1691
|
+
* Returns all sellable tiers (free, developer, pro) plus the enterprise
|
|
1175
1692
|
* tier with `custom_pricing: true`. No authentication required.
|
|
1176
1693
|
* Responses are cacheable for 5 minutes at the edge.
|
|
1177
1694
|
*/
|
|
@@ -1222,50 +1739,105 @@ interface CreateConnectionLinkParams {
|
|
|
1222
1739
|
capabilities: Array<'availability' | 'publishing'>;
|
|
1223
1740
|
publication_policy?: 'none' | 'confirmed' | 'confirmed_tentative';
|
|
1224
1741
|
}
|
|
1742
|
+
type ConnectionLinkStatus = 'awaiting_human' | 'in_progress' | 'completed' | 'declined' | 'expired' | 'cancelled';
|
|
1225
1743
|
interface ConnectionLink {
|
|
1226
1744
|
id: string;
|
|
1227
1745
|
calendar_id: string;
|
|
1228
1746
|
setup_url?: string | null;
|
|
1229
|
-
status:
|
|
1747
|
+
status: ConnectionLinkStatus;
|
|
1230
1748
|
expires_at: string;
|
|
1231
1749
|
connection_id?: string | null;
|
|
1232
1750
|
reused?: boolean;
|
|
1751
|
+
requesting_agent_id?: string | null;
|
|
1752
|
+
requested_capabilities?: Array<'availability' | 'publishing'>;
|
|
1753
|
+
requested_publication_policy?: 'confirmed' | 'confirmed_tentative' | null;
|
|
1754
|
+
created_at?: string;
|
|
1755
|
+
}
|
|
1756
|
+
interface ListConnectionLinksParams {
|
|
1757
|
+
status?: ConnectionLinkStatus;
|
|
1758
|
+
calendar_id?: string;
|
|
1759
|
+
/** 1–100, default 50. */
|
|
1760
|
+
limit?: number;
|
|
1233
1761
|
}
|
|
1234
1762
|
declare class ConnectionLinksClient {
|
|
1235
1763
|
private readonly client;
|
|
1236
1764
|
constructor(client: CoreClient);
|
|
1237
1765
|
create(calendarId: string, params: CreateConnectionLinkParams, options?: RequestOptions): Promise<ConnectionLink>;
|
|
1766
|
+
/** Setup links, newest first. An agent-scoped key sees only its own calendars' links. */
|
|
1767
|
+
list(params?: ListConnectionLinksParams, options?: RequestOptions): Promise<{
|
|
1768
|
+
data: ConnectionLink[];
|
|
1769
|
+
}>;
|
|
1238
1770
|
get(id: string, options?: RequestOptions): Promise<ConnectionLink>;
|
|
1239
1771
|
cancel(id: string, options?: RequestOptions): Promise<void>;
|
|
1240
1772
|
}
|
|
1241
1773
|
|
|
1774
|
+
declare class UpgradeRequestsClient {
|
|
1775
|
+
private readonly client;
|
|
1776
|
+
constructor(client: CoreClient);
|
|
1777
|
+
/**
|
|
1778
|
+
* Ask a human to upgrade this account's plan. Org keys (`chr_sk_`) only.
|
|
1779
|
+
* Returns an `approval_url` to hand to your human. Honors `idempotencyKey`;
|
|
1780
|
+
* if `reused` is true a request is already pending — poll it instead.
|
|
1781
|
+
*/
|
|
1782
|
+
create(params?: CreateUpgradeRequestParams, options?: RequestOptions): Promise<UpgradeRequest>;
|
|
1783
|
+
/** Poll an upgrade request (at most once a minute). */
|
|
1784
|
+
get(id: string, options?: RequestOptions): Promise<UpgradeRequest>;
|
|
1785
|
+
/** Withdraw a pending upgrade request. */
|
|
1786
|
+
cancel(id: string, options?: RequestOptions): Promise<UpgradeRequest>;
|
|
1787
|
+
}
|
|
1788
|
+
declare class BillingClient {
|
|
1789
|
+
private readonly client;
|
|
1790
|
+
readonly upgradeRequests: UpgradeRequestsClient;
|
|
1791
|
+
constructor(client: CoreClient);
|
|
1792
|
+
/** Read-only billing summary for the org (plan, status, upgrade options, pending upgrade request). */
|
|
1793
|
+
get(options?: RequestOptions): Promise<BillingSummary>;
|
|
1794
|
+
}
|
|
1795
|
+
|
|
1242
1796
|
declare function verifySignature(rawBody: string, headers: Headers | Record<string, string>, secret: string, options?: VerifyOptions): Promise<void>;
|
|
1243
1797
|
declare function constructEvent(rawBody: string, headers: Headers | Record<string, string>, secret: string, options?: VerifyOptions): Promise<WebhookEvent>;
|
|
1244
1798
|
|
|
1245
|
-
declare const VERSION = "0.
|
|
1799
|
+
declare const VERSION = "0.9.0";
|
|
1246
1800
|
|
|
1247
1801
|
declare class ChronaryError extends Error {
|
|
1248
1802
|
readonly status: number;
|
|
1249
1803
|
readonly requestId: string | undefined;
|
|
1250
1804
|
readonly headers: Headers | undefined;
|
|
1251
1805
|
readonly errorType: string | undefined;
|
|
1252
|
-
|
|
1806
|
+
/** Raw `error` object from the response body (all server-provided fields). */
|
|
1807
|
+
readonly body: Record<string, unknown> | undefined;
|
|
1808
|
+
/** Where a human can upgrade the plan (plan_required / quota_exceeded errors). */
|
|
1809
|
+
readonly upgradeUrl: string | undefined;
|
|
1810
|
+
readonly docsUrl: string | undefined;
|
|
1811
|
+
readonly requiredPlan: string | undefined;
|
|
1812
|
+
/** Self-serve plan `upgradeUrl` leads to: the next plan up (quota_exceeded and count-cap errors). */
|
|
1813
|
+
readonly upgradePlan: string | undefined;
|
|
1814
|
+
readonly feature: string | undefined;
|
|
1815
|
+
readonly contactUrl: string | undefined;
|
|
1816
|
+
/** Quota metric that was exhausted (quota_exceeded errors). */
|
|
1817
|
+
readonly metric: string | undefined;
|
|
1818
|
+
readonly limit: number | undefined;
|
|
1819
|
+
constructor(message: string, status: number, requestId?: string, headers?: Headers, errorType?: string, body?: Record<string, unknown>);
|
|
1253
1820
|
}
|
|
1254
1821
|
declare class AuthenticationError extends ChronaryError {
|
|
1255
|
-
constructor(message: string, requestId?: string, headers?: Headers);
|
|
1822
|
+
constructor(message: string, requestId?: string, headers?: Headers, body?: Record<string, unknown>);
|
|
1256
1823
|
}
|
|
1257
1824
|
declare class RateLimitError extends ChronaryError {
|
|
1258
1825
|
readonly retryAfter: number | undefined;
|
|
1259
|
-
constructor(message: string, requestId?: string, headers?: Headers);
|
|
1826
|
+
constructor(message: string, requestId?: string, headers?: Headers, body?: Record<string, unknown>);
|
|
1260
1827
|
}
|
|
1261
1828
|
declare class NotFoundError extends ChronaryError {
|
|
1262
|
-
constructor(message: string, requestId?: string, headers?: Headers);
|
|
1829
|
+
constructor(message: string, requestId?: string, headers?: Headers, body?: Record<string, unknown>);
|
|
1263
1830
|
}
|
|
1264
1831
|
declare class ValidationError extends ChronaryError {
|
|
1265
|
-
constructor(message: string, status: number, requestId?: string, headers?: Headers);
|
|
1832
|
+
constructor(message: string, status: number, requestId?: string, headers?: Headers, body?: Record<string, unknown>);
|
|
1266
1833
|
}
|
|
1834
|
+
/** Quota exhausted (HTTP 429 `quota_exceeded`, or legacy 402). Carries `metric`, `limit`, `upgradeUrl`. */
|
|
1267
1835
|
declare class QuotaExceededError extends ChronaryError {
|
|
1268
|
-
constructor(message: string, requestId?: string, headers?: Headers);
|
|
1836
|
+
constructor(message: string, requestId?: string, headers?: Headers, body?: Record<string, unknown>, status?: number);
|
|
1837
|
+
}
|
|
1838
|
+
/** The plan does not include this feature (HTTP 403 `plan_required`). Carries `requiredPlan`, `feature`, `upgradeUrl`, `docsUrl`. */
|
|
1839
|
+
declare class PlanRequiredError extends ChronaryError {
|
|
1840
|
+
constructor(message: string, requestId?: string, headers?: Headers, body?: Record<string, unknown>);
|
|
1269
1841
|
}
|
|
1270
1842
|
declare class TimeoutError extends ChronaryError {
|
|
1271
1843
|
constructor(message: string);
|
|
@@ -1293,6 +1865,7 @@ declare class Chronary {
|
|
|
1293
1865
|
readonly account: AccountClient;
|
|
1294
1866
|
readonly terms: TermsClient;
|
|
1295
1867
|
readonly connectionLinks: ConnectionLinksClient;
|
|
1868
|
+
readonly billing: BillingClient;
|
|
1296
1869
|
constructor(config?: ChronaryConfig);
|
|
1297
1870
|
static webhooks: {
|
|
1298
1871
|
verifySignature: typeof verifySignature;
|
|
@@ -1300,4 +1873,5 @@ declare class Chronary {
|
|
|
1300
1873
|
};
|
|
1301
1874
|
}
|
|
1302
1875
|
|
|
1303
|
-
export { APIPromise,
|
|
1876
|
+
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 };
|