@cognigy/rest-api-client
Version:
Cognigy REST-Client
38 lines • 2.35 kB
JavaScript
;
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.addAgentAPIs = void 0;
const GenericAPIFn_1 = require("../../GenericAPIFn");
const rest_1 = require("../../shared/helper/rest");
function addAgentAPIs(self) {
return {
// see: https://github.com/Cognigy/ai-agents-v2/blob/c690cac5864002bb9dc8addc4a4574297cddcac0/cmd/api/main.go#L169
indexAgents: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)(`/v1/agents?${(0, rest_1.stringifyQuery)(args)}`, "GET", self)(undefined, options),
// see: https://github.com/Cognigy/ai-agents-v2/blob/c690cac5864002bb9dc8addc4a4574297cddcac0/cmd/api/main.go#L169
createAgent: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)("/v1/agents", "POST", self)(args, options),
// see: https://github.com/Cognigy/ai-agents-v2/blob/c690cac5864002bb9dc8addc4a4574297cddcac0/cmd/api/main.go#L169
readAgent: (_a, options) => {
var { agentId } = _a, args = __rest(_a, ["agentId"]);
return (0, GenericAPIFn_1.GenericAPIFn)(`/v1/agents/${agentId}?${(0, rest_1.stringifyQuery)(args)}`, "GET", self)(undefined, options);
},
// see: https://github.com/Cognigy/ai-agents-v2/blob/c690cac5864002bb9dc8addc4a4574297cddcac0/cmd/api/main.go#L169
deleteAgent: ({ agentId }, options) => (0, GenericAPIFn_1.GenericAPIFn)(`/v1/agents/${agentId}`, "DELETE", self)(undefined, options),
// see: https://github.com/Cognigy/ai-agents-v2/blob/c690cac5864002bb9dc8addc4a4574297cddcac0/cmd/api/main.go#L169
updateAgent: (_a, options) => {
var { agentId } = _a, args = __rest(_a, ["agentId"]);
return (0, GenericAPIFn_1.GenericAPIFn)(`/v1/agents/${agentId}`, "PATCH", self)(args, options);
}
};
}
exports.addAgentAPIs = addAgentAPIs;
//# sourceMappingURL=agentAPI.js.map