@getsupervisor/agents-studio-sdk 1.20.0 → 1.22.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 +9 -0
- package/dist/index.cjs +72 -81
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +72 -81
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -302,7 +302,7 @@ function createAgentBlueprintsApi(cfg) {
|
|
|
302
302
|
const jsonHeaders = { "content-type": "application/json" };
|
|
303
303
|
const list = async (agentId, options = {}) => {
|
|
304
304
|
const query = serializeListOptions({ filter: options.filter });
|
|
305
|
-
const res = await doFetch(`${base}/
|
|
305
|
+
const res = await doFetch(`${base}/agents/${agentId}/blueprints`, {
|
|
306
306
|
method: "GET",
|
|
307
307
|
query
|
|
308
308
|
});
|
|
@@ -310,7 +310,7 @@ function createAgentBlueprintsApi(cfg) {
|
|
|
310
310
|
};
|
|
311
311
|
const get = async (agentId, versionId) => {
|
|
312
312
|
const res = await doFetch(
|
|
313
|
-
`${base}/
|
|
313
|
+
`${base}/agents/${agentId}/versions/${versionId}/blueprint`,
|
|
314
314
|
{
|
|
315
315
|
method: "GET"
|
|
316
316
|
}
|
|
@@ -319,7 +319,7 @@ function createAgentBlueprintsApi(cfg) {
|
|
|
319
319
|
};
|
|
320
320
|
const create = async (agentId, versionId, payload) => {
|
|
321
321
|
const res = await doFetch(
|
|
322
|
-
`${base}/
|
|
322
|
+
`${base}/agents/${agentId}/versions/${versionId}/blueprint`,
|
|
323
323
|
{
|
|
324
324
|
method: "POST",
|
|
325
325
|
body: JSON.stringify(payload),
|
|
@@ -330,7 +330,7 @@ function createAgentBlueprintsApi(cfg) {
|
|
|
330
330
|
};
|
|
331
331
|
const update = async (agentId, versionId, payload) => {
|
|
332
332
|
const res = await doFetch(
|
|
333
|
-
`${base}/
|
|
333
|
+
`${base}/agents/${agentId}/versions/${versionId}/blueprint`,
|
|
334
334
|
{
|
|
335
335
|
method: "PATCH",
|
|
336
336
|
body: JSON.stringify(payload),
|
|
@@ -446,7 +446,7 @@ function createAgentInstructionsApi(cfg) {
|
|
|
446
446
|
const fetchInstructionPage = async (agentId, opts = {}) => {
|
|
447
447
|
const { versionId, ...queryOptions } = opts ?? {};
|
|
448
448
|
const query = serializeListOptions(queryOptions, { versionId });
|
|
449
|
-
const res = await doFetch(`${base}/
|
|
449
|
+
const res = await doFetch(`${base}/agents/${agentId}/instructions`, {
|
|
450
450
|
method: "GET",
|
|
451
451
|
query
|
|
452
452
|
});
|
|
@@ -462,7 +462,7 @@ function createAgentInstructionsApi(cfg) {
|
|
|
462
462
|
return attachPaginator(response, fetchPage, normalizedOptions);
|
|
463
463
|
},
|
|
464
464
|
async create(agentId, payload) {
|
|
465
|
-
const res = await doFetch(`${base}/
|
|
465
|
+
const res = await doFetch(`${base}/agents/${agentId}/instructions`, {
|
|
466
466
|
method: "POST",
|
|
467
467
|
headers: jsonHeaders,
|
|
468
468
|
body: JSON.stringify(payload)
|
|
@@ -471,7 +471,7 @@ function createAgentInstructionsApi(cfg) {
|
|
|
471
471
|
},
|
|
472
472
|
async update(agentId, instructionId, payload) {
|
|
473
473
|
const res = await doFetch(
|
|
474
|
-
`${base}/
|
|
474
|
+
`${base}/agents/${agentId}/instructions/${instructionId}`,
|
|
475
475
|
{
|
|
476
476
|
method: "PATCH",
|
|
477
477
|
headers: jsonHeaders,
|
|
@@ -481,12 +481,9 @@ function createAgentInstructionsApi(cfg) {
|
|
|
481
481
|
return res.json();
|
|
482
482
|
},
|
|
483
483
|
async delete(agentId, instructionId) {
|
|
484
|
-
await doFetch(
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
method: "DELETE"
|
|
488
|
-
}
|
|
489
|
-
);
|
|
484
|
+
await doFetch(`${base}/agents/${agentId}/instructions/${instructionId}`, {
|
|
485
|
+
method: "DELETE"
|
|
486
|
+
});
|
|
490
487
|
}
|
|
491
488
|
};
|
|
492
489
|
}
|
|
@@ -497,7 +494,7 @@ function createAgentPhonesApi(cfg) {
|
|
|
497
494
|
const jsonHeaders = { "content-type": "application/json" };
|
|
498
495
|
return {
|
|
499
496
|
async connect(agentId, payload) {
|
|
500
|
-
const res = await doFetch(`${base}/
|
|
497
|
+
const res = await doFetch(`${base}/agents/${agentId}/phones`, {
|
|
501
498
|
method: "POST",
|
|
502
499
|
headers: jsonHeaders,
|
|
503
500
|
body: JSON.stringify(payload)
|
|
@@ -505,7 +502,7 @@ function createAgentPhonesApi(cfg) {
|
|
|
505
502
|
return res.json();
|
|
506
503
|
},
|
|
507
504
|
async disconnect(agentId, phoneId) {
|
|
508
|
-
await doFetch(`${base}/
|
|
505
|
+
await doFetch(`${base}/agents/${agentId}/phones/${phoneId}`, {
|
|
509
506
|
method: "DELETE"
|
|
510
507
|
});
|
|
511
508
|
}
|
|
@@ -518,13 +515,13 @@ function createAgentScheduleApi(cfg) {
|
|
|
518
515
|
const jsonHeaders = { "content-type": "application/json" };
|
|
519
516
|
return {
|
|
520
517
|
async get(agentId) {
|
|
521
|
-
const res = await doFetch(`${base}/
|
|
518
|
+
const res = await doFetch(`${base}/agents/${agentId}/schedule`, {
|
|
522
519
|
method: "GET"
|
|
523
520
|
});
|
|
524
521
|
return res.json();
|
|
525
522
|
},
|
|
526
523
|
async create(agentId, payload) {
|
|
527
|
-
const res = await doFetch(`${base}/
|
|
524
|
+
const res = await doFetch(`${base}/agents/${agentId}/schedule`, {
|
|
528
525
|
method: "POST",
|
|
529
526
|
headers: jsonHeaders,
|
|
530
527
|
body: JSON.stringify(payload)
|
|
@@ -532,7 +529,7 @@ function createAgentScheduleApi(cfg) {
|
|
|
532
529
|
return res.json();
|
|
533
530
|
},
|
|
534
531
|
async update(agentId, payload) {
|
|
535
|
-
const res = await doFetch(`${base}/
|
|
532
|
+
const res = await doFetch(`${base}/agents/${agentId}/schedule`, {
|
|
536
533
|
method: "PUT",
|
|
537
534
|
headers: jsonHeaders,
|
|
538
535
|
body: JSON.stringify(payload)
|
|
@@ -548,13 +545,10 @@ function createAgentScheduleExceptionsApi(cfg) {
|
|
|
548
545
|
const jsonHeaders = { "content-type": "application/json" };
|
|
549
546
|
const fetchExceptionsPage = async (agentId, options = {}) => {
|
|
550
547
|
const query = serializeListOptions(options ?? {});
|
|
551
|
-
const res = await doFetch(
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
query
|
|
556
|
-
}
|
|
557
|
-
);
|
|
548
|
+
const res = await doFetch(`${base}/agents/${agentId}/schedule/exceptions`, {
|
|
549
|
+
method: "GET",
|
|
550
|
+
query
|
|
551
|
+
});
|
|
558
552
|
return res.json();
|
|
559
553
|
};
|
|
560
554
|
return {
|
|
@@ -568,7 +562,7 @@ function createAgentScheduleExceptionsApi(cfg) {
|
|
|
568
562
|
},
|
|
569
563
|
async get(agentId, exceptionId) {
|
|
570
564
|
const res = await doFetch(
|
|
571
|
-
`${base}/
|
|
565
|
+
`${base}/agents/${agentId}/schedule/exceptions/${exceptionId}`,
|
|
572
566
|
{
|
|
573
567
|
method: "GET"
|
|
574
568
|
}
|
|
@@ -577,7 +571,7 @@ function createAgentScheduleExceptionsApi(cfg) {
|
|
|
577
571
|
},
|
|
578
572
|
async create(agentId, payload) {
|
|
579
573
|
const res = await doFetch(
|
|
580
|
-
`${base}/
|
|
574
|
+
`${base}/agents/${agentId}/schedule/exceptions`,
|
|
581
575
|
{
|
|
582
576
|
method: "POST",
|
|
583
577
|
headers: jsonHeaders,
|
|
@@ -588,7 +582,7 @@ function createAgentScheduleExceptionsApi(cfg) {
|
|
|
588
582
|
},
|
|
589
583
|
async update(agentId, exceptionId, payload) {
|
|
590
584
|
const res = await doFetch(
|
|
591
|
-
`${base}/
|
|
585
|
+
`${base}/agents/${agentId}/schedule/exceptions/${exceptionId}`,
|
|
592
586
|
{
|
|
593
587
|
method: "PATCH",
|
|
594
588
|
headers: jsonHeaders,
|
|
@@ -599,7 +593,7 @@ function createAgentScheduleExceptionsApi(cfg) {
|
|
|
599
593
|
},
|
|
600
594
|
async delete(agentId, exceptionId) {
|
|
601
595
|
await doFetch(
|
|
602
|
-
`${base}/
|
|
596
|
+
`${base}/agents/${agentId}/schedule/exceptions/${exceptionId}`,
|
|
603
597
|
{
|
|
604
598
|
method: "DELETE"
|
|
605
599
|
}
|
|
@@ -614,7 +608,7 @@ function createAgentTagsApi(cfg) {
|
|
|
614
608
|
const jsonHeaders = { "content-type": "application/json" };
|
|
615
609
|
return {
|
|
616
610
|
async add(agentId, payload) {
|
|
617
|
-
const res = await doFetch(`${base}/
|
|
611
|
+
const res = await doFetch(`${base}/agents/${agentId}/tags`, {
|
|
618
612
|
method: "POST",
|
|
619
613
|
headers: jsonHeaders,
|
|
620
614
|
body: JSON.stringify(payload)
|
|
@@ -622,7 +616,7 @@ function createAgentTagsApi(cfg) {
|
|
|
622
616
|
return res.json();
|
|
623
617
|
},
|
|
624
618
|
async remove(agentId, tagId) {
|
|
625
|
-
await doFetch(`${base}/
|
|
619
|
+
await doFetch(`${base}/agents/${agentId}/tags/${tagId}`, {
|
|
626
620
|
method: "DELETE"
|
|
627
621
|
});
|
|
628
622
|
}
|
|
@@ -640,7 +634,7 @@ function createAgentVersionsApi(cfg) {
|
|
|
640
634
|
filter: opts.filter
|
|
641
635
|
};
|
|
642
636
|
const query = serializeListOptions(queryOptions);
|
|
643
|
-
const res = await doFetch(`${base}/
|
|
637
|
+
const res = await doFetch(`${base}/agents/${agentId}/versions`, {
|
|
644
638
|
method: "GET",
|
|
645
639
|
query
|
|
646
640
|
});
|
|
@@ -655,7 +649,7 @@ function createAgentVersionsApi(cfg) {
|
|
|
655
649
|
},
|
|
656
650
|
async get(agentId, versionId) {
|
|
657
651
|
const res = await doFetch(
|
|
658
|
-
`${base}/
|
|
652
|
+
`${base}/agents/${agentId}/versions/${versionId}`,
|
|
659
653
|
{
|
|
660
654
|
method: "GET"
|
|
661
655
|
}
|
|
@@ -663,7 +657,7 @@ function createAgentVersionsApi(cfg) {
|
|
|
663
657
|
return res.json();
|
|
664
658
|
},
|
|
665
659
|
async create(agentId, payload) {
|
|
666
|
-
const res = await doFetch(`${base}/
|
|
660
|
+
const res = await doFetch(`${base}/agents/${agentId}/versions`, {
|
|
667
661
|
method: "POST",
|
|
668
662
|
headers: jsonHeaders,
|
|
669
663
|
body: JSON.stringify(payload ?? {})
|
|
@@ -672,7 +666,7 @@ function createAgentVersionsApi(cfg) {
|
|
|
672
666
|
},
|
|
673
667
|
async clone(agentId, versionId) {
|
|
674
668
|
const res = await doFetch(
|
|
675
|
-
`${base}/
|
|
669
|
+
`${base}/agents/${agentId}/versions/${versionId}/clone`,
|
|
676
670
|
{
|
|
677
671
|
method: "POST"
|
|
678
672
|
}
|
|
@@ -681,7 +675,7 @@ function createAgentVersionsApi(cfg) {
|
|
|
681
675
|
},
|
|
682
676
|
async publish(agentId, versionId, payload) {
|
|
683
677
|
const res = await doFetch(
|
|
684
|
-
`${base}/
|
|
678
|
+
`${base}/agents/${agentId}/versions/${versionId}/publish`,
|
|
685
679
|
{
|
|
686
680
|
method: "POST",
|
|
687
681
|
headers: jsonHeaders,
|
|
@@ -692,7 +686,7 @@ function createAgentVersionsApi(cfg) {
|
|
|
692
686
|
},
|
|
693
687
|
async updateNotes(agentId, versionId, payload) {
|
|
694
688
|
const res = await doFetch(
|
|
695
|
-
`${base}/
|
|
689
|
+
`${base}/agents/${agentId}/versions/${versionId}/notes`,
|
|
696
690
|
{
|
|
697
691
|
method: "PATCH",
|
|
698
692
|
headers: jsonHeaders,
|
|
@@ -704,7 +698,7 @@ function createAgentVersionsApi(cfg) {
|
|
|
704
698
|
async listInstructions(agentId, versionId, opts = {}) {
|
|
705
699
|
const query = serializeListOptions(opts);
|
|
706
700
|
const res = await doFetch(
|
|
707
|
-
`${base}/
|
|
701
|
+
`${base}/agents/${agentId}/versions/${versionId}/instructions`,
|
|
708
702
|
{
|
|
709
703
|
method: "GET",
|
|
710
704
|
query
|
|
@@ -714,7 +708,7 @@ function createAgentVersionsApi(cfg) {
|
|
|
714
708
|
},
|
|
715
709
|
async createInstruction(agentId, versionId, payload) {
|
|
716
710
|
const res = await doFetch(
|
|
717
|
-
`${base}/
|
|
711
|
+
`${base}/agents/${agentId}/versions/${versionId}/instructions`,
|
|
718
712
|
{
|
|
719
713
|
method: "POST",
|
|
720
714
|
headers: jsonHeaders,
|
|
@@ -725,7 +719,7 @@ function createAgentVersionsApi(cfg) {
|
|
|
725
719
|
},
|
|
726
720
|
async updateInstruction(agentId, versionId, instructionId, payload) {
|
|
727
721
|
const res = await doFetch(
|
|
728
|
-
`${base}/
|
|
722
|
+
`${base}/agents/${agentId}/versions/${versionId}/instructions/${instructionId}`,
|
|
729
723
|
{
|
|
730
724
|
method: "PATCH",
|
|
731
725
|
headers: jsonHeaders,
|
|
@@ -736,7 +730,7 @@ function createAgentVersionsApi(cfg) {
|
|
|
736
730
|
},
|
|
737
731
|
async deleteInstruction(agentId, versionId, instructionId) {
|
|
738
732
|
await doFetch(
|
|
739
|
-
`${base}/
|
|
733
|
+
`${base}/agents/${agentId}/versions/${versionId}/instructions/${instructionId}`,
|
|
740
734
|
{
|
|
741
735
|
method: "DELETE"
|
|
742
736
|
}
|
|
@@ -913,7 +907,7 @@ function createAgentsApi(cfg, relatedApis) {
|
|
|
913
907
|
filter: options.filter
|
|
914
908
|
};
|
|
915
909
|
const query = serializeListOptions(sanitizedOptions);
|
|
916
|
-
const res = await doFetch(`${base}/
|
|
910
|
+
const res = await doFetch(`${base}/agents`, {
|
|
917
911
|
method: "GET",
|
|
918
912
|
query
|
|
919
913
|
});
|
|
@@ -925,13 +919,13 @@ function createAgentsApi(cfg, relatedApis) {
|
|
|
925
919
|
return attachPaginator(response, fetchAgentsPage, normalizedOptions);
|
|
926
920
|
};
|
|
927
921
|
const getAgentDetail = async (agentId) => {
|
|
928
|
-
const res = await doFetch(`${base}/
|
|
922
|
+
const res = await doFetch(`${base}/agents/${agentId}`, {
|
|
929
923
|
method: "GET"
|
|
930
924
|
});
|
|
931
925
|
return res.json();
|
|
932
926
|
};
|
|
933
927
|
const createAgent = async (payload) => {
|
|
934
|
-
const res = await doFetch(`${base}/
|
|
928
|
+
const res = await doFetch(`${base}/agents`, {
|
|
935
929
|
method: "POST",
|
|
936
930
|
body: JSON.stringify(payload),
|
|
937
931
|
headers: jsonHeaders
|
|
@@ -939,7 +933,7 @@ function createAgentsApi(cfg, relatedApis) {
|
|
|
939
933
|
return res.json();
|
|
940
934
|
};
|
|
941
935
|
const updateAgent = async (agentId, payload) => {
|
|
942
|
-
const res = await doFetch(`${base}/
|
|
936
|
+
const res = await doFetch(`${base}/agents/${agentId}`, {
|
|
943
937
|
method: "PATCH",
|
|
944
938
|
body: JSON.stringify(payload),
|
|
945
939
|
headers: jsonHeaders
|
|
@@ -951,7 +945,7 @@ function createAgentsApi(cfg, relatedApis) {
|
|
|
951
945
|
};
|
|
952
946
|
const deleteAgent = async (agent) => {
|
|
953
947
|
const agentId = resolveAgentId(agent);
|
|
954
|
-
await doFetch(`${base}/
|
|
948
|
+
await doFetch(`${base}/agents/${agentId}`, {
|
|
955
949
|
method: "DELETE"
|
|
956
950
|
});
|
|
957
951
|
};
|
|
@@ -1021,11 +1015,11 @@ function createApiKeysApi(cfg) {
|
|
|
1021
1015
|
const jsonHeaders = { "content-type": "application/json" };
|
|
1022
1016
|
return {
|
|
1023
1017
|
async list() {
|
|
1024
|
-
const res = await doFetch(`${base}/
|
|
1018
|
+
const res = await doFetch(`${base}/api-keys`, { method: "GET" });
|
|
1025
1019
|
return res.json();
|
|
1026
1020
|
},
|
|
1027
1021
|
async create(payload) {
|
|
1028
|
-
const res = await doFetch(`${base}/
|
|
1022
|
+
const res = await doFetch(`${base}/api-keys`, {
|
|
1029
1023
|
method: "POST",
|
|
1030
1024
|
headers: jsonHeaders,
|
|
1031
1025
|
body: JSON.stringify(payload)
|
|
@@ -1033,12 +1027,12 @@ function createApiKeysApi(cfg) {
|
|
|
1033
1027
|
return res.json();
|
|
1034
1028
|
},
|
|
1035
1029
|
async revoke(apiKeyId) {
|
|
1036
|
-
await doFetch(`${base}/
|
|
1030
|
+
await doFetch(`${base}/api-keys/${apiKeyId}`, {
|
|
1037
1031
|
method: "DELETE"
|
|
1038
1032
|
});
|
|
1039
1033
|
},
|
|
1040
1034
|
async show(apiKeyId) {
|
|
1041
|
-
const res = await doFetch(`${base}/
|
|
1035
|
+
const res = await doFetch(`${base}/api-keys/${apiKeyId}/show`, {
|
|
1042
1036
|
method: "GET"
|
|
1043
1037
|
});
|
|
1044
1038
|
return res.json();
|
|
@@ -1052,7 +1046,7 @@ function createCatalogsApi(cfg) {
|
|
|
1052
1046
|
const jsonHeaders = { "content-type": "application/json" };
|
|
1053
1047
|
const fetchCatalogItemsPage = async (options = {}) => {
|
|
1054
1048
|
const query = serializeListOptions(options ?? {});
|
|
1055
|
-
const res = await doFetch(`${base}/
|
|
1049
|
+
const res = await doFetch(`${base}/catalogs/items`, {
|
|
1056
1050
|
method: "GET",
|
|
1057
1051
|
query
|
|
1058
1052
|
});
|
|
@@ -1071,13 +1065,13 @@ function createCatalogsApi(cfg) {
|
|
|
1071
1065
|
);
|
|
1072
1066
|
},
|
|
1073
1067
|
async get(itemId) {
|
|
1074
|
-
const res = await doFetch(`${base}/
|
|
1068
|
+
const res = await doFetch(`${base}/catalogs/items/${itemId}`, {
|
|
1075
1069
|
method: "GET"
|
|
1076
1070
|
});
|
|
1077
1071
|
return res.json();
|
|
1078
1072
|
},
|
|
1079
1073
|
async create(payload) {
|
|
1080
|
-
const res = await doFetch(`${base}/
|
|
1074
|
+
const res = await doFetch(`${base}/catalogs/items`, {
|
|
1081
1075
|
method: "POST",
|
|
1082
1076
|
headers: jsonHeaders,
|
|
1083
1077
|
body: JSON.stringify(payload)
|
|
@@ -1085,7 +1079,7 @@ function createCatalogsApi(cfg) {
|
|
|
1085
1079
|
return res.json();
|
|
1086
1080
|
},
|
|
1087
1081
|
async remove(itemId) {
|
|
1088
|
-
await doFetch(`${base}/
|
|
1082
|
+
await doFetch(`${base}/catalogs/items/${itemId}`, {
|
|
1089
1083
|
method: "DELETE"
|
|
1090
1084
|
});
|
|
1091
1085
|
}
|
|
@@ -1145,7 +1139,7 @@ function createToolsApi(cfg) {
|
|
|
1145
1139
|
const fetchToolsPage = async (options = {}) => {
|
|
1146
1140
|
const { agentType, ...queryOptions } = options ?? {};
|
|
1147
1141
|
const query = serializeListOptions(queryOptions, { agentType });
|
|
1148
|
-
const res = await doFetch(`${base}/
|
|
1142
|
+
const res = await doFetch(`${base}/tools`, {
|
|
1149
1143
|
method: "GET",
|
|
1150
1144
|
query
|
|
1151
1145
|
});
|
|
@@ -1154,7 +1148,7 @@ function createToolsApi(cfg) {
|
|
|
1154
1148
|
const fetchToolResourcesPage = async (toolId, options = {}) => {
|
|
1155
1149
|
const { type, ...queryOptions } = options ?? {};
|
|
1156
1150
|
const query = serializeListOptions(queryOptions, { type });
|
|
1157
|
-
const res = await doFetch(`${base}/
|
|
1151
|
+
const res = await doFetch(`${base}/tools/${toolId}/resources`, {
|
|
1158
1152
|
method: "GET",
|
|
1159
1153
|
query
|
|
1160
1154
|
});
|
|
@@ -1176,20 +1170,20 @@ function createToolsApi(cfg) {
|
|
|
1176
1170
|
},
|
|
1177
1171
|
async uploadResource(toolId, payload) {
|
|
1178
1172
|
const formData = toFormData(payload);
|
|
1179
|
-
const res = await doFetch(`${base}/
|
|
1173
|
+
const res = await doFetch(`${base}/tools/${toolId}/resources`, {
|
|
1180
1174
|
method: "POST",
|
|
1181
1175
|
body: formData
|
|
1182
1176
|
});
|
|
1183
1177
|
return res.json();
|
|
1184
1178
|
},
|
|
1185
1179
|
async deleteResource(toolId, resourceId) {
|
|
1186
|
-
await doFetch(`${base}/
|
|
1180
|
+
await doFetch(`${base}/tools/${toolId}/resources/${resourceId}`, {
|
|
1187
1181
|
method: "DELETE"
|
|
1188
1182
|
});
|
|
1189
1183
|
},
|
|
1190
1184
|
async reloadResource(toolId, resourceId) {
|
|
1191
1185
|
const res = await doFetch(
|
|
1192
|
-
`${base}/
|
|
1186
|
+
`${base}/tools/${toolId}/resources/${resourceId}/reload`,
|
|
1193
1187
|
{
|
|
1194
1188
|
method: "POST"
|
|
1195
1189
|
}
|
|
@@ -1198,7 +1192,7 @@ function createToolsApi(cfg) {
|
|
|
1198
1192
|
},
|
|
1199
1193
|
async execute(toolId, payload, options = {}) {
|
|
1200
1194
|
const idempotencyKey = generateIdempotencyKey(options.idempotencyKey);
|
|
1201
|
-
const res = await doFetch(`${base}/
|
|
1195
|
+
const res = await doFetch(`${base}/tools/${toolId}/execute`, {
|
|
1202
1196
|
method: "POST",
|
|
1203
1197
|
headers: {
|
|
1204
1198
|
...jsonHeaders,
|
|
@@ -1210,7 +1204,7 @@ function createToolsApi(cfg) {
|
|
|
1210
1204
|
},
|
|
1211
1205
|
async connect(toolId, payload, options = {}) {
|
|
1212
1206
|
const idempotencyKey = generateIdempotencyKey(options.idempotencyKey);
|
|
1213
|
-
const res = await doFetch(`${base}/
|
|
1207
|
+
const res = await doFetch(`${base}/tools/${toolId}/connections`, {
|
|
1214
1208
|
method: "POST",
|
|
1215
1209
|
headers: {
|
|
1216
1210
|
...jsonHeaders,
|
|
@@ -1246,7 +1240,7 @@ function createVoicesApi(cfg) {
|
|
|
1246
1240
|
locale
|
|
1247
1241
|
}
|
|
1248
1242
|
);
|
|
1249
|
-
const res = await doFetch(`${base}/
|
|
1243
|
+
const res = await doFetch(`${base}/voices`, {
|
|
1250
1244
|
method: "GET",
|
|
1251
1245
|
query
|
|
1252
1246
|
});
|
|
@@ -1275,7 +1269,7 @@ function createWebhooksApi(cfg) {
|
|
|
1275
1269
|
search: options.search,
|
|
1276
1270
|
filter: options.filter
|
|
1277
1271
|
});
|
|
1278
|
-
const res = await doFetch(`${base}/
|
|
1272
|
+
const res = await doFetch(`${base}/webhooks`, {
|
|
1279
1273
|
method: "GET",
|
|
1280
1274
|
query
|
|
1281
1275
|
});
|
|
@@ -1288,7 +1282,7 @@ function createWebhooksApi(cfg) {
|
|
|
1288
1282
|
return attachPaginator(response, fetchWebhooksPage, normalized);
|
|
1289
1283
|
},
|
|
1290
1284
|
async create(payload) {
|
|
1291
|
-
const res = await doFetch(`${base}/
|
|
1285
|
+
const res = await doFetch(`${base}/webhooks`, {
|
|
1292
1286
|
method: "POST",
|
|
1293
1287
|
headers: jsonHeaders,
|
|
1294
1288
|
body: JSON.stringify(payload)
|
|
@@ -1296,13 +1290,13 @@ function createWebhooksApi(cfg) {
|
|
|
1296
1290
|
return res.json();
|
|
1297
1291
|
},
|
|
1298
1292
|
async get(webhookId) {
|
|
1299
|
-
const res = await doFetch(`${base}/
|
|
1293
|
+
const res = await doFetch(`${base}/webhooks/${webhookId}`, {
|
|
1300
1294
|
method: "GET"
|
|
1301
1295
|
});
|
|
1302
1296
|
return res.json();
|
|
1303
1297
|
},
|
|
1304
1298
|
async update(webhookId, payload) {
|
|
1305
|
-
const res = await doFetch(`${base}/
|
|
1299
|
+
const res = await doFetch(`${base}/webhooks/${webhookId}`, {
|
|
1306
1300
|
method: "PATCH",
|
|
1307
1301
|
headers: jsonHeaders,
|
|
1308
1302
|
body: JSON.stringify(payload)
|
|
@@ -1310,7 +1304,7 @@ function createWebhooksApi(cfg) {
|
|
|
1310
1304
|
return res.json();
|
|
1311
1305
|
},
|
|
1312
1306
|
async delete(webhookId) {
|
|
1313
|
-
await doFetch(`${base}/
|
|
1307
|
+
await doFetch(`${base}/webhooks/${webhookId}`, { method: "DELETE" });
|
|
1314
1308
|
},
|
|
1315
1309
|
// Subscriptions
|
|
1316
1310
|
async listSubscriptions(webhookId, options = {}) {
|
|
@@ -1325,7 +1319,7 @@ function createWebhooksApi(cfg) {
|
|
|
1325
1319
|
filter: opts.filter
|
|
1326
1320
|
});
|
|
1327
1321
|
const res = await doFetch(
|
|
1328
|
-
`${base}/
|
|
1322
|
+
`${base}/webhooks/${webhookId}/subscriptions`,
|
|
1329
1323
|
{ method: "GET", query }
|
|
1330
1324
|
);
|
|
1331
1325
|
return res.json();
|
|
@@ -1335,26 +1329,23 @@ function createWebhooksApi(cfg) {
|
|
|
1335
1329
|
return attachPaginator(response, fetchPage, normalized);
|
|
1336
1330
|
},
|
|
1337
1331
|
async createSubscription(webhookId, payload) {
|
|
1338
|
-
const res = await doFetch(
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
body: JSON.stringify(payload)
|
|
1344
|
-
}
|
|
1345
|
-
);
|
|
1332
|
+
const res = await doFetch(`${base}/webhooks/${webhookId}/subscriptions`, {
|
|
1333
|
+
method: "POST",
|
|
1334
|
+
headers: jsonHeaders,
|
|
1335
|
+
body: JSON.stringify(payload)
|
|
1336
|
+
});
|
|
1346
1337
|
return res.json();
|
|
1347
1338
|
},
|
|
1348
1339
|
async getSubscription(webhookId, subscriptionId) {
|
|
1349
1340
|
const res = await doFetch(
|
|
1350
|
-
`${base}/
|
|
1341
|
+
`${base}/webhooks/${webhookId}/subscriptions/${subscriptionId}`,
|
|
1351
1342
|
{ method: "GET" }
|
|
1352
1343
|
);
|
|
1353
1344
|
return res.json();
|
|
1354
1345
|
},
|
|
1355
1346
|
async updateSubscription(webhookId, subscriptionId, payload) {
|
|
1356
1347
|
const res = await doFetch(
|
|
1357
|
-
`${base}/
|
|
1348
|
+
`${base}/webhooks/${webhookId}/subscriptions/${subscriptionId}`,
|
|
1358
1349
|
{
|
|
1359
1350
|
method: "PATCH",
|
|
1360
1351
|
headers: jsonHeaders,
|
|
@@ -1365,7 +1356,7 @@ function createWebhooksApi(cfg) {
|
|
|
1365
1356
|
},
|
|
1366
1357
|
async deleteSubscription(webhookId, subscriptionId) {
|
|
1367
1358
|
await doFetch(
|
|
1368
|
-
`${base}/
|
|
1359
|
+
`${base}/webhooks/${webhookId}/subscriptions/${subscriptionId}`,
|
|
1369
1360
|
{ method: "DELETE" }
|
|
1370
1361
|
);
|
|
1371
1362
|
}
|
|
@@ -1391,7 +1382,7 @@ function createWorkspacesApi(cfg) {
|
|
|
1391
1382
|
},
|
|
1392
1383
|
{ channel }
|
|
1393
1384
|
);
|
|
1394
|
-
const res = await doFetch(`${base}/
|
|
1385
|
+
const res = await doFetch(`${base}/workspaces/${workspaceId}/phones`, {
|
|
1395
1386
|
method: "GET",
|
|
1396
1387
|
query
|
|
1397
1388
|
});
|
|
@@ -1407,7 +1398,7 @@ function createWorkspacesApi(cfg) {
|
|
|
1407
1398
|
return attachPaginator(response, fetchPage, normalizedOptions);
|
|
1408
1399
|
},
|
|
1409
1400
|
async enable(workspaceId, payload) {
|
|
1410
|
-
const res = await doFetch(`${base}/
|
|
1401
|
+
const res = await doFetch(`${base}/workspaces/${workspaceId}/enable`, {
|
|
1411
1402
|
method: "POST",
|
|
1412
1403
|
headers: jsonHeaders,
|
|
1413
1404
|
body: JSON.stringify(payload)
|