@cognigy/rest-api-client
Version:
Cognigy REST-Client
24 lines • 1.63 kB
JavaScript
import { __rest } from "tslib";
import { GenericAPIFn } from "../../GenericAPIFn";
import { stringifyQuery } from "../../shared/helper/rest";
export function addAgentAPIs(self) {
return {
// see: https://github.com/Cognigy/ai-agents-v2/blob/c690cac5864002bb9dc8addc4a4574297cddcac0/cmd/api/main.go#L169
indexAgents: (args, options) => GenericAPIFn(`/v1/agents?${stringifyQuery(args)}`, "GET", self)(undefined, options),
// see: https://github.com/Cognigy/ai-agents-v2/blob/c690cac5864002bb9dc8addc4a4574297cddcac0/cmd/api/main.go#L169
createAgent: (args, options) => 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 GenericAPIFn(`/v1/agents/${agentId}?${stringifyQuery(args)}`, "GET", self)(undefined, options);
},
// see: https://github.com/Cognigy/ai-agents-v2/blob/c690cac5864002bb9dc8addc4a4574297cddcac0/cmd/api/main.go#L169
deleteAgent: ({ agentId }, options) => 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 GenericAPIFn(`/v1/agents/${agentId}`, "PATCH", self)(args, options);
}
};
}
//# sourceMappingURL=agentAPI.js.map