n8n-nodes-feishu-lark
Version:
n8n custom nodes for n8n to interact with Feishu/Lark, including Lark Bot, Lark MCP, and Lark Trigger.
70 lines • 2.8 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const wording_1 = require("../../../help/wording");
const description_1 = require("../../../help/description");
const RequestUtils_1 = __importDefault(require("../../../help/utils/RequestUtils"));
exports.default = {
name: wording_1.WORDING.SearchFiles,
value: "searchFiles",
order: 197,
options: [
description_1.DESCRIPTIONS.SEARCH_KEY,
{
displayName: wording_1.WORDING.Options,
name: 'options',
type: 'collection',
placeholder: wording_1.WORDING.AddField,
default: {},
options: [
description_1.DESCRIPTIONS.SEARCH_FILE_TYPE,
description_1.DESCRIPTIONS.OFFSET,
description_1.DESCRIPTIONS.COUNT,
{
...description_1.DESCRIPTIONS.ARRAY_JSON,
displayName: 'Owner IDs(所有者 ID)',
name: 'owner_ids',
},
{
...description_1.DESCRIPTIONS.ARRAY_JSON,
displayName: 'Chat Group IDs(群组 ID)',
name: 'chat_ids',
},
],
},
{
displayName: `<a target="_blank" href="https://open.feishu.cn/document/server-docs/docs/drive-v1/search/document-search">${wording_1.WORDING.OpenDocument}</a>`,
name: 'notice',
type: 'notice',
default: '',
},
],
async call(index) {
const searchKey = this.getNodeParameter('search_key', index, undefined);
const options = this.getNodeParameter('options', index, {});
const searchFileType = options.search_file_type;
const offset = options.offset;
const count = options.count;
const ownerIds = options.owner_ids;
const chatIds = options.chat_ids;
if (offset && count && offset + count >= 200) {
throw new Error('Offset + count cannot be greater than 200');
}
const { data } = await RequestUtils_1.default.request.call(this, {
method: 'POST',
url: '/open-apis/suite/docs-api/search/object',
body: {
search_key: searchKey,
...(searchFileType && { docs_types: searchFileType }),
...(offset && { offset }),
...(count && { count }),
...(ownerIds && { owner_ids: ownerIds }),
...(chatIds && { chat_ids: chatIds }),
},
});
return data;
},
};
//# sourceMappingURL=FileSearch.operation.js.map