@chronary/sdk 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -46,7 +46,7 @@ __export(index_exports, {
46
46
  module.exports = __toCommonJS(index_exports);
47
47
 
48
48
  // src/version.ts
49
- var VERSION = "0.9.0";
49
+ var VERSION = "0.11.0";
50
50
 
51
51
  // src/error.ts
52
52
  function str(body, key) {
@@ -148,47 +148,62 @@ var ConnectionError = class extends ChronaryError {
148
148
  };
149
149
 
150
150
  // src/api-promise.ts
151
- var APIPromise = class {
152
- innerPromise;
151
+ var APIPromise = class _APIPromise extends Promise {
152
+ responsePromise;
153
+ parsedPromise;
153
154
  constructor(responsePromise) {
154
- this.innerPromise = responsePromise;
155
+ super((resolve) => resolve(null));
156
+ this.responsePromise = responsePromise;
157
+ }
158
+ /**
159
+ * Derived promises (the result of `.then()` and friends) are plain
160
+ * `Promise`s, so the custom constructor above is never invoked with an
161
+ * executor.
162
+ */
163
+ static get [Symbol.species]() {
164
+ return Promise;
155
165
  }
156
166
  /**
157
167
  * Returns both the parsed data and the raw HTTP response.
158
168
  */
159
169
  async withResponse() {
160
- const { data, rawResponse } = await this.innerPromise;
170
+ const { data, rawResponse } = await this.responsePromise;
161
171
  return { data, response: rawResponse };
162
172
  }
163
173
  /**
164
- * Implements the thenable interface. When awaited, resolves to just the parsed data `T`.
174
+ * Maps the parsed data while keeping the raw response, so a resource method
175
+ * that post-processes the body still supports `.withResponse()`.
176
+ *
177
+ * @internal
165
178
  */
166
- then(onfulfilled, onrejected) {
167
- return this.innerPromise.then(
168
- (result) => onfulfilled ? onfulfilled(result.data) : result.data,
169
- onrejected
179
+ _thenUnwrap(transform) {
180
+ return new _APIPromise(
181
+ this.responsePromise.then(({ data, rawResponse }) => ({ data: transform(data), rawResponse }))
170
182
  );
171
183
  }
184
+ parse() {
185
+ if (!this.parsedPromise) {
186
+ this.parsedPromise = this.responsePromise.then((result) => result.data);
187
+ }
188
+ return this.parsedPromise;
189
+ }
190
+ /**
191
+ * When awaited, resolves to just the parsed data `T`.
192
+ */
193
+ then(onfulfilled, onrejected) {
194
+ return this.parse().then(onfulfilled, onrejected);
195
+ }
172
196
  /**
173
197
  * Attaches a rejection handler.
174
198
  */
175
199
  catch(onrejected) {
176
- return this.then(void 0, onrejected);
200
+ return this.parse().catch(onrejected);
177
201
  }
178
202
  /**
179
203
  * Attaches a handler that runs on both fulfillment and rejection.
180
204
  */
181
205
  finally(onfinally) {
182
- return this.then(
183
- (value) => {
184
- onfinally?.();
185
- return value;
186
- },
187
- (reason) => {
188
- onfinally?.();
189
- throw reason;
190
- }
191
- );
206
+ return this.parse().finally(onfinally);
192
207
  }
193
208
  };
194
209
 
@@ -505,10 +520,10 @@ var AgentsClient = class {
505
520
  * Register your agent with Chronary. Creates a Chronary identity for an agent
506
521
  * that already exists in your system, so it can own calendars, events, and webhooks.
507
522
  */
508
- async create(params, options) {
523
+ create(params, options) {
509
524
  return this.client.request("POST", "/v1/agents", params, void 0, options);
510
525
  }
511
- async get(id, options) {
526
+ get(id, options) {
512
527
  return this.client.request("GET", `/v1/agents/${id}`, void 0, void 0, options);
513
528
  }
514
529
  list(params = {}) {
@@ -523,11 +538,11 @@ var AgentsClient = class {
523
538
  offset
524
539
  );
525
540
  }
526
- async update(id, params, options) {
541
+ update(id, params, options) {
527
542
  return this.client.request("PATCH", `/v1/agents/${id}`, params, void 0, options);
528
543
  }
529
- async delete(id, options) {
530
- await this.client.request("DELETE", `/v1/agents/${id}`, void 0, void 0, options);
544
+ delete(id, options) {
545
+ return this.client.request("DELETE", `/v1/agents/${id}`, void 0, void 0, options)._thenUnwrap(() => void 0);
531
546
  }
532
547
  };
533
548
 
@@ -537,12 +552,12 @@ var CalendarsClient = class {
537
552
  this.client = client;
538
553
  }
539
554
  client;
540
- async create(params, options) {
555
+ create(params, options) {
541
556
  const { agentId, ...body } = params;
542
557
  const path = agentId ? `/v1/agents/${agentId}/calendars` : "/v1/calendars";
543
558
  return this.client.request("POST", path, body, void 0, options);
544
559
  }
545
- async get(id, options) {
560
+ get(id, options) {
546
561
  return this.client.request("GET", `/v1/calendars/${id}`, void 0, void 0, options);
547
562
  }
548
563
  list(params = {}) {
@@ -558,21 +573,21 @@ var CalendarsClient = class {
558
573
  offset
559
574
  );
560
575
  }
561
- async update(id, params, options) {
576
+ update(id, params, options) {
562
577
  return this.client.request("PATCH", `/v1/calendars/${id}`, params, void 0, options);
563
578
  }
564
- async delete(id, options) {
565
- await this.client.request("DELETE", `/v1/calendars/${id}`, void 0, void 0, options);
579
+ delete(id, options) {
580
+ return this.client.request("DELETE", `/v1/calendars/${id}`, void 0, void 0, options)._thenUnwrap(() => void 0);
566
581
  }
567
582
  /**
568
583
  * Regenerate the calendar's iCal subscribe URL. The old URL stops working
569
584
  * (copies cached elsewhere can be served for up to 5 minutes); returns the
570
585
  * calendar with its new `ical_url`. Organization keys only.
571
586
  */
572
- async rotateIcalToken(id, options) {
587
+ rotateIcalToken(id, options) {
573
588
  return this.client.request("POST", `/v1/calendars/${id}/ical-token/rotate`, void 0, void 0, options);
574
589
  }
575
- async getContext(id, options) {
590
+ getContext(id, options) {
576
591
  return this.client.request(
577
592
  "GET",
578
593
  `/v1/calendars/${id}/context`,
@@ -581,7 +596,7 @@ var CalendarsClient = class {
581
596
  options
582
597
  );
583
598
  }
584
- async setAvailabilityRules(id, params, options) {
599
+ setAvailabilityRules(id, params, options) {
585
600
  return this.client.request(
586
601
  "PUT",
587
602
  `/v1/calendars/${id}/availability-rules`,
@@ -590,7 +605,7 @@ var CalendarsClient = class {
590
605
  options
591
606
  );
592
607
  }
593
- async getAvailabilityRules(id, options) {
608
+ getAvailabilityRules(id, options) {
594
609
  return this.client.request(
595
610
  "GET",
596
611
  `/v1/calendars/${id}/availability-rules`,
@@ -599,14 +614,14 @@ var CalendarsClient = class {
599
614
  options
600
615
  );
601
616
  }
602
- async deleteAvailabilityRules(id, options) {
603
- await this.client.request(
617
+ deleteAvailabilityRules(id, options) {
618
+ return this.client.request(
604
619
  "DELETE",
605
620
  `/v1/calendars/${id}/availability-rules`,
606
621
  void 0,
607
622
  void 0,
608
623
  options
609
- );
624
+ )._thenUnwrap(() => void 0);
610
625
  }
611
626
  };
612
627
 
@@ -616,10 +631,10 @@ var BookingPagesClient = class {
616
631
  this.client = client;
617
632
  }
618
633
  client;
619
- async create(params, options) {
634
+ create(params, options) {
620
635
  return this.client.request("POST", "/v1/booking-pages", params, void 0, options);
621
636
  }
622
- async get(id, options) {
637
+ get(id, options) {
623
638
  return this.client.request("GET", `/v1/booking-pages/${id}`, void 0, void 0, options);
624
639
  }
625
640
  list(params = {}) {
@@ -634,11 +649,11 @@ var BookingPagesClient = class {
634
649
  offset
635
650
  );
636
651
  }
637
- async update(id, params, options) {
652
+ update(id, params, options) {
638
653
  return this.client.request("PATCH", `/v1/booking-pages/${id}`, params, void 0, options);
639
654
  }
640
- async delete(id, options) {
641
- await this.client.request("DELETE", `/v1/booking-pages/${id}`, void 0, void 0, options);
655
+ delete(id, options) {
656
+ return this.client.request("DELETE", `/v1/booking-pages/${id}`, void 0, void 0, options)._thenUnwrap(() => void 0);
642
657
  }
643
658
  /**
644
659
  * One page of the bookings made through a booking page, newest start first,
@@ -646,14 +661,14 @@ var BookingPagesClient = class {
646
661
  * for the next page (null on the last page). Bookings made before this
647
662
  * endpoint was released are not linked to their page.
648
663
  */
649
- async listBookings(id, params = {}, options) {
664
+ listBookings(id, params = {}, options) {
650
665
  return this.client.request("GET", `/v1/booking-pages/${id}/bookings`, void 0, { ...params }, options);
651
666
  }
652
667
  /**
653
668
  * Replace the page's public link. The old `/book/<slug>` stops working at
654
669
  * once; returns the page with its new `slug` and `booking_url`.
655
670
  */
656
- async rotateSlug(id, options) {
671
+ rotateSlug(id, options) {
657
672
  return this.client.request("POST", `/v1/booking-pages/${id}/rotate-slug`, void 0, void 0, options);
658
673
  }
659
674
  /**
@@ -661,7 +676,7 @@ var BookingPagesClient = class {
661
676
  * required for this endpoint (the slug is the credential); any key set on the
662
677
  * client is simply ignored by the server.
663
678
  */
664
- async listSlots(slug, params = {}, options) {
679
+ listSlots(slug, params = {}, options) {
665
680
  return this.client.request("GET", `/book/${slug}/slots`, void 0, params, options);
666
681
  }
667
682
  /**
@@ -669,7 +684,7 @@ var BookingPagesClient = class {
669
684
  * on the underlying calendar and fires an `event.created` webhook with a
670
685
  * `booking_page_id` correlation field.
671
686
  */
672
- async submit(slug, params, options) {
687
+ submit(slug, params, options) {
673
688
  return this.client.request("POST", `/book/${slug}`, params, void 0, options);
674
689
  }
675
690
  };
@@ -680,7 +695,7 @@ var EventsClient = class {
680
695
  this.client = client;
681
696
  }
682
697
  client;
683
- async create(calendarId, params, options) {
698
+ create(calendarId, params, options) {
684
699
  return this.client.request(
685
700
  "POST",
686
701
  `/v1/calendars/${calendarId}/events`,
@@ -689,7 +704,7 @@ var EventsClient = class {
689
704
  options
690
705
  );
691
706
  }
692
- async get(calendarId, eventId, options) {
707
+ get(calendarId, eventId, options) {
693
708
  return this.client.request(
694
709
  "GET",
695
710
  `/v1/calendars/${calendarId}/events/${eventId}`,
@@ -735,7 +750,7 @@ var EventsClient = class {
735
750
  offset
736
751
  );
737
752
  }
738
- async update(calendarId, eventId, params, options) {
753
+ update(calendarId, eventId, params, options) {
739
754
  return this.client.request(
740
755
  "PATCH",
741
756
  `/v1/calendars/${calendarId}/events/${eventId}`,
@@ -752,7 +767,7 @@ var EventsClient = class {
752
767
  * the timestamp is not an active occurrence, or 409 if the event is not a
753
768
  * recurring series.
754
769
  */
755
- async delete(calendarId, eventId, options) {
770
+ delete(calendarId, eventId, options) {
756
771
  const { occurrence_start, ...requestOptions } = options ?? {};
757
772
  return this.client.request(
758
773
  "DELETE",
@@ -766,7 +781,7 @@ var EventsClient = class {
766
781
  * Fetch an event by ID alone. The calendar is resolved internally from the
767
782
  * event, so no calendar ID is required.
768
783
  */
769
- async getById(eventId, options) {
784
+ getById(eventId, options) {
770
785
  return this.client.request(
771
786
  "GET",
772
787
  `/v1/events/${eventId}`,
@@ -779,7 +794,7 @@ var EventsClient = class {
779
794
  * Update an event by ID alone. The calendar is resolved internally from the
780
795
  * event, so no calendar ID is required.
781
796
  */
782
- async updateById(eventId, params, options) {
797
+ updateById(eventId, params, options) {
783
798
  return this.client.request(
784
799
  "PATCH",
785
800
  `/v1/events/${eventId}`,
@@ -796,7 +811,7 @@ var EventsClient = class {
796
811
  * `occurrence_start`, fails with 400 if the timestamp is not an active
797
812
  * occurrence, or 409 if the event is not a recurring series.
798
813
  */
799
- async deleteById(eventId, options) {
814
+ deleteById(eventId, options) {
800
815
  const { occurrence_start, ...requestOptions } = options ?? {};
801
816
  return this.client.request(
802
817
  "DELETE",
@@ -810,7 +825,7 @@ var EventsClient = class {
810
825
  * Promote a held event (status='hold') to status='confirmed'. Fails with 409
811
826
  * if the event is not a hold, or if the hold has already expired.
812
827
  */
813
- async confirm(eventId, options) {
828
+ confirm(eventId, options) {
814
829
  return this.client.request(
815
830
  "PUT",
816
831
  `/v1/events/${eventId}/confirm`,
@@ -823,7 +838,7 @@ var EventsClient = class {
823
838
  * Manually release a held event before its TTL, freeing the slot. Fails with
824
839
  * 409 if the event is not a hold.
825
840
  */
826
- async release(eventId, options) {
841
+ release(eventId, options) {
827
842
  return this.client.request(
828
843
  "PUT",
829
844
  `/v1/events/${eventId}/release`,
@@ -840,7 +855,7 @@ var AvailabilityClient = class {
840
855
  this.client = client;
841
856
  }
842
857
  client;
843
- async forAgent(agentId, params, options) {
858
+ forAgent(agentId, params, options) {
844
859
  return this.client.request(
845
860
  "GET",
846
861
  `/v1/agents/${agentId}/availability`,
@@ -856,7 +871,7 @@ var AvailabilityClient = class {
856
871
  options
857
872
  );
858
873
  }
859
- async forCalendar(calendarId, params, options) {
874
+ forCalendar(calendarId, params, options) {
860
875
  return this.client.request(
861
876
  "GET",
862
877
  `/v1/calendars/${calendarId}/availability`,
@@ -872,7 +887,7 @@ var AvailabilityClient = class {
872
887
  options
873
888
  );
874
889
  }
875
- async check(params, options) {
890
+ check(params, options) {
876
891
  return this.client.request(
877
892
  "GET",
878
893
  "/v1/availability",
@@ -898,10 +913,10 @@ var WebhooksClient = class {
898
913
  this.client = client;
899
914
  }
900
915
  client;
901
- async create(params, options) {
916
+ create(params, options) {
902
917
  return this.client.request("POST", "/v1/webhooks", params, void 0, options);
903
918
  }
904
- async get(id, options) {
919
+ get(id, options) {
905
920
  return this.client.request("GET", `/v1/webhooks/${id}`, void 0, void 0, options);
906
921
  }
907
922
  list(params = {}) {
@@ -916,13 +931,13 @@ var WebhooksClient = class {
916
931
  offset
917
932
  );
918
933
  }
919
- async update(id, params, options) {
934
+ update(id, params, options) {
920
935
  return this.client.request("PATCH", `/v1/webhooks/${id}`, params, void 0, options);
921
936
  }
922
- async delete(id, options) {
923
- await this.client.request("DELETE", `/v1/webhooks/${id}`, void 0, void 0, options);
937
+ delete(id, options) {
938
+ return this.client.request("DELETE", `/v1/webhooks/${id}`, void 0, void 0, options)._thenUnwrap(() => void 0);
924
939
  }
925
- async listDeliveries(webhookId, params = {}, options) {
940
+ listDeliveries(webhookId, params = {}, options) {
926
941
  const { limit = 20, offset = 0, ...filters } = params;
927
942
  const query = { limit, offset };
928
943
  for (const [key, value] of Object.entries(filters)) {
@@ -937,7 +952,7 @@ var WebhooksClient = class {
937
952
  );
938
953
  }
939
954
  /** One delivery with its payload and every attempt, oldest first. */
940
- async getDelivery(webhookId, deliveryId, options) {
955
+ getDelivery(webhookId, deliveryId, options) {
941
956
  return this.client.request(
942
957
  "GET",
943
958
  `/v1/webhooks/${webhookId}/deliveries/${deliveryId}`,
@@ -952,7 +967,7 @@ var WebhooksClient = class {
952
967
  * attempt and does not count toward the monthly quota. Poll `getDelivery`
953
968
  * with the returned `delivery_id` for the result. Limited to 10 per minute.
954
969
  */
955
- async sendTest(webhookId, params, options) {
970
+ sendTest(webhookId, params, options) {
956
971
  return this.client.request(
957
972
  "POST",
958
973
  `/v1/webhooks/${webhookId}/test`,
@@ -970,7 +985,7 @@ var WebhooksClient = class {
970
985
  * `Idempotency-Key` (generated, or `options.idempotencyKey`), so a retry
971
986
  * returns the same replay. Limited to 30 per minute.
972
987
  */
973
- async replayDelivery(webhookId, deliveryId, options) {
988
+ replayDelivery(webhookId, deliveryId, options) {
974
989
  return this.client.request(
975
990
  "POST",
976
991
  `/v1/webhooks/${webhookId}/deliveries/${deliveryId}/replay`,
@@ -986,7 +1001,7 @@ var WebhooksClient = class {
986
1001
  * (default `24h`; `now` drops it at once), so receivers can switch
987
1002
  * without rejecting deliveries. `verifySignature` accepts either header.
988
1003
  */
989
- async rotateSecret(webhookId, params = {}, options) {
1004
+ rotateSecret(webhookId, params = {}, options) {
990
1005
  return this.client.request(
991
1006
  "POST",
992
1007
  `/v1/webhooks/${webhookId}/secret/rotate`,
@@ -1003,7 +1018,7 @@ var ICalSubscriptionsClient = class {
1003
1018
  this.client = client;
1004
1019
  }
1005
1020
  client;
1006
- async create(agentId, params, options) {
1021
+ create(agentId, params, options) {
1007
1022
  return this.client.request(
1008
1023
  "POST",
1009
1024
  `/v1/agents/${agentId}/ical-subscriptions`,
@@ -1012,7 +1027,7 @@ var ICalSubscriptionsClient = class {
1012
1027
  options
1013
1028
  );
1014
1029
  }
1015
- async get(id, options) {
1030
+ get(id, options) {
1016
1031
  return this.client.request(
1017
1032
  "GET",
1018
1033
  `/v1/ical-subscriptions/${id}`,
@@ -1034,7 +1049,7 @@ var ICalSubscriptionsClient = class {
1034
1049
  offset
1035
1050
  );
1036
1051
  }
1037
- async update(id, params, options) {
1052
+ update(id, params, options) {
1038
1053
  return this.client.request(
1039
1054
  "PATCH",
1040
1055
  `/v1/ical-subscriptions/${id}`,
@@ -1043,14 +1058,14 @@ var ICalSubscriptionsClient = class {
1043
1058
  options
1044
1059
  );
1045
1060
  }
1046
- async delete(id, options) {
1047
- await this.client.request(
1061
+ delete(id, options) {
1062
+ return this.client.request(
1048
1063
  "DELETE",
1049
1064
  `/v1/ical-subscriptions/${id}`,
1050
1065
  void 0,
1051
1066
  void 0,
1052
1067
  options
1053
- );
1068
+ )._thenUnwrap(() => void 0);
1054
1069
  }
1055
1070
  /**
1056
1071
  * Start an immediate fetch of the feed. Resolves with `{ status: 'syncing' }`
@@ -1058,7 +1073,7 @@ var ICalSubscriptionsClient = class {
1058
1073
  * for `last_synced_at` / `last_error`. A paused feed rejects with 409, and a
1059
1074
  * second sync of the same feed within a minute rejects with 429.
1060
1075
  */
1061
- async sync(id, options) {
1076
+ sync(id, options) {
1062
1077
  return this.client.request(
1063
1078
  "POST",
1064
1079
  `/v1/ical-subscriptions/${id}/sync`,
@@ -1068,7 +1083,7 @@ var ICalSubscriptionsClient = class {
1068
1083
  );
1069
1084
  }
1070
1085
  /** Stop polling the feed until it is resumed. Pausing a paused feed changes nothing. */
1071
- async pause(id, options) {
1086
+ pause(id, options) {
1072
1087
  return this.client.request(
1073
1088
  "POST",
1074
1089
  `/v1/ical-subscriptions/${id}/pause`,
@@ -1078,7 +1093,7 @@ var ICalSubscriptionsClient = class {
1078
1093
  );
1079
1094
  }
1080
1095
  /** Return a paused or failing feed to polling and clear `last_error`. */
1081
- async resume(id, options) {
1096
+ resume(id, options) {
1082
1097
  return this.client.request(
1083
1098
  "POST",
1084
1099
  `/v1/ical-subscriptions/${id}/resume`,
@@ -1095,7 +1110,7 @@ var SchedulingClient = class {
1095
1110
  this.client = client;
1096
1111
  }
1097
1112
  client;
1098
- async create(params, options) {
1113
+ create(params, options) {
1099
1114
  return this.client.request(
1100
1115
  "POST",
1101
1116
  "/v1/scheduling/proposals",
@@ -1117,7 +1132,7 @@ var SchedulingClient = class {
1117
1132
  offset
1118
1133
  );
1119
1134
  }
1120
- async get(id, options) {
1135
+ get(id, options) {
1121
1136
  return this.client.request(
1122
1137
  "GET",
1123
1138
  `/v1/scheduling/proposals/${id}`,
@@ -1126,7 +1141,7 @@ var SchedulingClient = class {
1126
1141
  options
1127
1142
  );
1128
1143
  }
1129
- async respond(id, params, options) {
1144
+ respond(id, params, options) {
1130
1145
  return this.client.request(
1131
1146
  "POST",
1132
1147
  `/v1/scheduling/proposals/${id}/respond`,
@@ -1135,7 +1150,7 @@ var SchedulingClient = class {
1135
1150
  options
1136
1151
  );
1137
1152
  }
1138
- async resolve(id, options) {
1153
+ resolve(id, options) {
1139
1154
  return this.client.request(
1140
1155
  "POST",
1141
1156
  `/v1/scheduling/proposals/${id}/resolve`,
@@ -1144,7 +1159,7 @@ var SchedulingClient = class {
1144
1159
  options
1145
1160
  );
1146
1161
  }
1147
- async cancel(id, options) {
1162
+ cancel(id, options) {
1148
1163
  return this.client.request(
1149
1164
  "POST",
1150
1165
  `/v1/scheduling/proposals/${id}/cancel`,
@@ -1161,7 +1176,7 @@ var UsageClient = class {
1161
1176
  this.client = client;
1162
1177
  }
1163
1178
  client;
1164
- async get(options) {
1179
+ get(options) {
1165
1180
  return this.client.request("GET", "/v1/usage", void 0, void 0, options);
1166
1181
  }
1167
1182
  /**
@@ -1169,7 +1184,7 @@ var UsageClient = class {
1169
1184
  * first, ending with the current partial month. Org-level keys only; not
1170
1185
  * counted toward API calls.
1171
1186
  */
1172
- async history(params, options) {
1187
+ history(params, options) {
1173
1188
  const query = { months: params?.months };
1174
1189
  return this.client.request("GET", "/v1/usage/history", void 0, query, options);
1175
1190
  }
@@ -1181,7 +1196,7 @@ var AuditLogClient = class {
1181
1196
  this.client = client;
1182
1197
  }
1183
1198
  client;
1184
- async list(params, options) {
1199
+ list(params, options) {
1185
1200
  const query = {
1186
1201
  from: params?.from,
1187
1202
  to: params?.to,
@@ -1206,21 +1221,20 @@ var KeysClient = class {
1206
1221
  this.client = client;
1207
1222
  }
1208
1223
  client;
1209
- async create(params, options) {
1224
+ create(params, options) {
1210
1225
  return this.client.request("POST", "/v1/keys", params, void 0, options);
1211
1226
  }
1212
- async list(options) {
1213
- const response = await this.client.request(
1227
+ list(options) {
1228
+ return this.client.request(
1214
1229
  "GET",
1215
1230
  "/v1/keys",
1216
1231
  void 0,
1217
1232
  void 0,
1218
1233
  options
1219
- );
1220
- return response.keys;
1234
+ )._thenUnwrap((response) => response.keys);
1221
1235
  }
1222
- async delete(id, options) {
1223
- await this.client.request("DELETE", `/v1/keys/${id}`, void 0, void 0, options);
1236
+ delete(id, options) {
1237
+ return this.client.request("DELETE", `/v1/keys/${id}`, void 0, void 0, options)._thenUnwrap(() => void 0);
1224
1238
  }
1225
1239
  };
1226
1240
 
@@ -1249,7 +1263,7 @@ var AgentAuthClient = class {
1249
1263
  * the currently-published version — retry with the value from the
1250
1264
  * `current_version` field on the error body.
1251
1265
  */
1252
- async signUp(params, options) {
1266
+ signUp(params, options) {
1253
1267
  return this.client.request(
1254
1268
  "POST",
1255
1269
  "/v1/agent/sign-up",
@@ -1270,7 +1284,7 @@ var AgentAuthClient = class {
1270
1284
  * API returns 400 for invalid/expired OTPs, which surfaces as a
1271
1285
  * generic `ChronaryError` with the original message.
1272
1286
  */
1273
- async verify(params, options) {
1287
+ verify(params, options) {
1274
1288
  return this.client.request(
1275
1289
  "POST",
1276
1290
  "/v1/agent/verify",
@@ -1308,7 +1322,7 @@ var WaitlistClient = class {
1308
1322
  * @throws ChronaryError (429 `rate_limit_error`) on the per-IP / per-email
1309
1323
  * waitlist limiter.
1310
1324
  */
1311
- async join(params, options) {
1325
+ join(params, options) {
1312
1326
  return this.client.request(
1313
1327
  "POST",
1314
1328
  "/v1/waitlist",
@@ -1333,7 +1347,7 @@ var FeedbackClient = class {
1333
1347
  * HTTP 429 with a `Retry-After` header set to the seconds until the
1334
1348
  * next UTC midnight.
1335
1349
  */
1336
- async submit(params, options) {
1350
+ submit(params, options) {
1337
1351
  return this.client.request(
1338
1352
  "POST",
1339
1353
  "/v1/feedback",
@@ -1357,7 +1371,7 @@ var PlansClient = class {
1357
1371
  * tier with `custom_pricing: true`. No authentication required.
1358
1372
  * Responses are cacheable for 5 minutes at the edge.
1359
1373
  */
1360
- async list(options) {
1374
+ list(options) {
1361
1375
  return this.client.request("GET", "/v1/plans", void 0, void 0, options);
1362
1376
  }
1363
1377
  };
@@ -1384,7 +1398,7 @@ var AccountClient = class {
1384
1398
  *
1385
1399
  * **Rate limit:** 10 exports/hour/org.
1386
1400
  */
1387
- async export(options) {
1401
+ export(options) {
1388
1402
  return this.client.request(
1389
1403
  "GET",
1390
1404
  "/v1/auth/export",
@@ -1413,7 +1427,7 @@ var TermsClient = class {
1413
1427
  * keys cannot accept org-wide terms (403). A stale version returns 409
1414
1428
  * `tos_version_stale` with the current version in the error body.
1415
1429
  */
1416
- async accept(params, options) {
1430
+ accept(params, options) {
1417
1431
  return this.client.request(
1418
1432
  "POST",
1419
1433
  "/v1/terms/accept",
@@ -1430,11 +1444,11 @@ var ConnectionLinksClient = class {
1430
1444
  this.client = client;
1431
1445
  }
1432
1446
  client;
1433
- async create(calendarId, params, options) {
1447
+ create(calendarId, params, options) {
1434
1448
  return this.client.request("POST", `/v1/calendars/${calendarId}/connection-links`, params, void 0, options);
1435
1449
  }
1436
1450
  /** Setup links, newest first. An agent-scoped key sees only its own calendars' links. */
1437
- async list(params = {}, options) {
1451
+ list(params = {}, options) {
1438
1452
  const { status, calendar_id, limit } = params;
1439
1453
  return this.client.request(
1440
1454
  "GET",
@@ -1444,11 +1458,11 @@ var ConnectionLinksClient = class {
1444
1458
  options
1445
1459
  );
1446
1460
  }
1447
- async get(id, options) {
1461
+ get(id, options) {
1448
1462
  return this.client.request("GET", `/v1/connection-links/${id}`, void 0, void 0, options);
1449
1463
  }
1450
- async cancel(id, options) {
1451
- await this.client.request("DELETE", `/v1/connection-links/${id}`, void 0, void 0, options);
1464
+ cancel(id, options) {
1465
+ return this.client.request("DELETE", `/v1/connection-links/${id}`, void 0, void 0, options)._thenUnwrap(() => void 0);
1452
1466
  }
1453
1467
  };
1454
1468
 
@@ -1463,15 +1477,15 @@ var UpgradeRequestsClient = class {
1463
1477
  * Returns an `approval_url` to hand to your human. Honors `idempotencyKey`;
1464
1478
  * if `reused` is true a request is already pending — poll it instead.
1465
1479
  */
1466
- async create(params = {}, options) {
1480
+ create(params = {}, options) {
1467
1481
  return this.client.request("POST", "/v1/billing/upgrade-requests", params, void 0, options);
1468
1482
  }
1469
1483
  /** Poll an upgrade request (at most once a minute). */
1470
- async get(id, options) {
1484
+ get(id, options) {
1471
1485
  return this.client.request("GET", `/v1/billing/upgrade-requests/${id}`, void 0, void 0, options);
1472
1486
  }
1473
1487
  /** Withdraw a pending upgrade request. */
1474
- async cancel(id, options) {
1488
+ cancel(id, options) {
1475
1489
  return this.client.request("POST", `/v1/billing/upgrade-requests/${id}/cancel`, void 0, void 0, options);
1476
1490
  }
1477
1491
  };
@@ -1483,7 +1497,7 @@ var BillingClient = class {
1483
1497
  client;
1484
1498
  upgradeRequests;
1485
1499
  /** Read-only billing summary for the org (plan, status, upgrade options, pending upgrade request). */
1486
- async get(options) {
1500
+ get(options) {
1487
1501
  return this.client.request("GET", "/v1/billing", void 0, void 0, options);
1488
1502
  }
1489
1503
  };