2022-08-17 08:50:24 -07:00
import { INodeProperties } from 'n8n-workflow' ;
2021-09-18 13:45:57 -07:00
export const attributeOperations : INodeProperties [ ] = [
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'attribute' ] ,
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 attribute' ,
2021-09-18 13:45:57 -07:00
} ,
{
name : 'Delete' ,
value : 'delete' ,
2022-07-10 13:50:51 -07:00
action : 'Delete an attribute' ,
2021-09-18 13:45:57 -07:00
} ,
{
name : 'Get' ,
value : 'get' ,
2022-07-10 13:50:51 -07:00
action : 'Get an attribute' ,
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-07-10 13:50:51 -07:00
action : 'Get all attributes' ,
2021-09-18 13:45:57 -07:00
} ,
{
name : 'Update' ,
value : 'update' ,
2022-07-10 13:50:51 -07:00
action : 'Update an attribute' ,
2021-09-18 13:45:57 -07:00
} ,
] ,
default : 'create' ,
} ,
] ;
export const attributeFields : INodeProperties [ ] = [
// ----------------------------------------
// attribute: create
// ----------------------------------------
{
displayName : 'Event UUID' ,
name : 'eventId' ,
description : 'UUID of the event to attach the attribute to' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'attribute' ] ,
operation : [ 'create' ] ,
2021-09-18 13:45:57 -07:00
} ,
} ,
} ,
{
displayName : 'Type' ,
name : 'type' ,
type : 'options' ,
options : [
{
name : 'Text' ,
value : 'text' ,
} ,
{
name : 'URL' ,
value : 'url' ,
} ,
{
name : 'Comment' ,
value : 'comment' ,
} ,
] ,
required : true ,
default : 'text' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'attribute' ] ,
operation : [ 'create' ] ,
2021-09-18 13:45:57 -07:00
} ,
} ,
} ,
2022-08-17 08:50:24 -07:00
{
2021-09-18 13:45:57 -07:00
displayName : 'Value' ,
name : 'value' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'attribute' ] ,
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 : [ 'attribute' ] ,
operation : [ 'create' ] ,
2021-09-18 13:45:57 -07:00
} ,
} ,
options : [
{
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' ,
} ,
} ,
] ,
} ,
// ----------------------------------------
// attribute: delete
// ----------------------------------------
{
displayName : 'Attribute ID' ,
name : 'attributeId' ,
description : 'UUID or numeric ID of the attribute' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'attribute' ] ,
operation : [ 'delete' ] ,
2021-09-18 13:45:57 -07:00
} ,
} ,
} ,
// ----------------------------------------
// attribute: get
// ----------------------------------------
{
displayName : 'Attribute ID' ,
name : 'attributeId' ,
description : 'UUID or numeric ID of the attribute' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'attribute' ] ,
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 : [ 'attribute' ] ,
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 : [ 'attribute' ] ,
operation : [ 'getAll' ] ,
returnAll : [ false ] ,
2021-09-18 13:45:57 -07:00
} ,
} ,
} ,
// ----------------------------------------
// attribute: update
// ----------------------------------------
{
displayName : 'Attribute ID' ,
name : 'attributeId' ,
description : 'ID of the attribute to update' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'attribute' ] ,
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 : [ 'attribute' ] ,
operation : [ 'update' ] ,
2021-09-18 13:45:57 -07:00
} ,
} ,
options : [
{
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-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' ,
} ,
} ,
] ,
} ,
] ;