n8n-nodes-feishu-fork
Version:
n8n custom nodes for n8n to interact with Feishu/Lark, including Lark Bot, Lark MCP, and Lark Trigger.
58 lines • 2.46 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.CalendarAvailability,
value: "availability",
order: 193,
options: [
description_1.DESCRIPTIONS.USER_ID_TYPE,
description_1.DESCRIPTIONS.USER_ID,
description_1.DESCRIPTIONS.START_TIME,
description_1.DESCRIPTIONS.END_TIME,
{
displayName: wording_1.WORDING.Options,
name: 'options',
type: 'collection',
placeholder: wording_1.WORDING.AddField,
default: {},
options: [description_1.DESCRIPTIONS.INCLUDE_EXTERNAL_CALENDAR, description_1.DESCRIPTIONS.ONLY_BUSY],
},
{
displayName: `<a target="_blank" href="https://open.feishu.cn/document/server-docs/calendar-v4/calendar/list">${wording_1.WORDING.OpenDocument}</a>`,
name: 'notice',
type: 'notice',
default: '',
},
],
async call(index) {
const userIdType = this.getNodeParameter('user_id_type', index, 'open_id');
const userId = this.getNodeParameter('user_id', index);
const startTime = this.getNodeParameter('start_time', index, '');
const endTime = this.getNodeParameter('end_time', index, '');
const options = this.getNodeParameter('options', index, {});
const includeExternalCalendar = options.include_external_calendar || true;
const onlyBusy = options.only_busy || true;
const { data } = await RequestUtils_1.default.request.call(this, {
method: 'POST',
url: `open-apis/calendar/v4/freebusy/list`,
qs: {
user_id_type: userIdType,
},
body: {
user_id: userId,
time_min: new Date(startTime).toISOString(),
time_max: new Date(endTime).toISOString(),
include_external_calendar: includeExternalCalendar,
only_busy: onlyBusy,
},
});
return data;
},
};
//# sourceMappingURL=Availability.operation.js.map