2020-10-30 01:31:27 -07:00
|
|
|
import {
|
|
|
|
INodeProperties,
|
|
|
|
} from 'n8n-workflow';
|
|
|
|
|
2020-10-30 01:32:35 -07:00
|
|
|
export const calendarOperations = [
|
2020-10-30 01:31:27 -07:00
|
|
|
{
|
|
|
|
displayName: 'Operation',
|
|
|
|
name: 'operation',
|
|
|
|
type: 'options',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
2020-10-30 01:32:35 -07:00
|
|
|
'calendar',
|
2020-10-30 01:31:27 -07:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
2020-10-30 01:32:35 -07:00
|
|
|
name: 'Availability',
|
|
|
|
value: 'availability',
|
|
|
|
description: 'If a time-slot is available in a calendar',
|
2020-10-30 01:31:27 -07:00
|
|
|
},
|
|
|
|
],
|
2020-10-30 01:32:35 -07:00
|
|
|
default: 'availability',
|
2020-10-30 01:31:27 -07:00
|
|
|
description: 'The operation to perform.',
|
|
|
|
},
|
|
|
|
] as INodeProperties[];
|
|
|
|
|
2020-10-30 01:32:35 -07:00
|
|
|
export const calendarFields = [
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* calendar:availability */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
2020-10-30 01:31:27 -07:00
|
|
|
{
|
|
|
|
displayName: 'Calendar ID',
|
2020-10-30 01:32:35 -07:00
|
|
|
name: 'calendar',
|
2020-10-30 01:31:27 -07:00
|
|
|
type: 'options',
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getCalendars',
|
|
|
|
},
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
2020-10-30 01:32:35 -07:00
|
|
|
'calendar',
|
2020-10-30 01:31:27 -07:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
2020-10-30 01:32:35 -07:00
|
|
|
displayName: 'Start Time',
|
2020-10-30 01:31:27 -07:00
|
|
|
name: 'timeMin',
|
|
|
|
type: 'dateTime',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
operation: [
|
2020-10-30 01:32:35 -07:00
|
|
|
'availability',
|
2020-10-30 01:31:27 -07:00
|
|
|
],
|
|
|
|
resource: [
|
2020-10-30 01:32:35 -07:00
|
|
|
'calendar',
|
2020-10-30 01:31:27 -07:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'Start of the interval',
|
|
|
|
},
|
|
|
|
{
|
2020-10-30 01:32:35 -07:00
|
|
|
displayName: 'End Time',
|
2020-10-30 01:31:27 -07:00
|
|
|
name: 'timeMax',
|
|
|
|
type: 'dateTime',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
operation: [
|
2020-10-30 01:32:35 -07:00
|
|
|
'availability',
|
2020-10-30 01:31:27 -07:00
|
|
|
],
|
|
|
|
resource: [
|
2020-10-30 01:32:35 -07:00
|
|
|
'calendar',
|
2020-10-30 01:31:27 -07:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'End of the interval',
|
|
|
|
},
|
|
|
|
{
|
2020-10-30 01:32:35 -07:00
|
|
|
displayName: 'Options',
|
|
|
|
name: 'options',
|
2020-10-30 01:31:27 -07:00
|
|
|
type: 'collection',
|
2020-10-30 01:32:35 -07:00
|
|
|
placeholder: 'Add Options',
|
2020-10-30 01:31:27 -07:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
operation: [
|
2020-10-30 01:32:35 -07:00
|
|
|
'availability',
|
2020-10-30 01:31:27 -07:00
|
|
|
],
|
|
|
|
resource: [
|
2020-10-30 01:32:35 -07:00
|
|
|
'calendar',
|
2020-10-30 01:31:27 -07:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: {},
|
|
|
|
options: [
|
2020-10-30 01:32:35 -07:00
|
|
|
{
|
|
|
|
displayName: 'Output Format',
|
|
|
|
name: 'outputFormat',
|
|
|
|
type: 'options',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Availability',
|
|
|
|
value: 'availability',
|
|
|
|
description: 'Returns if there are any events in the given time or not.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Booked Slots',
|
|
|
|
value: 'bookedSlots',
|
|
|
|
description: 'Returns the booked slots.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'RAW',
|
|
|
|
value: 'raw',
|
|
|
|
description: 'Returns the RAW data from the API.',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
default: 'availability',
|
|
|
|
description: 'The format to return the data in.',
|
|
|
|
},
|
2020-10-30 01:31:27 -07:00
|
|
|
{
|
|
|
|
displayName: 'Timezone',
|
|
|
|
name: 'timezone',
|
|
|
|
type: 'options',
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getTimezones',
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'Time zone used in the response. By default n8n timezone is used.',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2020-10-30 01:32:35 -07:00
|
|
|
|
|
|
|
|
2020-10-30 01:31:27 -07:00
|
|
|
] as INodeProperties[];
|