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