UNPKG

n8n-nodes-coze

Version:

n8n node for Coze(扣子), supporting AI chat, workflow automation, file processing, and text-to-speech.

63 lines 2.27 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.executeWorkspace = executeWorkspace; async function executeWorkspace(i) { const operation = this.getNodeParameter('operation', i); const authentication = this.getNodeParameter('authentication', i); if (operation === 'list') { const credentials = await this.getCredentials(authentication); const qs = {}; const enterpriseId = this.getNodeParameter('enterpriseId', i); const userId = this.getNodeParameter('userId', i); const cozeAccountId = this.getNodeParameter('cozeAccountId', i); if (enterpriseId) { qs.enterprise_id = enterpriseId; } if (userId) { qs.user_id = userId; } if (cozeAccountId) { qs.coze_account_id = cozeAccountId; } const options = { baseURL: credentials.baseUrl, method: 'GET', url: `/v1/workspaces`, qs, json: true, }; return this.helpers.requestWithAuthentication.call(this, authentication, options); } else if (operation === 'listBots') { const credentials = await this.getCredentials(authentication); const workspaceId = this.getNodeParameter('workspaceId', i); const qs = { workspace_id: workspaceId, }; const publishStatus = this.getNodeParameter('publishStatus', i); if (publishStatus) { qs.publish_status = publishStatus; } const connectorId = this.getNodeParameter('connectorId', i); if (connectorId) { qs.connector_id = connectorId; } const pageNum = this.getNodeParameter('pageNum', i); if (pageNum) { qs.page_num = pageNum; } const pageSize = this.getNodeParameter('pageSize', i); if (pageSize) { qs.page_size = pageSize; } const options = { baseURL: credentials.baseUrl, method: 'GET', url: `/v1/bots`, qs, json: true, }; return this.helpers.requestWithAuthentication.call(this, authentication, options); } } //# sourceMappingURL=workspace.js.map