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