UNPKG

n8n-nodes-feishu-lark

Version:

n8n custom nodes for n8n to interact with Feishu/Lark, including Lark Bot, Lark MCP, and Lark Trigger.

69 lines 2.82 kB
"use strict"; 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.GetBlockList, value: "getBlocks", order: 197, options: [ description_1.DESCRIPTIONS.DOCUMENT_ID, description_1.DESCRIPTIONS.WHETHER_PAGING, description_1.DESCRIPTIONS.PAGE_TOKEN, description_1.DESCRIPTIONS.PAGE_SIZE, { displayName: wording_1.WORDING.Options, name: 'options', type: 'collection', placeholder: wording_1.WORDING.AddField, default: {}, options: [description_1.DESCRIPTIONS.USER_ID_TYPE, description_1.DESCRIPTIONS.DOCUMENT_REVISION_ID], }, { displayName: `<a target="_blank" href="https://open.feishu.cn/document/server-docs/docs/docs/docx-v1/document/list">${wording_1.WORDING.OpenDocument}</a>`, name: 'notice', type: 'notice', default: '', }, ], async call(index) { const document_id = this.getNodeParameter('document_id', index, undefined, { extractValue: true, }); const whetherPaging = this.getNodeParameter('whether_paging', index, false); const pageSize = this.getNodeParameter('page_size', index, 500); let pageToken = this.getNodeParameter('page_token', index, ''); const options = this.getNodeParameter('options', index, {}); const document_revision_id = options.document_revision_id || -1; const user_id_type = options.user_id_type || 'open_id'; const allBlocks = []; let hasMore = false; do { const { data: { has_more, page_token, items }, } = await RequestUtils_1.default.request.call(this, { method: 'GET', url: `/open-apis/docx/v1/documents/${document_id}/blocks`, qs: { page_size: pageSize, page_token: pageToken, document_revision_id, user_id_type, }, }); hasMore = has_more; pageToken = page_token; if (items) { allBlocks.push(...items); } } while (!whetherPaging && hasMore); return { has_more: hasMore, ...(pageToken && { page_token: pageToken }), items: allBlocks, }; }, }; //# sourceMappingURL=GetBlockList.operation.js.map