n8n-nodes-base
Version:
Base nodes of n8n
99 lines • 3.38 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.description = exports.properties = void 0;
exports.execute = execute;
const utilities_1 = require("../../../../../../utils/utilities");
const descriptions_1 = require("../../descriptions");
const transport_1 = require("../../transport");
exports.properties = [
descriptions_1.calendarRLC,
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
options: [
{
displayName: 'Color',
name: 'color',
type: 'options',
default: 'lightBlue',
options: [
{
name: 'Light Blue',
value: 'lightBlue',
},
{
name: 'Light Brown',
value: 'lightBrown',
},
{
name: 'Light Gray',
value: 'lightGray',
},
{
name: 'Light Green',
value: 'lightGreen',
},
{
name: 'Light Orange',
value: 'lightOrange',
},
{
name: 'Light Pink',
value: 'lightPink',
},
{
name: 'Light Red',
value: 'lightRed',
},
{
name: 'Light Teal',
value: 'lightTeal',
},
{
name: 'Light Yellow',
value: 'lightYellow',
},
],
description: 'Specify the color to distinguish the calendar from the others',
},
{
displayName: 'Default Calendar',
name: 'isDefaultCalendar',
type: 'boolean',
default: false,
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
placeholder: 'e.g. My Calendar',
description: 'The name of the calendar',
},
],
},
];
const displayOptions = {
show: {
resource: ['calendar'],
operation: ['update'],
},
};
exports.description = (0, utilities_1.updateDisplayOptions)(displayOptions, exports.properties);
async function execute(index) {
const updateFields = this.getNodeParameter('updateFields', index);
const calendarId = this.getNodeParameter('calendarId', index, undefined, {
extractValue: true,
});
const endpoint = `/calendars/${calendarId}`;
const body = {
...updateFields,
};
const responseData = await transport_1.microsoftApiRequest.call(this, 'PATCH', endpoint, body);
const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: index } });
return executionData;
}
//# sourceMappingURL=update.operation.js.map