2023-01-27 03:22:44 -08:00
import type { INodeProperties } from 'n8n-workflow' ;
2021-09-18 13:45:57 -07:00
export const eventOperations : INodeProperties [ ] = [
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'event' ] ,
2021-09-18 13:45:57 -07:00
} ,
} ,
noDataExpression : true ,
options : [
{
name : 'Create' ,
value : 'create' ,
2022-07-10 13:50:51 -07:00
action : 'Create an event' ,
2021-09-18 13:45:57 -07:00
} ,
{
name : 'Delete' ,
value : 'delete' ,
2022-07-10 13:50:51 -07:00
action : 'Delete an event' ,
2021-09-18 13:45:57 -07:00
} ,
{
name : 'Get' ,
value : 'get' ,
2022-07-10 13:50:51 -07:00
action : 'Get an event' ,
2021-09-18 13:45:57 -07:00
} ,
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2021-09-18 13:45:57 -07:00
value : 'getAll' ,
2022-09-08 08:10:13 -07:00
action : 'Get many events' ,
2021-09-18 13:45:57 -07:00
} ,
{
name : 'Publish' ,
value : 'publish' ,
2022-07-10 13:50:51 -07:00
action : 'Publish an event' ,
2021-09-18 13:45:57 -07:00
} ,
{
name : 'Unpublish' ,
value : 'unpublish' ,
2022-07-10 13:50:51 -07:00
action : 'Unpublish an event' ,
2021-09-18 13:45:57 -07:00
} ,
{
name : 'Update' ,
value : 'update' ,
2022-07-10 13:50:51 -07:00
action : 'Update an event' ,
2021-09-18 13:45:57 -07:00
} ,
] ,
default : 'create' ,
} ,
] ;
export const eventFields : INodeProperties [ ] = [
// ----------------------------------------
// event: create
// ----------------------------------------
{
2022-06-03 10:23:49 -07:00
displayName : 'Organization Name or ID' ,
2021-09-18 13:45:57 -07:00
name : 'org_id' ,
type : 'options' ,
default : '' ,
required : true ,
2022-08-17 08:50:24 -07:00
description :
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2021-09-18 13:45:57 -07:00
typeOptions : {
loadOptionsMethod : 'getOrgs' ,
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'event' ] ,
operation : [ 'create' ] ,
2021-09-18 13:45:57 -07:00
} ,
} ,
} ,
{
displayName : 'Information' ,
name : 'information' ,
type : 'string' ,
default : '' ,
required : true ,
description : 'Information on the event - max 65535 characters' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'event' ] ,
operation : [ 'create' ] ,
2021-09-18 13:45:57 -07:00
} ,
} ,
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'event' ] ,
operation : [ 'create' ] ,
2021-09-18 13:45:57 -07:00
} ,
} ,
options : [
{
displayName : 'Analysis' ,
name : 'analysis' ,
type : 'options' ,
default : 0 ,
description : 'Analysis maturity level of the event' ,
options : [
{
name : 'Initial' ,
value : 0 ,
} ,
{
name : 'Ongoing' ,
value : 1 ,
} ,
{
name : 'Complete' ,
value : 2 ,
} ,
] ,
} ,
{
displayName : 'Distribution' ,
name : 'distribution' ,
type : 'options' ,
default : 0 ,
description : 'Who will be able to see this event once published' ,
options : [
{
2022-06-03 10:23:49 -07:00
name : 'All Communities' ,
value : 3 ,
2021-09-18 13:45:57 -07:00
} ,
{
name : 'Connected Communities' ,
value : 2 ,
} ,
{
2022-06-03 10:23:49 -07:00
name : 'Inherit Event' ,
value : 5 ,
2021-09-18 13:45:57 -07:00
} ,
{
name : 'Sharing Group' ,
value : 4 ,
} ,
{
2022-06-03 10:23:49 -07:00
name : 'This Community Only' ,
value : 1 ,
} ,
{
name : 'Your Organization Only' ,
value : 0 ,
2021-09-18 13:45:57 -07:00
} ,
] ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Sharing Group Name or ID' ,
2021-09-18 13:45:57 -07:00
name : 'sharing_group_id' ,
type : 'options' ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'Use only for when <code>Sharing Group</code> is selected in <code>Distribution</code>. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-09-18 13:45:57 -07:00
typeOptions : {
loadOptionsMethod : 'getSharingGroups' ,
} ,
} ,
{
displayName : 'Threat Level ID' ,
name : 'threat_level_id' ,
type : 'options' ,
default : 1 ,
options : [
{
name : 'High' ,
value : 1 ,
} ,
{
name : 'Medium' ,
value : 2 ,
} ,
{
name : 'Low' ,
value : 3 ,
} ,
{
name : 'Undefined' ,
value : 4 ,
} ,
] ,
} ,
] ,
} ,
// ----------------------------------------
// event: delete
// ----------------------------------------
{
displayName : 'Event ID' ,
name : 'eventId' ,
description : 'UUID or numeric ID of the event' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'event' ] ,
operation : [ 'delete' ] ,
2021-09-18 13:45:57 -07:00
} ,
} ,
} ,
// ----------------------------------------
// event: get
// ----------------------------------------
{
displayName : 'Event ID' ,
name : 'eventId' ,
description : 'UUID or numeric ID of the event' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'event' ] ,
operation : [ 'get' ] ,
2021-09-18 13:45:57 -07:00
} ,
} ,
} ,
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
default : false ,
description : 'Whether to return all results or only up to a given limit' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'event' ] ,
operation : [ 'getAll' ] ,
2021-09-18 13:45:57 -07:00
} ,
} ,
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
default : 50 ,
description : 'Max number of results to return' ,
typeOptions : {
minValue : 1 ,
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'event' ] ,
operation : [ 'getAll' ] ,
returnAll : [ false ] ,
2021-09-18 13:45:57 -07:00
} ,
} ,
} ,
// ----------------------------------------
// event: publish
// ----------------------------------------
{
displayName : 'Event ID' ,
name : 'eventId' ,
description : 'UUID or numeric ID of the event' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'event' ] ,
operation : [ 'publish' ] ,
2021-09-18 13:45:57 -07:00
} ,
} ,
} ,
// ----------------------------------------
// event: unpublish
// ----------------------------------------
{
displayName : 'Event ID' ,
name : 'eventId' ,
description : 'UUID or numeric ID of the event' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'event' ] ,
operation : [ 'unpublish' ] ,
2021-09-18 13:45:57 -07:00
} ,
} ,
} ,
// ----------------------------------------
// event: update
// ----------------------------------------
{
displayName : 'Event ID' ,
name : 'eventId' ,
description : 'UUID or numeric ID of the event' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'event' ] ,
operation : [ 'update' ] ,
2021-09-18 13:45:57 -07:00
} ,
} ,
} ,
{
displayName : 'Update Fields' ,
name : 'updateFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'event' ] ,
operation : [ 'update' ] ,
2021-09-18 13:45:57 -07:00
} ,
} ,
options : [
{
displayName : 'Analysis' ,
name : 'analysis' ,
type : 'options' ,
default : 0 ,
description : 'Analysis maturity level of the event' ,
options : [
{
name : 'Initial' ,
value : 0 ,
} ,
{
name : 'Ongoing' ,
value : 1 ,
} ,
{
name : 'Complete' ,
value : 2 ,
} ,
] ,
} ,
{
displayName : 'Distribution' ,
name : 'distribution' ,
type : 'options' ,
default : 0 ,
description : 'Who will be able to see this event once published' ,
options : [
{
2022-06-03 10:23:49 -07:00
name : 'All Communities' ,
value : 3 ,
2021-09-18 13:45:57 -07:00
} ,
{
name : 'Connected Communities' ,
value : 2 ,
} ,
{
2022-06-03 10:23:49 -07:00
name : 'Inherit Event' ,
value : 5 ,
2021-09-18 13:45:57 -07:00
} ,
{
name : 'Sharing Group' ,
value : 4 ,
} ,
{
2022-06-03 10:23:49 -07:00
name : 'This Community Only' ,
value : 1 ,
} ,
{
name : 'Your Organization Only' ,
value : 0 ,
2021-09-18 13:45:57 -07:00
} ,
] ,
} ,
{
displayName : 'Information' ,
name : 'information' ,
type : 'string' ,
default : '' ,
description : 'Information on the event - max 65535 characters' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Sharing Group Name or ID' ,
2021-09-18 13:45:57 -07:00
name : 'sharing_group_id' ,
type : 'options' ,
default : '' ,
2022-06-03 10:23:49 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
2022-08-17 08:50:24 -07:00
description :
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>. Use only for when <code>Sharing Group</code> is selected in <code>Distribution</code>.' ,
2021-09-18 13:45:57 -07:00
typeOptions : {
loadOptionsMethod : 'getSharingGroups' ,
} ,
} ,
{
displayName : 'Threat Level ID' ,
name : 'threat_level_id' ,
type : 'options' ,
default : 1 ,
options : [
{
name : 'High' ,
value : 1 ,
} ,
{
name : 'Medium' ,
value : 2 ,
} ,
{
name : 'Low' ,
value : 3 ,
} ,
{
name : 'Undefined' ,
value : 4 ,
} ,
] ,
} ,
] ,
} ,
] ;