n8n-nodes-feishu-lark
Version:
n8n custom nodes for n8n to interact with Feishu/Lark, including Lark Bot, Lark MCP, and Lark Trigger.
61 lines • 2.69 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const n8n_workflow_1 = require("n8n-workflow");
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.GetMediaTempDownloadLink,
value: "getMediaTempDownloadLink",
order: 140,
options: [
description_1.DESCRIPTIONS.MEDIA_FILE_TOKENS,
{
displayName: wording_1.WORDING.Options,
name: 'options',
type: 'collection',
placeholder: wording_1.WORDING.AddField,
default: {},
options: [
{
...description_1.DESCRIPTIONS.REQUEST_BODY,
name: 'media_tmp_download_extra',
},
],
},
{
displayName: `<a target="_blank" href="https://open.feishu.cn/document/server-docs/docs/drive-v1/media/batch_get_tmp_download_url">${wording_1.WORDING.OpenDocument}</a>`,
name: 'notice',
type: 'notice',
default: '',
},
],
async call(index) {
const fileTokens = this.getNodeParameter('media_file_tokens', index);
const parsedfileTokens = typeof fileTokens === 'string' ? (0, n8n_workflow_1.jsonParse)(fileTokens) : fileTokens;
(0, n8n_workflow_1.assertParamIsArray)('fileTokens', parsedfileTokens, (val) => typeof val === 'string', this.getNode());
if (parsedfileTokens.length > 5) {
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Maximum 5 file tokens are allowed');
}
if (parsedfileTokens.length === 0) {
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Maximum 5 file tokens are allowed');
}
const options = this.getNodeParameter('options', index, {});
const extra = options.media_tmp_download_extra || undefined;
const { data: { tmp_download_urls }, } = await RequestUtils_1.default.request.call(this, {
method: 'GET',
url: '/open-apis/drive/v1/medias/batch_get_tmp_download_url',
json: true,
qs: {
file_tokens: parsedfileTokens,
...(extra && { extra: JSON.stringify(extra) }),
},
arrayFormat: 'repeat',
});
return tmp_download_urls;
},
};
//# sourceMappingURL=MediaTmpDownloadUrlGet.operation.js.map