n8n-nodes-feishu-fork
Version:
n8n custom nodes for n8n to interact with Feishu/Lark, including Lark Bot, Lark MCP, and Lark Trigger.
56 lines • 2.19 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const RequestUtils_1 = __importDefault(require("../../../help/utils/RequestUtils"));
const wording_1 = require("../../../help/wording");
const description_1 = require("../../../help/description");
exports.default = {
name: wording_1.WORDING.CustomApiRequest,
value: "CustomApiRequest",
order: 200,
options: [
description_1.DESCRIPTIONS.CUSTOM_PATH,
description_1.DESCRIPTIONS.CUSTOM_METHOD,
description_1.DESCRIPTIONS.CUSTOM_BODY,
description_1.DESCRIPTIONS.CUSTOM_QUERY,
{
displayName: `<a target="_blank" href="https://open.feishu.cn/document/server-docs/api-call-guide/calling-process/get-">${wording_1.WORDING.OpenDocument}</a>`,
name: 'notice',
type: 'notice',
default: '',
},
],
async call(index) {
const path = this.getNodeParameter('path', index, undefined, {
extractValue: true,
});
const method = this.getNodeParameter('method', index, undefined, {
extractValue: true,
});
const body = this.getNodeParameter('body', index, undefined, {
ensureType: 'json',
});
if (body.msg_type === 'text' && typeof body.content === 'object') {
body.content = JSON.stringify(body.content);
}
const query = this.getNodeParameter('query', index, undefined, {
ensureType: 'json',
});
const options = this.getNodeParameter('options', index, {});
let url = path;
if (query && Object.keys(query).length) {
const searchParams = new URLSearchParams(query);
url = `${url}?${searchParams.toString()}`;
}
const { data } = await RequestUtils_1.default.request.call(this, {
method: method,
url: url,
body: body,
...options,
});
return data;
},
};
//# sourceMappingURL=CustomRequest.operation.js.map