first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,118 @@
|
||||
import type { IDataObject, IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import { updateDisplayOptions } from '@utils/utilities';
|
||||
|
||||
import { microsoftApiRequest } from '../../transport';
|
||||
|
||||
export const properties: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
description: 'The name of the calendar to create',
|
||||
placeholder: 'e.g. My Calendar',
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
|
||||
displayName: 'Calendar Group',
|
||||
name: 'calendarGroup',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getCalendarGroups',
|
||||
},
|
||||
default: [],
|
||||
description:
|
||||
'If set, the calendar will be created in the specified calendar group. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
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',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['calendar'],
|
||||
operation: ['create'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
|
||||
export async function execute(this: IExecuteFunctions, index: number) {
|
||||
const additionalFields = this.getNodeParameter('additionalFields', index);
|
||||
const name = this.getNodeParameter('name', index) as string;
|
||||
|
||||
let endpoint = '/calendars';
|
||||
|
||||
if (additionalFields.calendarGroup) {
|
||||
endpoint = `/calendarGroups/${additionalFields.calendarGroup}/calendars`;
|
||||
delete additionalFields.calendarGroup;
|
||||
}
|
||||
|
||||
const body: IDataObject = {
|
||||
name,
|
||||
...additionalFields,
|
||||
};
|
||||
|
||||
const responseData = await microsoftApiRequest.call(this, 'POST', endpoint, body);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData as IDataObject),
|
||||
{ itemData: { item: index } },
|
||||
);
|
||||
|
||||
return executionData;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import type { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import { updateDisplayOptions } from '@utils/utilities';
|
||||
|
||||
import { calendarRLC } from '../../descriptions';
|
||||
import { microsoftApiRequest } from '../../transport';
|
||||
|
||||
export const properties: INodeProperties[] = [calendarRLC];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['calendar'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
|
||||
export async function execute(this: IExecuteFunctions, index: number) {
|
||||
const calendarId = this.getNodeParameter('calendarId', index, undefined, {
|
||||
extractValue: true,
|
||||
}) as string;
|
||||
|
||||
await microsoftApiRequest.call(this, 'DELETE', `/calendars/${calendarId}`);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ success: true }),
|
||||
{ itemData: { item: index } },
|
||||
);
|
||||
|
||||
return executionData;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import type { IDataObject, IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import { updateDisplayOptions } from '@utils/utilities';
|
||||
|
||||
import { calendarRLC } from '../../descriptions';
|
||||
import { microsoftApiRequest } from '../../transport';
|
||||
|
||||
export const properties: INodeProperties[] = [calendarRLC];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['calendar'],
|
||||
operation: ['get'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
|
||||
export async function execute(this: IExecuteFunctions, index: number) {
|
||||
const qs: IDataObject = {};
|
||||
|
||||
const calendarId = this.getNodeParameter('calendarId', index, undefined, {
|
||||
extractValue: true,
|
||||
}) as string;
|
||||
|
||||
const responseData = await microsoftApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/calendars/${calendarId}`,
|
||||
undefined,
|
||||
qs,
|
||||
);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData as IDataObject),
|
||||
{ itemData: { item: index } },
|
||||
);
|
||||
|
||||
return executionData;
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
import type { IDataObject, IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import { updateDisplayOptions } from '@utils/utilities';
|
||||
|
||||
import { returnAllOrLimit } from '../../descriptions';
|
||||
import { microsoftApiRequest, microsoftApiRequestAllItems } from '../../transport';
|
||||
|
||||
export const properties: INodeProperties[] = [
|
||||
...returnAllOrLimit,
|
||||
{
|
||||
displayName: 'Filters',
|
||||
name: 'filters',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Filter',
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Filter Query',
|
||||
name: 'custom',
|
||||
type: 'string',
|
||||
default: '',
|
||||
placeholder: 'e.g. canShare eq true',
|
||||
hint: 'Search query to filter calendars. <a href="https://learn.microsoft.com/en-us/graph/filter-query-parameter">More info</a>.',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['calendar'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
|
||||
export async function execute(this: IExecuteFunctions, index: number) {
|
||||
let responseData;
|
||||
const qs = {} as IDataObject;
|
||||
|
||||
const returnAll = this.getNodeParameter('returnAll', index);
|
||||
const filters = this.getNodeParameter('filters', index, {});
|
||||
|
||||
if (Object.keys(filters).length) {
|
||||
const filterString: string[] = [];
|
||||
|
||||
if (filters.custom) {
|
||||
filterString.push(filters.custom as string);
|
||||
}
|
||||
|
||||
if (filterString.length) {
|
||||
qs.$filter = filterString.join(' and ');
|
||||
}
|
||||
}
|
||||
|
||||
const endpoint = '/calendars';
|
||||
|
||||
if (returnAll) {
|
||||
responseData = await microsoftApiRequestAllItems.call(
|
||||
this,
|
||||
'value',
|
||||
'GET',
|
||||
endpoint,
|
||||
undefined,
|
||||
qs,
|
||||
);
|
||||
} else {
|
||||
qs.$top = this.getNodeParameter('limit', index);
|
||||
responseData = await microsoftApiRequest.call(this, 'GET', endpoint, undefined, qs);
|
||||
responseData = responseData.value;
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData as IDataObject),
|
||||
{ itemData: { item: index } },
|
||||
);
|
||||
|
||||
return executionData;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import * as create from './create.operation';
|
||||
import * as del from './delete.operation';
|
||||
import * as get from './get.operation';
|
||||
import * as getAll from './getAll.operation';
|
||||
import * as update from './update.operation';
|
||||
|
||||
export { create, del as delete, get, getAll, update };
|
||||
|
||||
export const description: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['calendar'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a new calendar',
|
||||
action: 'Create a calendar',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a calendar',
|
||||
action: 'Delete a calendar',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Retrieve a calendar',
|
||||
action: 'Get a calendar',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'List and search calendars',
|
||||
action: 'Get many calendars',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update a calendar',
|
||||
action: 'Update a calendar',
|
||||
},
|
||||
],
|
||||
default: 'getAll',
|
||||
},
|
||||
|
||||
...create.description,
|
||||
...del.description,
|
||||
...get.description,
|
||||
...getAll.description,
|
||||
...update.description,
|
||||
];
|
||||
@@ -0,0 +1,110 @@
|
||||
import type { IDataObject, IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import { updateDisplayOptions } from '@utils/utilities';
|
||||
|
||||
import { calendarRLC } from '../../descriptions';
|
||||
import { microsoftApiRequest } from '../../transport';
|
||||
|
||||
export const properties: INodeProperties[] = [
|
||||
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'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
|
||||
export async function execute(this: IExecuteFunctions, index: number) {
|
||||
const updateFields = this.getNodeParameter('updateFields', index);
|
||||
|
||||
const calendarId = this.getNodeParameter('calendarId', index, undefined, {
|
||||
extractValue: true,
|
||||
}) as string;
|
||||
|
||||
const endpoint = `/calendars/${calendarId}`;
|
||||
|
||||
const body: IDataObject = {
|
||||
...updateFields,
|
||||
};
|
||||
|
||||
const responseData = await microsoftApiRequest.call(this, 'PATCH', endpoint, body);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData as IDataObject),
|
||||
{ itemData: { item: index } },
|
||||
);
|
||||
|
||||
return executionData;
|
||||
}
|
||||
Reference in New Issue
Block a user