2022-08-17 08:50:24 -07:00
import { INodeProperties } from 'n8n-workflow' ;
2020-01-24 04:28:05 -08:00
2021-12-03 00:44:16 -08:00
export const cardOperations : INodeProperties [ ] = [
2020-01-24 04:28:05 -08:00
// ----------------------------------
// card
// ----------------------------------
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2020-01-24 04:28:05 -08:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'card' ] ,
2020-01-24 04:28:05 -08:00
} ,
} ,
options : [
{
name : 'Create' ,
value : 'create' ,
description : 'Create a new card' ,
2022-07-10 13:50:51 -07:00
action : 'Create a card' ,
2020-01-24 04:28:05 -08:00
} ,
{
name : 'Delete' ,
value : 'delete' ,
description : 'Delete a card' ,
2022-07-10 13:50:51 -07:00
action : 'Delete a card' ,
2020-01-24 04:28:05 -08:00
} ,
{
name : 'Get' ,
value : 'get' ,
description : 'Get the data of a card' ,
2022-07-10 13:50:51 -07:00
action : 'Get a card' ,
2020-01-24 04:28:05 -08:00
} ,
{
name : 'Update' ,
value : 'update' ,
description : 'Update a card' ,
2022-07-10 13:50:51 -07:00
action : 'Update a card' ,
2020-01-24 04:28:05 -08:00
} ,
] ,
default : 'create' ,
} ,
2021-12-03 00:44:16 -08:00
] ;
2020-01-24 04:28:05 -08:00
2021-12-03 00:44:16 -08:00
export const cardFields : INodeProperties [ ] = [
2020-01-24 04:28:05 -08:00
// ----------------------------------
// card:create
// ----------------------------------
{
displayName : 'List ID' ,
name : 'listId' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'create' ] ,
resource : [ 'card' ] ,
2020-01-24 04:28:05 -08:00
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'The ID of the list to create card in' ,
2020-01-24 04:28:05 -08:00
} ,
{
displayName : 'Name' ,
name : 'name' ,
type : 'string' ,
default : '' ,
placeholder : 'My card' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'create' ] ,
resource : [ 'card' ] ,
2020-01-24 04:28:05 -08:00
} ,
} ,
description : 'The name of the card' ,
} ,
{
displayName : 'Description' ,
name : 'description' ,
type : 'string' ,
default : '' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'create' ] ,
resource : [ 'card' ] ,
2020-01-24 04:28:05 -08:00
} ,
} ,
description : 'The description of the card' ,
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'create' ] ,
resource : [ 'card' ] ,
2020-01-24 04:28:05 -08:00
} ,
} ,
default : { } ,
options : [
{
displayName : 'Due Date' ,
name : 'due' ,
type : 'dateTime' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'A due date for the card' ,
2020-01-24 04:28:05 -08:00
} ,
{
displayName : 'Due Complete' ,
name : 'dueComplete' ,
type : 'boolean' ,
default : false ,
2022-06-20 07:54:01 -07:00
description : 'Whether the card is completed' ,
2020-01-24 04:28:05 -08:00
} ,
{
displayName : 'Position' ,
name : 'pos' ,
type : 'string' ,
default : 'bottom' ,
description : 'The position of the new card. top, bottom, or a positive float.' ,
} ,
{
displayName : 'Member IDs' ,
name : 'idMembers' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Comma-separated list of member IDs to add to the card' ,
2020-01-24 04:28:05 -08:00
} ,
{
displayName : 'Label IDs' ,
name : 'idLabels' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Comma-separated list of label IDs to add to the card' ,
2020-01-24 04:28:05 -08:00
} ,
{
displayName : 'URL Source' ,
name : 'urlSource' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'A source URL to attach to card' ,
2020-01-24 04:28:05 -08:00
} ,
{
displayName : 'Source ID' ,
name : 'idCardSource' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The ID of a card to copy into the new card' ,
2020-01-24 04:28:05 -08:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Keep From Source' ,
2020-01-24 04:28:05 -08:00
name : 'keepFromSource' ,
type : 'string' ,
default : 'all' ,
2022-08-17 08:50:24 -07:00
description :
'If using idCardSource you can specify which properties to copy over. all or comma-separated list of: attachments, checklists, comments, due, labels, members, stickers.' ,
2020-01-24 04:28:05 -08:00
} ,
] ,
} ,
{
2022-09-21 06:44:45 -07:00
displayName : 'Card' ,
2020-01-24 04:28:05 -08:00
name : 'id' ,
2022-09-21 06:44:45 -07:00
type : 'resourceLocator' ,
default : { mode : 'list' , value : '' } ,
2020-01-24 04:28:05 -08:00
required : true ,
2022-09-21 06:44:45 -07:00
modes : [
{
displayName : 'From List' ,
name : 'list' ,
type : 'list' ,
placeholder : 'Select a Card...' ,
typeOptions : {
searchListMethod : 'searchCards' ,
searchFilterRequired : true ,
searchable : true ,
} ,
} ,
{
displayName : 'By URL' ,
name : 'url' ,
type : 'string' ,
placeholder : 'https://trello.com/c/e123456/card-name' ,
validation : [
{
type : 'regex' ,
properties : {
regex : 'http(s)?://trello.com/c/([a-zA-Z0-9]{2,})/.*' ,
errorMessage : 'Not a valid Trello Card URL' ,
} ,
} ,
] ,
extractValue : {
type : 'regex' ,
regex : 'https://trello.com/c/([a-zA-Z0-9]{2,})' ,
} ,
} ,
{
displayName : 'ID' ,
name : 'id' ,
type : 'string' ,
validation : [
{
type : 'regex' ,
properties : {
regex : '[a-zA-Z0-9]{2,}' ,
errorMessage : 'Not a valid Trello Card ID' ,
} ,
} ,
] ,
placeholder : 'wiIaGwqE' ,
url : '=https://trello.com/c/{{$value}}' ,
} ,
] ,
2020-01-24 04:28:05 -08:00
displayOptions : {
show : {
2022-09-21 06:44:45 -07:00
operation : [ 'get' , 'delete' , 'update' ] ,
2022-08-17 08:50:24 -07:00
resource : [ 'card' ] ,
2020-01-24 04:28:05 -08:00
} ,
} ,
2022-09-21 06:44:45 -07:00
description : 'The ID of the card' ,
2020-01-24 04:28:05 -08:00
} ,
// ----------------------------------
// card:get
// ----------------------------------
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'get' ] ,
resource : [ 'card' ] ,
2020-01-24 04:28:05 -08:00
} ,
} ,
default : { } ,
options : [
{
displayName : 'Fields' ,
name : 'fields' ,
type : 'string' ,
default : 'all' ,
2022-06-03 10:23:49 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-description-miscased-url
2022-08-17 08:50:24 -07:00
description :
'Fields to return. Either "all" or a comma-separated list: badges, checkItemStates, closed, dateLastActivity, desc, descData, due, email, idBoard, idChecklists, idLabels, idList, idMembers, idShort, idAttachmentCover, manualCoverAttachment, labels, name, pos, shortUrl, url.' ,
2020-01-24 04:28:05 -08:00
} ,
{
displayName : 'Board' ,
name : 'board' ,
type : 'boolean' ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Whether to return the board object the card is on' ,
2020-01-24 04:28:05 -08:00
} ,
{
displayName : 'Board Fields' ,
name : 'board_fields' ,
type : 'string' ,
default : 'all' ,
2022-06-03 10:23:49 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-description-miscased-url
2022-08-17 08:50:24 -07:00
description :
'Fields to return. Either "all" or a comma-separated list: name, desc, descData, closed, idOrganization, pinned, url, prefs.' ,
2020-01-24 04:28:05 -08:00
} ,
{
displayName : 'Custom Field Items' ,
name : 'customFieldItems' ,
type : 'boolean' ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Whether to include the customFieldItems' ,
2020-01-24 04:28:05 -08:00
} ,
{
displayName : 'Members' ,
name : 'members' ,
type : 'boolean' ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Whether to return member objects for members on the card' ,
2020-01-24 04:28:05 -08:00
} ,
{
displayName : 'Member Fields' ,
name : 'member_fields' ,
type : 'string' ,
default : 'all' ,
2022-08-17 08:50:24 -07:00
description :
'Fields to return. Either "all" or a comma-separated list: avatarHash, fullName, initials, username.' ,
2020-01-24 04:28:05 -08:00
} ,
{
displayName : 'Plugin Data' ,
name : 'pluginData' ,
type : 'boolean' ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Whether to include pluginData on the card with the response' ,
2020-01-24 04:28:05 -08:00
} ,
{
displayName : 'Stickers' ,
name : 'stickers' ,
type : 'boolean' ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Whether to include sticker models with the response' ,
2020-01-24 04:28:05 -08:00
} ,
{
displayName : 'Sticker Fields' ,
name : 'sticker_fields' ,
type : 'string' ,
default : 'all' ,
description : 'Fields to return. Either "all" or a comma-separated list of sticker fields.' ,
} ,
] ,
} ,
// ----------------------------------
// card:update
// ----------------------------------
{
displayName : 'Update Fields' ,
name : 'updateFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'update' ] ,
resource : [ 'card' ] ,
2020-01-24 04:28:05 -08:00
} ,
} ,
default : { } ,
options : [
{
displayName : 'Attachment Cover' ,
name : 'idAttachmentCover' ,
type : 'string' ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'The ID of the image attachment the card should use as its cover, or null for none' ,
2020-01-24 04:28:05 -08:00
} ,
{
displayName : 'Board ID' ,
name : 'idBoard' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The ID of the board the card should be on' ,
2020-01-24 04:28:05 -08:00
} ,
{
displayName : 'Closed' ,
name : 'closed' ,
type : 'boolean' ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Whether the board is closed' ,
2020-01-24 04:28:05 -08:00
} ,
{
displayName : 'Description' ,
name : 'desc' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'New description of the board' ,
2020-01-24 04:28:05 -08:00
} ,
{
displayName : 'Due Date' ,
name : 'due' ,
type : 'dateTime' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'A due date for the card' ,
2020-01-24 04:28:05 -08:00
} ,
{
displayName : 'Due Complete' ,
name : 'dueComplete' ,
type : 'boolean' ,
default : false ,
2022-06-20 07:54:01 -07:00
description : 'Whether the card is completed' ,
2020-01-24 04:28:05 -08:00
} ,
{
displayName : 'Label IDs' ,
name : 'idLabels' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Comma-separated list of label IDs to set on card' ,
2020-01-24 04:28:05 -08:00
} ,
{
displayName : 'List ID' ,
name : 'idList' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The ID of the list the card should be in' ,
2020-01-24 04:28:05 -08:00
} ,
{
displayName : 'Member IDs' ,
name : 'idMembers' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Comma-separated list of member IDs to set on card' ,
2020-01-24 04:28:05 -08:00
} ,
{
displayName : 'Name' ,
name : 'name' ,
type : 'string' ,
default : '' ,
description : 'New name of the board' ,
} ,
{
displayName : 'Position' ,
name : 'pos' ,
type : 'string' ,
default : 'bottom' ,
description : 'The position of the card. top, bottom, or a positive float.' ,
} ,
{
displayName : 'Subscribed' ,
name : 'subscribed' ,
type : 'boolean' ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Whether the acting user is subscribed to the board' ,
2020-01-24 04:28:05 -08:00
} ,
] ,
} ,
2021-12-03 00:44:16 -08:00
] ;