@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.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var VERSION = "0.8.1";
2
+ var VERSION = "0.10.0";
3
3
 
4
4
  // src/error.ts
5
5
  function str(body, key) {
@@ -101,47 +101,62 @@ var ConnectionError = class extends ChronaryError {
101
101
  };
102
102
 
103
103
  // src/api-promise.ts
104
- var APIPromise = class {
105
- innerPromise;
104
+ var APIPromise = class _APIPromise extends Promise {
105
+ responsePromise;
106
+ parsedPromise;
106
107
  constructor(responsePromise) {
107
- this.innerPromise = responsePromise;
108
+ super((resolve) => resolve(null));
109
+ this.responsePromise = responsePromise;
110
+ }
111
+ /**
112
+ * Derived promises (the result of `.then()` and friends) are plain
113
+ * `Promise`s, so the custom constructor above is never invoked with an
114
+ * executor.
115
+ */
116
+ static get [Symbol.species]() {
117
+ return Promise;
108
118
  }
109
119
  /**
110
120
  * Returns both the parsed data and the raw HTTP response.
111
121
  */
112
122
  async withResponse() {
113
- const { data, rawResponse } = await this.innerPromise;
123
+ const { data, rawResponse } = await this.responsePromise;
114
124
  return { data, response: rawResponse };
115
125
  }
116
126
  /**
117
- * Implements the thenable interface. When awaited, resolves to just the parsed data `T`.
127
+ * Maps the parsed data while keeping the raw response, so a resource method
128
+ * that post-processes the body still supports `.withResponse()`.
129
+ *
130
+ * @internal
118
131
  */
119
- then(onfulfilled, onrejected) {
120
- return this.innerPromise.then(
121
- (result) => onfulfilled ? onfulfilled(result.data) : result.data,
122
- onrejected
132
+ _thenUnwrap(transform) {
133
+ return new _APIPromise(
134
+ this.responsePromise.then(({ data, rawResponse }) => ({ data: transform(data), rawResponse }))
123
135
  );
124
136
  }
137
+ parse() {
138
+ if (!this.parsedPromise) {
139
+ this.parsedPromise = this.responsePromise.then((result) => result.data);
140
+ }
141
+ return this.parsedPromise;
142
+ }
143
+ /**
144
+ * When awaited, resolves to just the parsed data `T`.
145
+ */
146
+ then(onfulfilled, onrejected) {
147
+ return this.parse().then(onfulfilled, onrejected);
148
+ }
125
149
  /**
126
150
  * Attaches a rejection handler.
127
151
  */
128
152
  catch(onrejected) {
129
- return this.then(void 0, onrejected);
153
+ return this.parse().catch(onrejected);
130
154
  }
131
155
  /**
132
156
  * Attaches a handler that runs on both fulfillment and rejection.
133
157
  */
134
158
  finally(onfinally) {
135
- return this.then(
136
- (value) => {
137
- onfinally?.();
138
- return value;
139
- },
140
- (reason) => {
141
- onfinally?.();
142
- throw reason;
143
- }
144
- );
159
+ return this.parse().finally(onfinally);
145
160
  }
146
161
  };
147
162
 
@@ -283,11 +298,12 @@ var CoreClient = class {
283
298
  const data = await response.json();
284
299
  return { data, rawResponse };
285
300
  }
286
- if (RETRYABLE_STATUS_CODES.has(response.status) && attempt < this.maxRetries) {
287
- lastError = await this.buildError(response, requestId);
301
+ const error = await this.buildError(response, requestId);
302
+ if (RETRYABLE_STATUS_CODES.has(response.status) && attempt < this.maxRetries && !(error instanceof QuotaExceededError)) {
303
+ lastError = error;
288
304
  continue;
289
305
  }
290
- throw await this.buildError(response, requestId);
306
+ throw error;
291
307
  } catch (err) {
292
308
  clearTimeout(timeoutId);
293
309
  options?.signal?.removeEventListener("abort", abortFromCaller);
@@ -457,10 +473,10 @@ var AgentsClient = class {
457
473
  * Register your agent with Chronary. Creates a Chronary identity for an agent
458
474
  * that already exists in your system, so it can own calendars, events, and webhooks.
459
475
  */
460
- async create(params, options) {
476
+ create(params, options) {
461
477
  return this.client.request("POST", "/v1/agents", params, void 0, options);
462
478
  }
463
- async get(id, options) {
479
+ get(id, options) {
464
480
  return this.client.request("GET", `/v1/agents/${id}`, void 0, void 0, options);
465
481
  }
466
482
  list(params = {}) {
@@ -475,11 +491,11 @@ var AgentsClient = class {
475
491
  offset
476
492
  );
477
493
  }
478
- async update(id, params, options) {
494
+ update(id, params, options) {
479
495
  return this.client.request("PATCH", `/v1/agents/${id}`, params, void 0, options);
480
496
  }
481
- async delete(id, options) {
482
- await this.client.request("DELETE", `/v1/agents/${id}`, void 0, void 0, options);
497
+ delete(id, options) {
498
+ return this.client.request("DELETE", `/v1/agents/${id}`, void 0, void 0, options)._thenUnwrap(() => void 0);
483
499
  }
484
500
  };
485
501
 
@@ -489,12 +505,12 @@ var CalendarsClient = class {
489
505
  this.client = client;
490
506
  }
491
507
  client;
492
- async create(params, options) {
508
+ create(params, options) {
493
509
  const { agentId, ...body } = params;
494
510
  const path = agentId ? `/v1/agents/${agentId}/calendars` : "/v1/calendars";
495
511
  return this.client.request("POST", path, body, void 0, options);
496
512
  }
497
- async get(id, options) {
513
+ get(id, options) {
498
514
  return this.client.request("GET", `/v1/calendars/${id}`, void 0, void 0, options);
499
515
  }
500
516
  list(params = {}) {
@@ -510,21 +526,21 @@ var CalendarsClient = class {
510
526
  offset
511
527
  );
512
528
  }
513
- async update(id, params, options) {
529
+ update(id, params, options) {
514
530
  return this.client.request("PATCH", `/v1/calendars/${id}`, params, void 0, options);
515
531
  }
516
- async delete(id, options) {
517
- await this.client.request("DELETE", `/v1/calendars/${id}`, void 0, void 0, options);
532
+ delete(id, options) {
533
+ return this.client.request("DELETE", `/v1/calendars/${id}`, void 0, void 0, options)._thenUnwrap(() => void 0);
518
534
  }
519
535
  /**
520
536
  * Regenerate the calendar's iCal subscribe URL. The old URL stops working
521
537
  * (copies cached elsewhere can be served for up to 5 minutes); returns the
522
538
  * calendar with its new `ical_url`. Organization keys only.
523
539
  */
524
- async rotateIcalToken(id, options) {
540
+ rotateIcalToken(id, options) {
525
541
  return this.client.request("POST", `/v1/calendars/${id}/ical-token/rotate`, void 0, void 0, options);
526
542
  }
527
- async getContext(id, options) {
543
+ getContext(id, options) {
528
544
  return this.client.request(
529
545
  "GET",
530
546
  `/v1/calendars/${id}/context`,
@@ -533,7 +549,7 @@ var CalendarsClient = class {
533
549
  options
534
550
  );
535
551
  }
536
- async setAvailabilityRules(id, params, options) {
552
+ setAvailabilityRules(id, params, options) {
537
553
  return this.client.request(
538
554
  "PUT",
539
555
  `/v1/calendars/${id}/availability-rules`,
@@ -542,7 +558,7 @@ var CalendarsClient = class {
542
558
  options
543
559
  );
544
560
  }
545
- async getAvailabilityRules(id, options) {
561
+ getAvailabilityRules(id, options) {
546
562
  return this.client.request(
547
563
  "GET",
548
564
  `/v1/calendars/${id}/availability-rules`,
@@ -551,14 +567,14 @@ var CalendarsClient = class {
551
567
  options
552
568
  );
553
569
  }
554
- async deleteAvailabilityRules(id, options) {
555
- await this.client.request(
570
+ deleteAvailabilityRules(id, options) {
571
+ return this.client.request(
556
572
  "DELETE",
557
573
  `/v1/calendars/${id}/availability-rules`,
558
574
  void 0,
559
575
  void 0,
560
576
  options
561
- );
577
+ )._thenUnwrap(() => void 0);
562
578
  }
563
579
  };
564
580
 
@@ -568,10 +584,10 @@ var BookingPagesClient = class {
568
584
  this.client = client;
569
585
  }
570
586
  client;
571
- async create(params, options) {
587
+ create(params, options) {
572
588
  return this.client.request("POST", "/v1/booking-pages", params, void 0, options);
573
589
  }
574
- async get(id, options) {
590
+ get(id, options) {
575
591
  return this.client.request("GET", `/v1/booking-pages/${id}`, void 0, void 0, options);
576
592
  }
577
593
  list(params = {}) {
@@ -586,11 +602,11 @@ var BookingPagesClient = class {
586
602
  offset
587
603
  );
588
604
  }
589
- async update(id, params, options) {
605
+ update(id, params, options) {
590
606
  return this.client.request("PATCH", `/v1/booking-pages/${id}`, params, void 0, options);
591
607
  }
592
- async delete(id, options) {
593
- await this.client.request("DELETE", `/v1/booking-pages/${id}`, void 0, void 0, options);
608
+ delete(id, options) {
609
+ return this.client.request("DELETE", `/v1/booking-pages/${id}`, void 0, void 0, options)._thenUnwrap(() => void 0);
594
610
  }
595
611
  /**
596
612
  * One page of the bookings made through a booking page, newest start first,
@@ -598,14 +614,14 @@ var BookingPagesClient = class {
598
614
  * for the next page (null on the last page). Bookings made before this
599
615
  * endpoint was released are not linked to their page.
600
616
  */
601
- async listBookings(id, params = {}, options) {
617
+ listBookings(id, params = {}, options) {
602
618
  return this.client.request("GET", `/v1/booking-pages/${id}/bookings`, void 0, { ...params }, options);
603
619
  }
604
620
  /**
605
621
  * Replace the page's public link. The old `/book/<slug>` stops working at
606
622
  * once; returns the page with its new `slug` and `booking_url`.
607
623
  */
608
- async rotateSlug(id, options) {
624
+ rotateSlug(id, options) {
609
625
  return this.client.request("POST", `/v1/booking-pages/${id}/rotate-slug`, void 0, void 0, options);
610
626
  }
611
627
  /**
@@ -613,7 +629,7 @@ var BookingPagesClient = class {
613
629
  * required for this endpoint (the slug is the credential); any key set on the
614
630
  * client is simply ignored by the server.
615
631
  */
616
- async listSlots(slug, params = {}, options) {
632
+ listSlots(slug, params = {}, options) {
617
633
  return this.client.request("GET", `/book/${slug}/slots`, void 0, params, options);
618
634
  }
619
635
  /**
@@ -621,7 +637,7 @@ var BookingPagesClient = class {
621
637
  * on the underlying calendar and fires an `event.created` webhook with a
622
638
  * `booking_page_id` correlation field.
623
639
  */
624
- async submit(slug, params, options) {
640
+ submit(slug, params, options) {
625
641
  return this.client.request("POST", `/book/${slug}`, params, void 0, options);
626
642
  }
627
643
  };
@@ -632,7 +648,7 @@ var EventsClient = class {
632
648
  this.client = client;
633
649
  }
634
650
  client;
635
- async create(calendarId, params, options) {
651
+ create(calendarId, params, options) {
636
652
  return this.client.request(
637
653
  "POST",
638
654
  `/v1/calendars/${calendarId}/events`,
@@ -641,7 +657,7 @@ var EventsClient = class {
641
657
  options
642
658
  );
643
659
  }
644
- async get(calendarId, eventId, options) {
660
+ get(calendarId, eventId, options) {
645
661
  return this.client.request(
646
662
  "GET",
647
663
  `/v1/calendars/${calendarId}/events/${eventId}`,
@@ -687,7 +703,7 @@ var EventsClient = class {
687
703
  offset
688
704
  );
689
705
  }
690
- async update(calendarId, eventId, params, options) {
706
+ update(calendarId, eventId, params, options) {
691
707
  return this.client.request(
692
708
  "PATCH",
693
709
  `/v1/calendars/${calendarId}/events/${eventId}`,
@@ -704,7 +720,7 @@ var EventsClient = class {
704
720
  * the timestamp is not an active occurrence, or 409 if the event is not a
705
721
  * recurring series.
706
722
  */
707
- async delete(calendarId, eventId, options) {
723
+ delete(calendarId, eventId, options) {
708
724
  const { occurrence_start, ...requestOptions } = options ?? {};
709
725
  return this.client.request(
710
726
  "DELETE",
@@ -718,7 +734,7 @@ var EventsClient = class {
718
734
  * Fetch an event by ID alone. The calendar is resolved internally from the
719
735
  * event, so no calendar ID is required.
720
736
  */
721
- async getById(eventId, options) {
737
+ getById(eventId, options) {
722
738
  return this.client.request(
723
739
  "GET",
724
740
  `/v1/events/${eventId}`,
@@ -731,7 +747,7 @@ var EventsClient = class {
731
747
  * Update an event by ID alone. The calendar is resolved internally from the
732
748
  * event, so no calendar ID is required.
733
749
  */
734
- async updateById(eventId, params, options) {
750
+ updateById(eventId, params, options) {
735
751
  return this.client.request(
736
752
  "PATCH",
737
753
  `/v1/events/${eventId}`,
@@ -748,7 +764,7 @@ var EventsClient = class {
748
764
  * `occurrence_start`, fails with 400 if the timestamp is not an active
749
765
  * occurrence, or 409 if the event is not a recurring series.
750
766
  */
751
- async deleteById(eventId, options) {
767
+ deleteById(eventId, options) {
752
768
  const { occurrence_start, ...requestOptions } = options ?? {};
753
769
  return this.client.request(
754
770
  "DELETE",
@@ -762,7 +778,7 @@ var EventsClient = class {
762
778
  * Promote a held event (status='hold') to status='confirmed'. Fails with 409
763
779
  * if the event is not a hold, or if the hold has already expired.
764
780
  */
765
- async confirm(eventId, options) {
781
+ confirm(eventId, options) {
766
782
  return this.client.request(
767
783
  "PUT",
768
784
  `/v1/events/${eventId}/confirm`,
@@ -775,7 +791,7 @@ var EventsClient = class {
775
791
  * Manually release a held event before its TTL, freeing the slot. Fails with
776
792
  * 409 if the event is not a hold.
777
793
  */
778
- async release(eventId, options) {
794
+ release(eventId, options) {
779
795
  return this.client.request(
780
796
  "PUT",
781
797
  `/v1/events/${eventId}/release`,
@@ -792,7 +808,7 @@ var AvailabilityClient = class {
792
808
  this.client = client;
793
809
  }
794
810
  client;
795
- async forAgent(agentId, params, options) {
811
+ forAgent(agentId, params, options) {
796
812
  return this.client.request(
797
813
  "GET",
798
814
  `/v1/agents/${agentId}/availability`,
@@ -808,7 +824,7 @@ var AvailabilityClient = class {
808
824
  options
809
825
  );
810
826
  }
811
- async forCalendar(calendarId, params, options) {
827
+ forCalendar(calendarId, params, options) {
812
828
  return this.client.request(
813
829
  "GET",
814
830
  `/v1/calendars/${calendarId}/availability`,
@@ -824,7 +840,7 @@ var AvailabilityClient = class {
824
840
  options
825
841
  );
826
842
  }
827
- async check(params, options) {
843
+ check(params, options) {
828
844
  return this.client.request(
829
845
  "GET",
830
846
  "/v1/availability",
@@ -850,10 +866,10 @@ var WebhooksClient = class {
850
866
  this.client = client;
851
867
  }
852
868
  client;
853
- async create(params, options) {
869
+ create(params, options) {
854
870
  return this.client.request("POST", "/v1/webhooks", params, void 0, options);
855
871
  }
856
- async get(id, options) {
872
+ get(id, options) {
857
873
  return this.client.request("GET", `/v1/webhooks/${id}`, void 0, void 0, options);
858
874
  }
859
875
  list(params = {}) {
@@ -868,13 +884,13 @@ var WebhooksClient = class {
868
884
  offset
869
885
  );
870
886
  }
871
- async update(id, params, options) {
887
+ update(id, params, options) {
872
888
  return this.client.request("PATCH", `/v1/webhooks/${id}`, params, void 0, options);
873
889
  }
874
- async delete(id, options) {
875
- await this.client.request("DELETE", `/v1/webhooks/${id}`, void 0, void 0, options);
890
+ delete(id, options) {
891
+ return this.client.request("DELETE", `/v1/webhooks/${id}`, void 0, void 0, options)._thenUnwrap(() => void 0);
876
892
  }
877
- async listDeliveries(webhookId, params = {}, options) {
893
+ listDeliveries(webhookId, params = {}, options) {
878
894
  const { limit = 20, offset = 0, ...filters } = params;
879
895
  const query = { limit, offset };
880
896
  for (const [key, value] of Object.entries(filters)) {
@@ -889,7 +905,7 @@ var WebhooksClient = class {
889
905
  );
890
906
  }
891
907
  /** One delivery with its payload and every attempt, oldest first. */
892
- async getDelivery(webhookId, deliveryId, options) {
908
+ getDelivery(webhookId, deliveryId, options) {
893
909
  return this.client.request(
894
910
  "GET",
895
911
  `/v1/webhooks/${webhookId}/deliveries/${deliveryId}`,
@@ -904,7 +920,7 @@ var WebhooksClient = class {
904
920
  * attempt and does not count toward the monthly quota. Poll `getDelivery`
905
921
  * with the returned `delivery_id` for the result. Limited to 10 per minute.
906
922
  */
907
- async sendTest(webhookId, params, options) {
923
+ sendTest(webhookId, params, options) {
908
924
  return this.client.request(
909
925
  "POST",
910
926
  `/v1/webhooks/${webhookId}/test`,
@@ -922,7 +938,7 @@ var WebhooksClient = class {
922
938
  * `Idempotency-Key` (generated, or `options.idempotencyKey`), so a retry
923
939
  * returns the same replay. Limited to 30 per minute.
924
940
  */
925
- async replayDelivery(webhookId, deliveryId, options) {
941
+ replayDelivery(webhookId, deliveryId, options) {
926
942
  return this.client.request(
927
943
  "POST",
928
944
  `/v1/webhooks/${webhookId}/deliveries/${deliveryId}/replay`,
@@ -938,7 +954,7 @@ var WebhooksClient = class {
938
954
  * (default `24h`; `now` drops it at once), so receivers can switch
939
955
  * without rejecting deliveries. `verifySignature` accepts either header.
940
956
  */
941
- async rotateSecret(webhookId, params = {}, options) {
957
+ rotateSecret(webhookId, params = {}, options) {
942
958
  return this.client.request(
943
959
  "POST",
944
960
  `/v1/webhooks/${webhookId}/secret/rotate`,
@@ -955,7 +971,7 @@ var ICalSubscriptionsClient = class {
955
971
  this.client = client;
956
972
  }
957
973
  client;
958
- async create(agentId, params, options) {
974
+ create(agentId, params, options) {
959
975
  return this.client.request(
960
976
  "POST",
961
977
  `/v1/agents/${agentId}/ical-subscriptions`,
@@ -964,7 +980,7 @@ var ICalSubscriptionsClient = class {
964
980
  options
965
981
  );
966
982
  }
967
- async get(id, options) {
983
+ get(id, options) {
968
984
  return this.client.request(
969
985
  "GET",
970
986
  `/v1/ical-subscriptions/${id}`,
@@ -986,7 +1002,7 @@ var ICalSubscriptionsClient = class {
986
1002
  offset
987
1003
  );
988
1004
  }
989
- async update(id, params, options) {
1005
+ update(id, params, options) {
990
1006
  return this.client.request(
991
1007
  "PATCH",
992
1008
  `/v1/ical-subscriptions/${id}`,
@@ -995,14 +1011,14 @@ var ICalSubscriptionsClient = class {
995
1011
  options
996
1012
  );
997
1013
  }
998
- async delete(id, options) {
999
- await this.client.request(
1014
+ delete(id, options) {
1015
+ return this.client.request(
1000
1016
  "DELETE",
1001
1017
  `/v1/ical-subscriptions/${id}`,
1002
1018
  void 0,
1003
1019
  void 0,
1004
1020
  options
1005
- );
1021
+ )._thenUnwrap(() => void 0);
1006
1022
  }
1007
1023
  /**
1008
1024
  * Start an immediate fetch of the feed. Resolves with `{ status: 'syncing' }`
@@ -1010,7 +1026,7 @@ var ICalSubscriptionsClient = class {
1010
1026
  * for `last_synced_at` / `last_error`. A paused feed rejects with 409, and a
1011
1027
  * second sync of the same feed within a minute rejects with 429.
1012
1028
  */
1013
- async sync(id, options) {
1029
+ sync(id, options) {
1014
1030
  return this.client.request(
1015
1031
  "POST",
1016
1032
  `/v1/ical-subscriptions/${id}/sync`,
@@ -1020,7 +1036,7 @@ var ICalSubscriptionsClient = class {
1020
1036
  );
1021
1037
  }
1022
1038
  /** Stop polling the feed until it is resumed. Pausing a paused feed changes nothing. */
1023
- async pause(id, options) {
1039
+ pause(id, options) {
1024
1040
  return this.client.request(
1025
1041
  "POST",
1026
1042
  `/v1/ical-subscriptions/${id}/pause`,
@@ -1030,7 +1046,7 @@ var ICalSubscriptionsClient = class {
1030
1046
  );
1031
1047
  }
1032
1048
  /** Return a paused or failing feed to polling and clear `last_error`. */
1033
- async resume(id, options) {
1049
+ resume(id, options) {
1034
1050
  return this.client.request(
1035
1051
  "POST",
1036
1052
  `/v1/ical-subscriptions/${id}/resume`,
@@ -1047,7 +1063,7 @@ var SchedulingClient = class {
1047
1063
  this.client = client;
1048
1064
  }
1049
1065
  client;
1050
- async create(params, options) {
1066
+ create(params, options) {
1051
1067
  return this.client.request(
1052
1068
  "POST",
1053
1069
  "/v1/scheduling/proposals",
@@ -1069,7 +1085,7 @@ var SchedulingClient = class {
1069
1085
  offset
1070
1086
  );
1071
1087
  }
1072
- async get(id, options) {
1088
+ get(id, options) {
1073
1089
  return this.client.request(
1074
1090
  "GET",
1075
1091
  `/v1/scheduling/proposals/${id}`,
@@ -1078,7 +1094,7 @@ var SchedulingClient = class {
1078
1094
  options
1079
1095
  );
1080
1096
  }
1081
- async respond(id, params, options) {
1097
+ respond(id, params, options) {
1082
1098
  return this.client.request(
1083
1099
  "POST",
1084
1100
  `/v1/scheduling/proposals/${id}/respond`,
@@ -1087,7 +1103,7 @@ var SchedulingClient = class {
1087
1103
  options
1088
1104
  );
1089
1105
  }
1090
- async resolve(id, options) {
1106
+ resolve(id, options) {
1091
1107
  return this.client.request(
1092
1108
  "POST",
1093
1109
  `/v1/scheduling/proposals/${id}/resolve`,
@@ -1096,7 +1112,7 @@ var SchedulingClient = class {
1096
1112
  options
1097
1113
  );
1098
1114
  }
1099
- async cancel(id, options) {
1115
+ cancel(id, options) {
1100
1116
  return this.client.request(
1101
1117
  "POST",
1102
1118
  `/v1/scheduling/proposals/${id}/cancel`,
@@ -1113,7 +1129,7 @@ var UsageClient = class {
1113
1129
  this.client = client;
1114
1130
  }
1115
1131
  client;
1116
- async get(options) {
1132
+ get(options) {
1117
1133
  return this.client.request("GET", "/v1/usage", void 0, void 0, options);
1118
1134
  }
1119
1135
  /**
@@ -1121,7 +1137,7 @@ var UsageClient = class {
1121
1137
  * first, ending with the current partial month. Org-level keys only; not
1122
1138
  * counted toward API calls.
1123
1139
  */
1124
- async history(params, options) {
1140
+ history(params, options) {
1125
1141
  const query = { months: params?.months };
1126
1142
  return this.client.request("GET", "/v1/usage/history", void 0, query, options);
1127
1143
  }
@@ -1133,7 +1149,7 @@ var AuditLogClient = class {
1133
1149
  this.client = client;
1134
1150
  }
1135
1151
  client;
1136
- async list(params, options) {
1152
+ list(params, options) {
1137
1153
  const query = {
1138
1154
  from: params?.from,
1139
1155
  to: params?.to,
@@ -1158,21 +1174,20 @@ var KeysClient = class {
1158
1174
  this.client = client;
1159
1175
  }
1160
1176
  client;
1161
- async create(params, options) {
1177
+ create(params, options) {
1162
1178
  return this.client.request("POST", "/v1/keys", params, void 0, options);
1163
1179
  }
1164
- async list(options) {
1165
- const response = await this.client.request(
1180
+ list(options) {
1181
+ return this.client.request(
1166
1182
  "GET",
1167
1183
  "/v1/keys",
1168
1184
  void 0,
1169
1185
  void 0,
1170
1186
  options
1171
- );
1172
- return response.keys;
1187
+ )._thenUnwrap((response) => response.keys);
1173
1188
  }
1174
- async delete(id, options) {
1175
- await this.client.request("DELETE", `/v1/keys/${id}`, void 0, void 0, options);
1189
+ delete(id, options) {
1190
+ return this.client.request("DELETE", `/v1/keys/${id}`, void 0, void 0, options)._thenUnwrap(() => void 0);
1176
1191
  }
1177
1192
  };
1178
1193
 
@@ -1201,7 +1216,7 @@ var AgentAuthClient = class {
1201
1216
  * the currently-published version — retry with the value from the
1202
1217
  * `current_version` field on the error body.
1203
1218
  */
1204
- async signUp(params, options) {
1219
+ signUp(params, options) {
1205
1220
  return this.client.request(
1206
1221
  "POST",
1207
1222
  "/v1/agent/sign-up",
@@ -1222,7 +1237,7 @@ var AgentAuthClient = class {
1222
1237
  * API returns 400 for invalid/expired OTPs, which surfaces as a
1223
1238
  * generic `ChronaryError` with the original message.
1224
1239
  */
1225
- async verify(params, options) {
1240
+ verify(params, options) {
1226
1241
  return this.client.request(
1227
1242
  "POST",
1228
1243
  "/v1/agent/verify",
@@ -1260,7 +1275,7 @@ var WaitlistClient = class {
1260
1275
  * @throws ChronaryError (429 `rate_limit_error`) on the per-IP / per-email
1261
1276
  * waitlist limiter.
1262
1277
  */
1263
- async join(params, options) {
1278
+ join(params, options) {
1264
1279
  return this.client.request(
1265
1280
  "POST",
1266
1281
  "/v1/waitlist",
@@ -1285,7 +1300,7 @@ var FeedbackClient = class {
1285
1300
  * HTTP 429 with a `Retry-After` header set to the seconds until the
1286
1301
  * next UTC midnight.
1287
1302
  */
1288
- async submit(params, options) {
1303
+ submit(params, options) {
1289
1304
  return this.client.request(
1290
1305
  "POST",
1291
1306
  "/v1/feedback",
@@ -1309,7 +1324,7 @@ var PlansClient = class {
1309
1324
  * tier with `custom_pricing: true`. No authentication required.
1310
1325
  * Responses are cacheable for 5 minutes at the edge.
1311
1326
  */
1312
- async list(options) {
1327
+ list(options) {
1313
1328
  return this.client.request("GET", "/v1/plans", void 0, void 0, options);
1314
1329
  }
1315
1330
  };
@@ -1336,7 +1351,7 @@ var AccountClient = class {
1336
1351
  *
1337
1352
  * **Rate limit:** 10 exports/hour/org.
1338
1353
  */
1339
- async export(options) {
1354
+ export(options) {
1340
1355
  return this.client.request(
1341
1356
  "GET",
1342
1357
  "/v1/auth/export",
@@ -1365,7 +1380,7 @@ var TermsClient = class {
1365
1380
  * keys cannot accept org-wide terms (403). A stale version returns 409
1366
1381
  * `tos_version_stale` with the current version in the error body.
1367
1382
  */
1368
- async accept(params, options) {
1383
+ accept(params, options) {
1369
1384
  return this.client.request(
1370
1385
  "POST",
1371
1386
  "/v1/terms/accept",
@@ -1382,11 +1397,11 @@ var ConnectionLinksClient = class {
1382
1397
  this.client = client;
1383
1398
  }
1384
1399
  client;
1385
- async create(calendarId, params, options) {
1400
+ create(calendarId, params, options) {
1386
1401
  return this.client.request("POST", `/v1/calendars/${calendarId}/connection-links`, params, void 0, options);
1387
1402
  }
1388
1403
  /** Setup links, newest first. An agent-scoped key sees only its own calendars' links. */
1389
- async list(params = {}, options) {
1404
+ list(params = {}, options) {
1390
1405
  const { status, calendar_id, limit } = params;
1391
1406
  return this.client.request(
1392
1407
  "GET",
@@ -1396,11 +1411,11 @@ var ConnectionLinksClient = class {
1396
1411
  options
1397
1412
  );
1398
1413
  }
1399
- async get(id, options) {
1414
+ get(id, options) {
1400
1415
  return this.client.request("GET", `/v1/connection-links/${id}`, void 0, void 0, options);
1401
1416
  }
1402
- async cancel(id, options) {
1403
- await this.client.request("DELETE", `/v1/connection-links/${id}`, void 0, void 0, options);
1417
+ cancel(id, options) {
1418
+ return this.client.request("DELETE", `/v1/connection-links/${id}`, void 0, void 0, options)._thenUnwrap(() => void 0);
1404
1419
  }
1405
1420
  };
1406
1421
 
@@ -1415,15 +1430,15 @@ var UpgradeRequestsClient = class {
1415
1430
  * Returns an `approval_url` to hand to your human. Honors `idempotencyKey`;
1416
1431
  * if `reused` is true a request is already pending — poll it instead.
1417
1432
  */
1418
- async create(params = {}, options) {
1433
+ create(params = {}, options) {
1419
1434
  return this.client.request("POST", "/v1/billing/upgrade-requests", params, void 0, options);
1420
1435
  }
1421
1436
  /** Poll an upgrade request (at most once a minute). */
1422
- async get(id, options) {
1437
+ get(id, options) {
1423
1438
  return this.client.request("GET", `/v1/billing/upgrade-requests/${id}`, void 0, void 0, options);
1424
1439
  }
1425
1440
  /** Withdraw a pending upgrade request. */
1426
- async cancel(id, options) {
1441
+ cancel(id, options) {
1427
1442
  return this.client.request("POST", `/v1/billing/upgrade-requests/${id}/cancel`, void 0, void 0, options);
1428
1443
  }
1429
1444
  };
@@ -1435,7 +1450,7 @@ var BillingClient = class {
1435
1450
  client;
1436
1451
  upgradeRequests;
1437
1452
  /** Read-only billing summary for the org (plan, status, upgrade options, pending upgrade request). */
1438
- async get(options) {
1453
+ get(options) {
1439
1454
  return this.client.request("GET", "/v1/billing", void 0, void 0, options);
1440
1455
  }
1441
1456
  };