2023-01-27 03:22:44 -08:00
|
|
|
import type { INodeProperties } from 'n8n-workflow';
|
2020-01-24 04:28:05 -08:00
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const labelOperations: INodeProperties[] = [
|
2020-01-24 04:28:05 -08:00
|
|
|
// ----------------------------------
|
|
|
|
// label
|
|
|
|
// ----------------------------------
|
|
|
|
{
|
|
|
|
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: ['label'],
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Add to Card',
|
|
|
|
value: 'addLabel',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Add a label to a card',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Add a label to a card',
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Create',
|
|
|
|
value: 'create',
|
|
|
|
description: 'Create a new label',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Create a label',
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Delete',
|
|
|
|
value: 'delete',
|
|
|
|
description: 'Delete a label',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Delete a label',
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Get',
|
|
|
|
value: 'get',
|
|
|
|
description: 'Get the data of a label',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Get a label',
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
{
|
2022-09-07 07:51:14 -07:00
|
|
|
name: 'Get Many',
|
2020-01-24 04:28:05 -08:00
|
|
|
value: 'getAll',
|
2022-09-13 03:36:36 -07:00
|
|
|
description: 'Returns many labels for the board',
|
2022-09-08 08:10:13 -07:00
|
|
|
action: 'Get many labels',
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Remove From Card',
|
|
|
|
value: 'removeLabel',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Remove a label from a card',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Remove a label from a card',
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Update',
|
|
|
|
value: 'update',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Update a label',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Update a label',
|
2020-10-22 06:46:03 -07:00
|
|
|
},
|
2020-01-24 04:28:05 -08:00
|
|
|
],
|
|
|
|
default: 'getAll',
|
|
|
|
},
|
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 labelFields: INodeProperties[] = [
|
2020-01-24 04:28:05 -08:00
|
|
|
{
|
2022-09-21 06:44:45 -07:00
|
|
|
displayName: 'Board',
|
2020-01-24 04:28:05 -08:00
|
|
|
name: 'boardId',
|
2022-09-21 06:44:45 -07:00
|
|
|
type: 'resourceLocator',
|
|
|
|
default: { mode: 'list', value: '' },
|
2020-01-24 04:28:05 -08:00
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-09-21 06:44:45 -07:00
|
|
|
operation: ['create', 'getAll'],
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['label'],
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
},
|
2022-09-21 06:44:45 -07:00
|
|
|
description: 'The ID of the board',
|
|
|
|
modes: [
|
|
|
|
{
|
|
|
|
displayName: 'From List',
|
|
|
|
name: 'list',
|
|
|
|
type: 'list',
|
|
|
|
placeholder: 'Select a Board...',
|
|
|
|
initType: 'board',
|
|
|
|
typeOptions: {
|
|
|
|
searchListMethod: 'searchBoards',
|
|
|
|
searchFilterRequired: true,
|
|
|
|
searchable: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'By URL',
|
|
|
|
name: 'url',
|
|
|
|
type: 'string',
|
|
|
|
placeholder: 'https://trello.com/b/e123456/board-name',
|
|
|
|
validation: [
|
|
|
|
{
|
|
|
|
type: 'regex',
|
|
|
|
properties: {
|
|
|
|
regex: 'http(s)?://trello.com/b/([a-zA-Z0-9]{2,})/.*',
|
|
|
|
errorMessage: 'Not a valid Trello Board URL',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
extractValue: {
|
|
|
|
type: 'regex',
|
|
|
|
regex: 'https://trello.com/b/([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 Board ID',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
placeholder: 'KdEAAdde',
|
|
|
|
url: '=https://trello.com/b/{{$value}}',
|
|
|
|
},
|
|
|
|
],
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
2022-09-21 06:44:45 -07:00
|
|
|
|
|
|
|
// ----------------------------------
|
|
|
|
// label:create
|
|
|
|
// ----------------------------------
|
2020-01-24 04:28:05 -08:00
|
|
|
{
|
|
|
|
displayName: 'Name',
|
|
|
|
name: 'name',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
operation: ['create'],
|
|
|
|
resource: ['label'],
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
},
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Name for the label',
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Color',
|
|
|
|
name: 'color',
|
|
|
|
type: 'options',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
operation: ['create'],
|
|
|
|
resource: ['label'],
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Black',
|
2020-01-24 04:28:05 -08:00
|
|
|
value: 'black',
|
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Blue',
|
2020-01-24 04:28:05 -08:00
|
|
|
value: 'blue',
|
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Green',
|
2020-10-22 06:46:03 -07:00
|
|
|
value: 'green',
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Lime',
|
2020-01-24 04:28:05 -08:00
|
|
|
value: 'lime',
|
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Null',
|
2020-01-24 04:28:05 -08:00
|
|
|
value: 'null',
|
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Orange',
|
|
|
|
value: 'orange',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Pink',
|
2020-01-24 04:28:05 -08:00
|
|
|
value: 'pink',
|
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Purple',
|
2020-01-24 04:28:05 -08:00
|
|
|
value: 'purple',
|
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Red',
|
2020-01-24 04:28:05 -08:00
|
|
|
value: 'red',
|
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Sky',
|
2020-01-24 04:28:05 -08:00
|
|
|
value: 'sky',
|
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Yellow',
|
2020-10-22 06:46:03 -07:00
|
|
|
value: 'yellow',
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
default: 'null',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'The color for the label',
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
|
|
|
|
// ----------------------------------
|
|
|
|
// label:delete
|
|
|
|
// ----------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Label ID',
|
|
|
|
name: 'id',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
operation: ['delete'],
|
|
|
|
resource: ['label'],
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
},
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'The ID of the label to delete',
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
|
|
|
|
// ----------------------------------
|
|
|
|
// label:getAll
|
|
|
|
// ----------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Additional Fields',
|
|
|
|
name: 'additionalFields',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
operation: ['getAll'],
|
|
|
|
resource: ['label'],
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: {},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Fields',
|
|
|
|
name: 'fields',
|
|
|
|
type: 'string',
|
|
|
|
default: 'all',
|
|
|
|
description: 'Fields to return. Either "all" or a comma-separated list of fields.',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
|
|
|
|
// ----------------------------------
|
|
|
|
// label:get
|
|
|
|
// ----------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Label ID',
|
|
|
|
name: 'id',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
operation: ['get'],
|
|
|
|
resource: ['label'],
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
},
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Get information about a label by ID',
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Additional Fields',
|
|
|
|
name: 'additionalFields',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
operation: ['get'],
|
|
|
|
resource: ['label'],
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: {},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Fields',
|
|
|
|
name: 'fields',
|
|
|
|
type: 'string',
|
|
|
|
default: 'all',
|
|
|
|
description: 'Fields to return. Either "all" or a comma-separated list of fields.',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
displayName: 'Card ID',
|
|
|
|
name: 'cardId',
|
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: 'Choose...',
|
|
|
|
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: ['addLabel', 'removeLabel'],
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['label'],
|
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
|
|
|
},
|
2022-09-21 06:44:45 -07:00
|
|
|
|
|
|
|
// ----------------------------------
|
|
|
|
// label:addLabel
|
|
|
|
// ----------------------------------
|
2020-01-24 04:28:05 -08:00
|
|
|
{
|
|
|
|
displayName: 'Label ID',
|
|
|
|
name: 'id',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
operation: ['addLabel'],
|
|
|
|
resource: ['label'],
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
},
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'The ID of the label to add',
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
|
|
|
|
// ----------------------------------
|
|
|
|
// label:removeLabel
|
|
|
|
// ----------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Label ID',
|
|
|
|
name: 'id',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
operation: ['removeLabel'],
|
|
|
|
resource: ['label'],
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
},
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'The ID of the label to remove',
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
|
|
|
|
// ----------------------------------
|
|
|
|
// label:update
|
|
|
|
// ----------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Label ID',
|
|
|
|
name: 'id',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
operation: ['update'],
|
|
|
|
resource: ['label'],
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
},
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'The ID of the label to update',
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Update Fields',
|
|
|
|
name: 'updateFields',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
operation: ['update'],
|
|
|
|
resource: ['label'],
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: {},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Name',
|
|
|
|
name: 'name',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Name of the label',
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Color',
|
|
|
|
name: 'color',
|
|
|
|
type: 'options',
|
|
|
|
options: [
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Black',
|
2020-01-24 04:28:05 -08:00
|
|
|
value: 'black',
|
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Blue',
|
2020-01-24 04:28:05 -08:00
|
|
|
value: 'blue',
|
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Green',
|
2020-10-22 06:46:03 -07:00
|
|
|
value: 'green',
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Lime',
|
2020-01-24 04:28:05 -08:00
|
|
|
value: 'lime',
|
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Null',
|
2020-01-24 04:28:05 -08:00
|
|
|
value: 'null',
|
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Orange',
|
|
|
|
value: 'orange',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Pink',
|
2020-01-24 04:28:05 -08:00
|
|
|
value: 'pink',
|
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Purple',
|
2020-01-24 04:28:05 -08:00
|
|
|
value: 'purple',
|
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Red',
|
2020-01-24 04:28:05 -08:00
|
|
|
value: 'red',
|
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Sky',
|
2020-01-24 04:28:05 -08:00
|
|
|
value: 'sky',
|
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Yellow',
|
2020-10-22 06:46:03 -07:00
|
|
|
value: 'yellow',
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
default: 'null',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'The color for the label',
|
2020-01-24 04:28:05 -08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|