@cognigy/rest-api-client
Version:
Cognigy REST-Client
33 lines • 2.47 kB
JavaScript
import { __rest } from "tslib";
import { GenericAPIFn } from "../../GenericAPIFn";
import { stringifyQuery } from "../../shared/helper/rest";
export function addToolAPIs(self) {
return {
// see: https://github.com/Cognigy/ai-agents-v2/blob/b268349a3d9dac9ad436dd785ceb50f8de33eca0/internal/tools/api.go#L46
indexTools: (args, options) => GenericAPIFn(`/v1/tools?${stringifyQuery(args)}`, "GET", self)(undefined, options),
// see: https://github.com/Cognigy/ai-agents-v2/blob/b268349a3d9dac9ad436dd785ceb50f8de33eca0/internal/tools/api.go#L138
createTool: (args, options) => GenericAPIFn("/v1/tools", "POST", self)(args, options),
// see: https://github.com/Cognigy/ai-agents-v2/blob/b268349a3d9dac9ad436dd785ceb50f8de33eca0/internal/tools/api.go#L203
readTool: (_a, options) => {
var { toolId } = _a, args = __rest(_a, ["toolId"]);
return GenericAPIFn(`/v1/tools/${toolId}?${stringifyQuery(args)}`, "GET", self)(undefined, options);
},
// see: https://github.com/Cognigy/ai-agents-v2/blob/b268349a3d9dac9ad436dd785ceb50f8de33eca0/internal/tools/api.go#L349
updateTool: (args, options) => GenericAPIFn(`/v1/tools/${args.toolId}`, "PATCH", self)(args, options),
// see: https://github.com/Cognigy/ai-agents-v2/blob/b268349a3d9dac9ad436dd785ceb50f8de33eca0/internal/tools/api.go#L300
deleteTool: ({ toolId }, options) => GenericAPIFn(`/v1/tools/${toolId}`, "DELETE", self)(undefined, options),
// see: https://github.com/Cognigy/ai-agents-v2/blob/92b1ee76d5741a60e6cab293bb71c0007f898a1f/internal/tools/api.go#L391
executeTool: (_a, options) => {
var { toolId } = _a, args = __rest(_a, ["toolId"]);
return GenericAPIFn(`/v1/tools/${toolId}/execute`, "POST", self)(args, options);
},
// see: https://github.com/Cognigy/ai-agents-v2/blob/92b1ee76d5741a60e6cab293bb71c0007f898a1f/internal/tools/api.go#L658
deployTool: (_a, options) => {
var { toolId } = _a, args = __rest(_a, ["toolId"]);
return GenericAPIFn(`/v1/tools/${toolId}/deploy`, "POST", self)(args, options);
},
// see: https://github.com/Cognigy/ai-agents-v2/blob/92b1ee76d5741a60e6cab293bb71c0007f898a1f/internal/tools/api.go#L728
getToolCode: ({ toolId }, options) => GenericAPIFn(`/v1/tools/${toolId}/code`, "GET", self)(undefined, options)
};
}
//# sourceMappingURL=toolAPI.js.map