@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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## v1.20.0
|
|
2
|
+
|
|
3
|
+
## [1.20.0](https://github.com/julio-supervisor/agents-studio-be/compare/v1.19.0...v1.20.0) (2025-10-30)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add RetellToolGuidelinesService and integrate usage guidelines for voice.calls ([db0e013](https://github.com/julio-supervisor/agents-studio-be/commit/db0e013d8f09d2a0a794efccb7700729ad752fd4))
|
|
8
|
+
|
|
9
|
+
|
|
1
10
|
## v1.19.0
|
|
2
11
|
|
|
3
12
|
## [1.19.0](https://github.com/julio-supervisor/agents-studio-be/compare/v1.18.0...v1.19.0) (2025-10-30)
|
package/dist/index.cjs
CHANGED
|
@@ -353,7 +353,7 @@ function createAgentBlueprintsApi(cfg) {
|
|
|
353
353
|
const jsonHeaders = { "content-type": "application/json" };
|
|
354
354
|
const list = async (agentId, options = {}) => {
|
|
355
355
|
const query = serializeListOptions({ filter: options.filter });
|
|
356
|
-
const res = await doFetch(`${base}/
|
|
356
|
+
const res = await doFetch(`${base}/agents/${agentId}/blueprints`, {
|
|
357
357
|
method: "GET",
|
|
358
358
|
query
|
|
359
359
|
});
|
|
@@ -361,7 +361,7 @@ function createAgentBlueprintsApi(cfg) {
|
|
|
361
361
|
};
|
|
362
362
|
const get = async (agentId, versionId) => {
|
|
363
363
|
const res = await doFetch(
|
|
364
|
-
`${base}/
|
|
364
|
+
`${base}/agents/${agentId}/versions/${versionId}/blueprint`,
|
|
365
365
|
{
|
|
366
366
|
method: "GET"
|
|
367
367
|
}
|
|
@@ -370,7 +370,7 @@ function createAgentBlueprintsApi(cfg) {
|
|
|
370
370
|
};
|
|
371
371
|
const create = async (agentId, versionId, payload) => {
|
|
372
372
|
const res = await doFetch(
|
|
373
|
-
`${base}/
|
|
373
|
+
`${base}/agents/${agentId}/versions/${versionId}/blueprint`,
|
|
374
374
|
{
|
|
375
375
|
method: "POST",
|
|
376
376
|
body: JSON.stringify(payload),
|
|
@@ -381,7 +381,7 @@ function createAgentBlueprintsApi(cfg) {
|
|
|
381
381
|
};
|
|
382
382
|
const update = async (agentId, versionId, payload) => {
|
|
383
383
|
const res = await doFetch(
|
|
384
|
-
`${base}/
|
|
384
|
+
`${base}/agents/${agentId}/versions/${versionId}/blueprint`,
|
|
385
385
|
{
|
|
386
386
|
method: "PATCH",
|
|
387
387
|
body: JSON.stringify(payload),
|
|
@@ -497,7 +497,7 @@ function createAgentInstructionsApi(cfg) {
|
|
|
497
497
|
const fetchInstructionPage = async (agentId, opts = {}) => {
|
|
498
498
|
const { versionId, ...queryOptions } = opts ?? {};
|
|
499
499
|
const query = serializeListOptions(queryOptions, { versionId });
|
|
500
|
-
const res = await doFetch(`${base}/
|
|
500
|
+
const res = await doFetch(`${base}/agents/${agentId}/instructions`, {
|
|
501
501
|
method: "GET",
|
|
502
502
|
query
|
|
503
503
|
});
|
|
@@ -513,7 +513,7 @@ function createAgentInstructionsApi(cfg) {
|
|
|
513
513
|
return attachPaginator(response, fetchPage, normalizedOptions);
|
|
514
514
|
},
|
|
515
515
|
async create(agentId, payload) {
|
|
516
|
-
const res = await doFetch(`${base}/
|
|
516
|
+
const res = await doFetch(`${base}/agents/${agentId}/instructions`, {
|
|
517
517
|
method: "POST",
|
|
518
518
|
headers: jsonHeaders,
|
|
519
519
|
body: JSON.stringify(payload)
|
|
@@ -522,7 +522,7 @@ function createAgentInstructionsApi(cfg) {
|
|
|
522
522
|
},
|
|
523
523
|
async update(agentId, instructionId, payload) {
|
|
524
524
|
const res = await doFetch(
|
|
525
|
-
`${base}/
|
|
525
|
+
`${base}/agents/${agentId}/instructions/${instructionId}`,
|
|
526
526
|
{
|
|
527
527
|
method: "PATCH",
|
|
528
528
|
headers: jsonHeaders,
|
|
@@ -532,12 +532,9 @@ function createAgentInstructionsApi(cfg) {
|
|
|
532
532
|
return res.json();
|
|
533
533
|
},
|
|
534
534
|
async delete(agentId, instructionId) {
|
|
535
|
-
await doFetch(
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
method: "DELETE"
|
|
539
|
-
}
|
|
540
|
-
);
|
|
535
|
+
await doFetch(`${base}/agents/${agentId}/instructions/${instructionId}`, {
|
|
536
|
+
method: "DELETE"
|
|
537
|
+
});
|
|
541
538
|
}
|
|
542
539
|
};
|
|
543
540
|
}
|
|
@@ -548,7 +545,7 @@ function createAgentPhonesApi(cfg) {
|
|
|
548
545
|
const jsonHeaders = { "content-type": "application/json" };
|
|
549
546
|
return {
|
|
550
547
|
async connect(agentId, payload) {
|
|
551
|
-
const res = await doFetch(`${base}/
|
|
548
|
+
const res = await doFetch(`${base}/agents/${agentId}/phones`, {
|
|
552
549
|
method: "POST",
|
|
553
550
|
headers: jsonHeaders,
|
|
554
551
|
body: JSON.stringify(payload)
|
|
@@ -556,7 +553,7 @@ function createAgentPhonesApi(cfg) {
|
|
|
556
553
|
return res.json();
|
|
557
554
|
},
|
|
558
555
|
async disconnect(agentId, phoneId) {
|
|
559
|
-
await doFetch(`${base}/
|
|
556
|
+
await doFetch(`${base}/agents/${agentId}/phones/${phoneId}`, {
|
|
560
557
|
method: "DELETE"
|
|
561
558
|
});
|
|
562
559
|
}
|
|
@@ -569,13 +566,13 @@ function createAgentScheduleApi(cfg) {
|
|
|
569
566
|
const jsonHeaders = { "content-type": "application/json" };
|
|
570
567
|
return {
|
|
571
568
|
async get(agentId) {
|
|
572
|
-
const res = await doFetch(`${base}/
|
|
569
|
+
const res = await doFetch(`${base}/agents/${agentId}/schedule`, {
|
|
573
570
|
method: "GET"
|
|
574
571
|
});
|
|
575
572
|
return res.json();
|
|
576
573
|
},
|
|
577
574
|
async create(agentId, payload) {
|
|
578
|
-
const res = await doFetch(`${base}/
|
|
575
|
+
const res = await doFetch(`${base}/agents/${agentId}/schedule`, {
|
|
579
576
|
method: "POST",
|
|
580
577
|
headers: jsonHeaders,
|
|
581
578
|
body: JSON.stringify(payload)
|
|
@@ -583,7 +580,7 @@ function createAgentScheduleApi(cfg) {
|
|
|
583
580
|
return res.json();
|
|
584
581
|
},
|
|
585
582
|
async update(agentId, payload) {
|
|
586
|
-
const res = await doFetch(`${base}/
|
|
583
|
+
const res = await doFetch(`${base}/agents/${agentId}/schedule`, {
|
|
587
584
|
method: "PUT",
|
|
588
585
|
headers: jsonHeaders,
|
|
589
586
|
body: JSON.stringify(payload)
|
|
@@ -599,13 +596,10 @@ function createAgentScheduleExceptionsApi(cfg) {
|
|
|
599
596
|
const jsonHeaders = { "content-type": "application/json" };
|
|
600
597
|
const fetchExceptionsPage = async (agentId, options = {}) => {
|
|
601
598
|
const query = serializeListOptions(options ?? {});
|
|
602
|
-
const res = await doFetch(
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
query
|
|
607
|
-
}
|
|
608
|
-
);
|
|
599
|
+
const res = await doFetch(`${base}/agents/${agentId}/schedule/exceptions`, {
|
|
600
|
+
method: "GET",
|
|
601
|
+
query
|
|
602
|
+
});
|
|
609
603
|
return res.json();
|
|
610
604
|
};
|
|
611
605
|
return {
|
|
@@ -619,7 +613,7 @@ function createAgentScheduleExceptionsApi(cfg) {
|
|
|
619
613
|
},
|
|
620
614
|
async get(agentId, exceptionId) {
|
|
621
615
|
const res = await doFetch(
|
|
622
|
-
`${base}/
|
|
616
|
+
`${base}/agents/${agentId}/schedule/exceptions/${exceptionId}`,
|
|
623
617
|
{
|
|
624
618
|
method: "GET"
|
|
625
619
|
}
|
|
@@ -628,7 +622,7 @@ function createAgentScheduleExceptionsApi(cfg) {
|
|
|
628
622
|
},
|
|
629
623
|
async create(agentId, payload) {
|
|
630
624
|
const res = await doFetch(
|
|
631
|
-
`${base}/
|
|
625
|
+
`${base}/agents/${agentId}/schedule/exceptions`,
|
|
632
626
|
{
|
|
633
627
|
method: "POST",
|
|
634
628
|
headers: jsonHeaders,
|
|
@@ -639,7 +633,7 @@ function createAgentScheduleExceptionsApi(cfg) {
|
|
|
639
633
|
},
|
|
640
634
|
async update(agentId, exceptionId, payload) {
|
|
641
635
|
const res = await doFetch(
|
|
642
|
-
`${base}/
|
|
636
|
+
`${base}/agents/${agentId}/schedule/exceptions/${exceptionId}`,
|
|
643
637
|
{
|
|
644
638
|
method: "PATCH",
|
|
645
639
|
headers: jsonHeaders,
|
|
@@ -650,7 +644,7 @@ function createAgentScheduleExceptionsApi(cfg) {
|
|
|
650
644
|
},
|
|
651
645
|
async delete(agentId, exceptionId) {
|
|
652
646
|
await doFetch(
|
|
653
|
-
`${base}/
|
|
647
|
+
`${base}/agents/${agentId}/schedule/exceptions/${exceptionId}`,
|
|
654
648
|
{
|
|
655
649
|
method: "DELETE"
|
|
656
650
|
}
|
|
@@ -665,7 +659,7 @@ function createAgentTagsApi(cfg) {
|
|
|
665
659
|
const jsonHeaders = { "content-type": "application/json" };
|
|
666
660
|
return {
|
|
667
661
|
async add(agentId, payload) {
|
|
668
|
-
const res = await doFetch(`${base}/
|
|
662
|
+
const res = await doFetch(`${base}/agents/${agentId}/tags`, {
|
|
669
663
|
method: "POST",
|
|
670
664
|
headers: jsonHeaders,
|
|
671
665
|
body: JSON.stringify(payload)
|
|
@@ -673,7 +667,7 @@ function createAgentTagsApi(cfg) {
|
|
|
673
667
|
return res.json();
|
|
674
668
|
},
|
|
675
669
|
async remove(agentId, tagId) {
|
|
676
|
-
await doFetch(`${base}/
|
|
670
|
+
await doFetch(`${base}/agents/${agentId}/tags/${tagId}`, {
|
|
677
671
|
method: "DELETE"
|
|
678
672
|
});
|
|
679
673
|
}
|
|
@@ -691,7 +685,7 @@ function createAgentVersionsApi(cfg) {
|
|
|
691
685
|
filter: opts.filter
|
|
692
686
|
};
|
|
693
687
|
const query = serializeListOptions(queryOptions);
|
|
694
|
-
const res = await doFetch(`${base}/
|
|
688
|
+
const res = await doFetch(`${base}/agents/${agentId}/versions`, {
|
|
695
689
|
method: "GET",
|
|
696
690
|
query
|
|
697
691
|
});
|
|
@@ -706,7 +700,7 @@ function createAgentVersionsApi(cfg) {
|
|
|
706
700
|
},
|
|
707
701
|
async get(agentId, versionId) {
|
|
708
702
|
const res = await doFetch(
|
|
709
|
-
`${base}/
|
|
703
|
+
`${base}/agents/${agentId}/versions/${versionId}`,
|
|
710
704
|
{
|
|
711
705
|
method: "GET"
|
|
712
706
|
}
|
|
@@ -714,7 +708,7 @@ function createAgentVersionsApi(cfg) {
|
|
|
714
708
|
return res.json();
|
|
715
709
|
},
|
|
716
710
|
async create(agentId, payload) {
|
|
717
|
-
const res = await doFetch(`${base}/
|
|
711
|
+
const res = await doFetch(`${base}/agents/${agentId}/versions`, {
|
|
718
712
|
method: "POST",
|
|
719
713
|
headers: jsonHeaders,
|
|
720
714
|
body: JSON.stringify(payload ?? {})
|
|
@@ -723,7 +717,7 @@ function createAgentVersionsApi(cfg) {
|
|
|
723
717
|
},
|
|
724
718
|
async clone(agentId, versionId) {
|
|
725
719
|
const res = await doFetch(
|
|
726
|
-
`${base}/
|
|
720
|
+
`${base}/agents/${agentId}/versions/${versionId}/clone`,
|
|
727
721
|
{
|
|
728
722
|
method: "POST"
|
|
729
723
|
}
|
|
@@ -732,7 +726,7 @@ function createAgentVersionsApi(cfg) {
|
|
|
732
726
|
},
|
|
733
727
|
async publish(agentId, versionId, payload) {
|
|
734
728
|
const res = await doFetch(
|
|
735
|
-
`${base}/
|
|
729
|
+
`${base}/agents/${agentId}/versions/${versionId}/publish`,
|
|
736
730
|
{
|
|
737
731
|
method: "POST",
|
|
738
732
|
headers: jsonHeaders,
|
|
@@ -743,7 +737,7 @@ function createAgentVersionsApi(cfg) {
|
|
|
743
737
|
},
|
|
744
738
|
async updateNotes(agentId, versionId, payload) {
|
|
745
739
|
const res = await doFetch(
|
|
746
|
-
`${base}/
|
|
740
|
+
`${base}/agents/${agentId}/versions/${versionId}/notes`,
|
|
747
741
|
{
|
|
748
742
|
method: "PATCH",
|
|
749
743
|
headers: jsonHeaders,
|
|
@@ -755,7 +749,7 @@ function createAgentVersionsApi(cfg) {
|
|
|
755
749
|
async listInstructions(agentId, versionId, opts = {}) {
|
|
756
750
|
const query = serializeListOptions(opts);
|
|
757
751
|
const res = await doFetch(
|
|
758
|
-
`${base}/
|
|
752
|
+
`${base}/agents/${agentId}/versions/${versionId}/instructions`,
|
|
759
753
|
{
|
|
760
754
|
method: "GET",
|
|
761
755
|
query
|
|
@@ -765,7 +759,7 @@ function createAgentVersionsApi(cfg) {
|
|
|
765
759
|
},
|
|
766
760
|
async createInstruction(agentId, versionId, payload) {
|
|
767
761
|
const res = await doFetch(
|
|
768
|
-
`${base}/
|
|
762
|
+
`${base}/agents/${agentId}/versions/${versionId}/instructions`,
|
|
769
763
|
{
|
|
770
764
|
method: "POST",
|
|
771
765
|
headers: jsonHeaders,
|
|
@@ -776,7 +770,7 @@ function createAgentVersionsApi(cfg) {
|
|
|
776
770
|
},
|
|
777
771
|
async updateInstruction(agentId, versionId, instructionId, payload) {
|
|
778
772
|
const res = await doFetch(
|
|
779
|
-
`${base}/
|
|
773
|
+
`${base}/agents/${agentId}/versions/${versionId}/instructions/${instructionId}`,
|
|
780
774
|
{
|
|
781
775
|
method: "PATCH",
|
|
782
776
|
headers: jsonHeaders,
|
|
@@ -787,7 +781,7 @@ function createAgentVersionsApi(cfg) {
|
|
|
787
781
|
},
|
|
788
782
|
async deleteInstruction(agentId, versionId, instructionId) {
|
|
789
783
|
await doFetch(
|
|
790
|
-
`${base}/
|
|
784
|
+
`${base}/agents/${agentId}/versions/${versionId}/instructions/${instructionId}`,
|
|
791
785
|
{
|
|
792
786
|
method: "DELETE"
|
|
793
787
|
}
|
|
@@ -964,7 +958,7 @@ function createAgentsApi(cfg, relatedApis) {
|
|
|
964
958
|
filter: options.filter
|
|
965
959
|
};
|
|
966
960
|
const query = serializeListOptions(sanitizedOptions);
|
|
967
|
-
const res = await doFetch(`${base}/
|
|
961
|
+
const res = await doFetch(`${base}/agents`, {
|
|
968
962
|
method: "GET",
|
|
969
963
|
query
|
|
970
964
|
});
|
|
@@ -976,13 +970,13 @@ function createAgentsApi(cfg, relatedApis) {
|
|
|
976
970
|
return attachPaginator(response, fetchAgentsPage, normalizedOptions);
|
|
977
971
|
};
|
|
978
972
|
const getAgentDetail = async (agentId) => {
|
|
979
|
-
const res = await doFetch(`${base}/
|
|
973
|
+
const res = await doFetch(`${base}/agents/${agentId}`, {
|
|
980
974
|
method: "GET"
|
|
981
975
|
});
|
|
982
976
|
return res.json();
|
|
983
977
|
};
|
|
984
978
|
const createAgent = async (payload) => {
|
|
985
|
-
const res = await doFetch(`${base}/
|
|
979
|
+
const res = await doFetch(`${base}/agents`, {
|
|
986
980
|
method: "POST",
|
|
987
981
|
body: JSON.stringify(payload),
|
|
988
982
|
headers: jsonHeaders
|
|
@@ -990,7 +984,7 @@ function createAgentsApi(cfg, relatedApis) {
|
|
|
990
984
|
return res.json();
|
|
991
985
|
};
|
|
992
986
|
const updateAgent = async (agentId, payload) => {
|
|
993
|
-
const res = await doFetch(`${base}/
|
|
987
|
+
const res = await doFetch(`${base}/agents/${agentId}`, {
|
|
994
988
|
method: "PATCH",
|
|
995
989
|
body: JSON.stringify(payload),
|
|
996
990
|
headers: jsonHeaders
|
|
@@ -1002,7 +996,7 @@ function createAgentsApi(cfg, relatedApis) {
|
|
|
1002
996
|
};
|
|
1003
997
|
const deleteAgent = async (agent) => {
|
|
1004
998
|
const agentId = resolveAgentId(agent);
|
|
1005
|
-
await doFetch(`${base}/
|
|
999
|
+
await doFetch(`${base}/agents/${agentId}`, {
|
|
1006
1000
|
method: "DELETE"
|
|
1007
1001
|
});
|
|
1008
1002
|
};
|
|
@@ -1072,11 +1066,11 @@ function createApiKeysApi(cfg) {
|
|
|
1072
1066
|
const jsonHeaders = { "content-type": "application/json" };
|
|
1073
1067
|
return {
|
|
1074
1068
|
async list() {
|
|
1075
|
-
const res = await doFetch(`${base}/
|
|
1069
|
+
const res = await doFetch(`${base}/api-keys`, { method: "GET" });
|
|
1076
1070
|
return res.json();
|
|
1077
1071
|
},
|
|
1078
1072
|
async create(payload) {
|
|
1079
|
-
const res = await doFetch(`${base}/
|
|
1073
|
+
const res = await doFetch(`${base}/api-keys`, {
|
|
1080
1074
|
method: "POST",
|
|
1081
1075
|
headers: jsonHeaders,
|
|
1082
1076
|
body: JSON.stringify(payload)
|
|
@@ -1084,12 +1078,12 @@ function createApiKeysApi(cfg) {
|
|
|
1084
1078
|
return res.json();
|
|
1085
1079
|
},
|
|
1086
1080
|
async revoke(apiKeyId) {
|
|
1087
|
-
await doFetch(`${base}/
|
|
1081
|
+
await doFetch(`${base}/api-keys/${apiKeyId}`, {
|
|
1088
1082
|
method: "DELETE"
|
|
1089
1083
|
});
|
|
1090
1084
|
},
|
|
1091
1085
|
async show(apiKeyId) {
|
|
1092
|
-
const res = await doFetch(`${base}/
|
|
1086
|
+
const res = await doFetch(`${base}/api-keys/${apiKeyId}/show`, {
|
|
1093
1087
|
method: "GET"
|
|
1094
1088
|
});
|
|
1095
1089
|
return res.json();
|
|
@@ -1103,7 +1097,7 @@ function createCatalogsApi(cfg) {
|
|
|
1103
1097
|
const jsonHeaders = { "content-type": "application/json" };
|
|
1104
1098
|
const fetchCatalogItemsPage = async (options = {}) => {
|
|
1105
1099
|
const query = serializeListOptions(options ?? {});
|
|
1106
|
-
const res = await doFetch(`${base}/
|
|
1100
|
+
const res = await doFetch(`${base}/catalogs/items`, {
|
|
1107
1101
|
method: "GET",
|
|
1108
1102
|
query
|
|
1109
1103
|
});
|
|
@@ -1122,13 +1116,13 @@ function createCatalogsApi(cfg) {
|
|
|
1122
1116
|
);
|
|
1123
1117
|
},
|
|
1124
1118
|
async get(itemId) {
|
|
1125
|
-
const res = await doFetch(`${base}/
|
|
1119
|
+
const res = await doFetch(`${base}/catalogs/items/${itemId}`, {
|
|
1126
1120
|
method: "GET"
|
|
1127
1121
|
});
|
|
1128
1122
|
return res.json();
|
|
1129
1123
|
},
|
|
1130
1124
|
async create(payload) {
|
|
1131
|
-
const res = await doFetch(`${base}/
|
|
1125
|
+
const res = await doFetch(`${base}/catalogs/items`, {
|
|
1132
1126
|
method: "POST",
|
|
1133
1127
|
headers: jsonHeaders,
|
|
1134
1128
|
body: JSON.stringify(payload)
|
|
@@ -1136,7 +1130,7 @@ function createCatalogsApi(cfg) {
|
|
|
1136
1130
|
return res.json();
|
|
1137
1131
|
},
|
|
1138
1132
|
async remove(itemId) {
|
|
1139
|
-
await doFetch(`${base}/
|
|
1133
|
+
await doFetch(`${base}/catalogs/items/${itemId}`, {
|
|
1140
1134
|
method: "DELETE"
|
|
1141
1135
|
});
|
|
1142
1136
|
}
|
|
@@ -1196,7 +1190,7 @@ function createToolsApi(cfg) {
|
|
|
1196
1190
|
const fetchToolsPage = async (options = {}) => {
|
|
1197
1191
|
const { agentType, ...queryOptions } = options ?? {};
|
|
1198
1192
|
const query = serializeListOptions(queryOptions, { agentType });
|
|
1199
|
-
const res = await doFetch(`${base}/
|
|
1193
|
+
const res = await doFetch(`${base}/tools`, {
|
|
1200
1194
|
method: "GET",
|
|
1201
1195
|
query
|
|
1202
1196
|
});
|
|
@@ -1205,7 +1199,7 @@ function createToolsApi(cfg) {
|
|
|
1205
1199
|
const fetchToolResourcesPage = async (toolId, options = {}) => {
|
|
1206
1200
|
const { type, ...queryOptions } = options ?? {};
|
|
1207
1201
|
const query = serializeListOptions(queryOptions, { type });
|
|
1208
|
-
const res = await doFetch(`${base}/
|
|
1202
|
+
const res = await doFetch(`${base}/tools/${toolId}/resources`, {
|
|
1209
1203
|
method: "GET",
|
|
1210
1204
|
query
|
|
1211
1205
|
});
|
|
@@ -1227,20 +1221,20 @@ function createToolsApi(cfg) {
|
|
|
1227
1221
|
},
|
|
1228
1222
|
async uploadResource(toolId, payload) {
|
|
1229
1223
|
const formData = toFormData(payload);
|
|
1230
|
-
const res = await doFetch(`${base}/
|
|
1224
|
+
const res = await doFetch(`${base}/tools/${toolId}/resources`, {
|
|
1231
1225
|
method: "POST",
|
|
1232
1226
|
body: formData
|
|
1233
1227
|
});
|
|
1234
1228
|
return res.json();
|
|
1235
1229
|
},
|
|
1236
1230
|
async deleteResource(toolId, resourceId) {
|
|
1237
|
-
await doFetch(`${base}/
|
|
1231
|
+
await doFetch(`${base}/tools/${toolId}/resources/${resourceId}`, {
|
|
1238
1232
|
method: "DELETE"
|
|
1239
1233
|
});
|
|
1240
1234
|
},
|
|
1241
1235
|
async reloadResource(toolId, resourceId) {
|
|
1242
1236
|
const res = await doFetch(
|
|
1243
|
-
`${base}/
|
|
1237
|
+
`${base}/tools/${toolId}/resources/${resourceId}/reload`,
|
|
1244
1238
|
{
|
|
1245
1239
|
method: "POST"
|
|
1246
1240
|
}
|
|
@@ -1249,7 +1243,7 @@ function createToolsApi(cfg) {
|
|
|
1249
1243
|
},
|
|
1250
1244
|
async execute(toolId, payload, options = {}) {
|
|
1251
1245
|
const idempotencyKey = generateIdempotencyKey(options.idempotencyKey);
|
|
1252
|
-
const res = await doFetch(`${base}/
|
|
1246
|
+
const res = await doFetch(`${base}/tools/${toolId}/execute`, {
|
|
1253
1247
|
method: "POST",
|
|
1254
1248
|
headers: {
|
|
1255
1249
|
...jsonHeaders,
|
|
@@ -1261,7 +1255,7 @@ function createToolsApi(cfg) {
|
|
|
1261
1255
|
},
|
|
1262
1256
|
async connect(toolId, payload, options = {}) {
|
|
1263
1257
|
const idempotencyKey = generateIdempotencyKey(options.idempotencyKey);
|
|
1264
|
-
const res = await doFetch(`${base}/
|
|
1258
|
+
const res = await doFetch(`${base}/tools/${toolId}/connections`, {
|
|
1265
1259
|
method: "POST",
|
|
1266
1260
|
headers: {
|
|
1267
1261
|
...jsonHeaders,
|
|
@@ -1297,7 +1291,7 @@ function createVoicesApi(cfg) {
|
|
|
1297
1291
|
locale
|
|
1298
1292
|
}
|
|
1299
1293
|
);
|
|
1300
|
-
const res = await doFetch(`${base}/
|
|
1294
|
+
const res = await doFetch(`${base}/voices`, {
|
|
1301
1295
|
method: "GET",
|
|
1302
1296
|
query
|
|
1303
1297
|
});
|
|
@@ -1326,7 +1320,7 @@ function createWebhooksApi(cfg) {
|
|
|
1326
1320
|
search: options.search,
|
|
1327
1321
|
filter: options.filter
|
|
1328
1322
|
});
|
|
1329
|
-
const res = await doFetch(`${base}/
|
|
1323
|
+
const res = await doFetch(`${base}/webhooks`, {
|
|
1330
1324
|
method: "GET",
|
|
1331
1325
|
query
|
|
1332
1326
|
});
|
|
@@ -1339,7 +1333,7 @@ function createWebhooksApi(cfg) {
|
|
|
1339
1333
|
return attachPaginator(response, fetchWebhooksPage, normalized);
|
|
1340
1334
|
},
|
|
1341
1335
|
async create(payload) {
|
|
1342
|
-
const res = await doFetch(`${base}/
|
|
1336
|
+
const res = await doFetch(`${base}/webhooks`, {
|
|
1343
1337
|
method: "POST",
|
|
1344
1338
|
headers: jsonHeaders,
|
|
1345
1339
|
body: JSON.stringify(payload)
|
|
@@ -1347,13 +1341,13 @@ function createWebhooksApi(cfg) {
|
|
|
1347
1341
|
return res.json();
|
|
1348
1342
|
},
|
|
1349
1343
|
async get(webhookId) {
|
|
1350
|
-
const res = await doFetch(`${base}/
|
|
1344
|
+
const res = await doFetch(`${base}/webhooks/${webhookId}`, {
|
|
1351
1345
|
method: "GET"
|
|
1352
1346
|
});
|
|
1353
1347
|
return res.json();
|
|
1354
1348
|
},
|
|
1355
1349
|
async update(webhookId, payload) {
|
|
1356
|
-
const res = await doFetch(`${base}/
|
|
1350
|
+
const res = await doFetch(`${base}/webhooks/${webhookId}`, {
|
|
1357
1351
|
method: "PATCH",
|
|
1358
1352
|
headers: jsonHeaders,
|
|
1359
1353
|
body: JSON.stringify(payload)
|
|
@@ -1361,7 +1355,7 @@ function createWebhooksApi(cfg) {
|
|
|
1361
1355
|
return res.json();
|
|
1362
1356
|
},
|
|
1363
1357
|
async delete(webhookId) {
|
|
1364
|
-
await doFetch(`${base}/
|
|
1358
|
+
await doFetch(`${base}/webhooks/${webhookId}`, { method: "DELETE" });
|
|
1365
1359
|
},
|
|
1366
1360
|
// Subscriptions
|
|
1367
1361
|
async listSubscriptions(webhookId, options = {}) {
|
|
@@ -1376,7 +1370,7 @@ function createWebhooksApi(cfg) {
|
|
|
1376
1370
|
filter: opts.filter
|
|
1377
1371
|
});
|
|
1378
1372
|
const res = await doFetch(
|
|
1379
|
-
`${base}/
|
|
1373
|
+
`${base}/webhooks/${webhookId}/subscriptions`,
|
|
1380
1374
|
{ method: "GET", query }
|
|
1381
1375
|
);
|
|
1382
1376
|
return res.json();
|
|
@@ -1386,26 +1380,23 @@ function createWebhooksApi(cfg) {
|
|
|
1386
1380
|
return attachPaginator(response, fetchPage, normalized);
|
|
1387
1381
|
},
|
|
1388
1382
|
async createSubscription(webhookId, payload) {
|
|
1389
|
-
const res = await doFetch(
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
body: JSON.stringify(payload)
|
|
1395
|
-
}
|
|
1396
|
-
);
|
|
1383
|
+
const res = await doFetch(`${base}/webhooks/${webhookId}/subscriptions`, {
|
|
1384
|
+
method: "POST",
|
|
1385
|
+
headers: jsonHeaders,
|
|
1386
|
+
body: JSON.stringify(payload)
|
|
1387
|
+
});
|
|
1397
1388
|
return res.json();
|
|
1398
1389
|
},
|
|
1399
1390
|
async getSubscription(webhookId, subscriptionId) {
|
|
1400
1391
|
const res = await doFetch(
|
|
1401
|
-
`${base}/
|
|
1392
|
+
`${base}/webhooks/${webhookId}/subscriptions/${subscriptionId}`,
|
|
1402
1393
|
{ method: "GET" }
|
|
1403
1394
|
);
|
|
1404
1395
|
return res.json();
|
|
1405
1396
|
},
|
|
1406
1397
|
async updateSubscription(webhookId, subscriptionId, payload) {
|
|
1407
1398
|
const res = await doFetch(
|
|
1408
|
-
`${base}/
|
|
1399
|
+
`${base}/webhooks/${webhookId}/subscriptions/${subscriptionId}`,
|
|
1409
1400
|
{
|
|
1410
1401
|
method: "PATCH",
|
|
1411
1402
|
headers: jsonHeaders,
|
|
@@ -1416,7 +1407,7 @@ function createWebhooksApi(cfg) {
|
|
|
1416
1407
|
},
|
|
1417
1408
|
async deleteSubscription(webhookId, subscriptionId) {
|
|
1418
1409
|
await doFetch(
|
|
1419
|
-
`${base}/
|
|
1410
|
+
`${base}/webhooks/${webhookId}/subscriptions/${subscriptionId}`,
|
|
1420
1411
|
{ method: "DELETE" }
|
|
1421
1412
|
);
|
|
1422
1413
|
}
|
|
@@ -1442,7 +1433,7 @@ function createWorkspacesApi(cfg) {
|
|
|
1442
1433
|
},
|
|
1443
1434
|
{ channel }
|
|
1444
1435
|
);
|
|
1445
|
-
const res = await doFetch(`${base}/
|
|
1436
|
+
const res = await doFetch(`${base}/workspaces/${workspaceId}/phones`, {
|
|
1446
1437
|
method: "GET",
|
|
1447
1438
|
query
|
|
1448
1439
|
});
|
|
@@ -1458,7 +1449,7 @@ function createWorkspacesApi(cfg) {
|
|
|
1458
1449
|
return attachPaginator(response, fetchPage, normalizedOptions);
|
|
1459
1450
|
},
|
|
1460
1451
|
async enable(workspaceId, payload) {
|
|
1461
|
-
const res = await doFetch(`${base}/
|
|
1452
|
+
const res = await doFetch(`${base}/workspaces/${workspaceId}/enable`, {
|
|
1462
1453
|
method: "POST",
|
|
1463
1454
|
headers: jsonHeaders,
|
|
1464
1455
|
body: JSON.stringify(payload)
|