mirror of
https://github.com/go-vikunja/n8n-vikunja-nodes
synced 2024-06-02 18:59:42 +00:00
feat: add label CRUD
This commit is contained in:
parent
31458e205c
commit
92c48ae4f7
|
@ -52,6 +52,10 @@ export class Vikunja implements INodeType {
|
|||
name: 'Project',
|
||||
value: 'project',
|
||||
},
|
||||
{
|
||||
name: 'Label',
|
||||
value: 'label',
|
||||
},
|
||||
],
|
||||
default: 'task',
|
||||
},
|
||||
|
|
|
@ -1,6 +1,81 @@
|
|||
import {INodeProperties} from 'n8n-workflow'
|
||||
|
||||
export const labelProperties: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['label'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a label',
|
||||
action: 'Create a label',
|
||||
routing: {
|
||||
request: {
|
||||
method: 'PUT',
|
||||
url: '=/labels',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a label',
|
||||
action: 'Delete a label',
|
||||
routing: {
|
||||
request: {
|
||||
method: 'DELETE',
|
||||
url: '=/labels/{{$parameter.label}}',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get a label',
|
||||
action: 'Get a label',
|
||||
routing: {
|
||||
request: {
|
||||
method: 'GET',
|
||||
url: '=/labels/{{$parameter.label}}',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Get many labels',
|
||||
action: 'Get many labels',
|
||||
routing: {
|
||||
request: {
|
||||
method: 'GET',
|
||||
url: '=/labels',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update a label',
|
||||
action: 'Update a label',
|
||||
routing: {
|
||||
request: {
|
||||
method: 'POST',
|
||||
url: '=/labels/{{$parameter.label}}',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
{
|
||||
displayName: 'Label Title or ID',
|
||||
name: 'label',
|
||||
|
@ -25,6 +100,44 @@ export const labelProperties: INodeProperties[] = [
|
|||
placeholder: '1567890',
|
||||
},
|
||||
],
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['label'],
|
||||
operation: ['get', 'update', 'delete'],
|
||||
},
|
||||
},
|
||||
routing: {
|
||||
send: {
|
||||
type: 'body',
|
||||
property: 'label_id',
|
||||
},
|
||||
},
|
||||
description: 'The label you want to operate on. Choose from the list, or specify an ID.',
|
||||
},
|
||||
{
|
||||
displayName: 'Label Title or ID',
|
||||
name: 'taskLabel',
|
||||
type: 'resourceLocator',
|
||||
default: {mode: 'id', value: ''},
|
||||
required: true,
|
||||
modes: [
|
||||
{
|
||||
displayName: 'From List',
|
||||
name: 'list',
|
||||
type: 'list',
|
||||
placeholder: 'Select a label…',
|
||||
typeOptions: {
|
||||
searchListMethod: 'searchLabels',
|
||||
searchable: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'ID',
|
||||
name: 'id',
|
||||
type: 'string',
|
||||
placeholder: '1567890',
|
||||
},
|
||||
],
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['task'],
|
||||
|
@ -39,4 +152,63 @@ export const labelProperties: INodeProperties[] = [
|
|||
},
|
||||
description: 'The label you want to operate on. Choose from the list, or specify an ID.',
|
||||
},
|
||||
{
|
||||
displayName: 'Label Title',
|
||||
name: 'labelTitle',
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['label'],
|
||||
operation: ['create', 'update'],
|
||||
},
|
||||
},
|
||||
routing: {
|
||||
send: {
|
||||
type: 'body',
|
||||
property: 'title',
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'A description for the label',
|
||||
typeOptions: {
|
||||
rows: 4,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['label'],
|
||||
operation: ['create', 'update'],
|
||||
},
|
||||
},
|
||||
routing: {
|
||||
send: {
|
||||
type: 'body',
|
||||
property: 'description',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Label Color',
|
||||
name: 'hexColor',
|
||||
type: 'color',
|
||||
default: '#000000',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['label'],
|
||||
operation: ['create', 'update'],
|
||||
},
|
||||
},
|
||||
routing: {
|
||||
send: {
|
||||
type: 'body',
|
||||
property: 'hex_color',
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
|
|
|
@ -68,7 +68,7 @@ export const projectProperties: INodeProperties[] = [
|
|||
action: 'Update a project',
|
||||
routing: {
|
||||
request: {
|
||||
method: 'GET',
|
||||
method: 'POST',
|
||||
url: '=/projects/{{$parameter.project}}',
|
||||
},
|
||||
},
|
||||
|
@ -392,7 +392,7 @@ export const projectProperties: INodeProperties[] = [
|
|||
displayName: 'Project Color',
|
||||
name: 'hexColor',
|
||||
type: 'color',
|
||||
default: 'hex_color',
|
||||
default: '#000000',
|
||||
routing: {
|
||||
send: {
|
||||
type: 'body',
|
||||
|
|
|
@ -174,7 +174,7 @@ export const taskProperties: INodeProperties[] = [
|
|||
routing: {
|
||||
request: {
|
||||
method: 'DELETE',
|
||||
url: '=/tasks/{{$parameter.taskId}}/labels/{{$parameter.label}}',
|
||||
url: '=/tasks/{{$parameter.taskId}}/labels/{{$parameter.taskLabel}}',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -369,7 +369,7 @@ export const taskProperties: INodeProperties[] = [
|
|||
displayName: 'Task Color',
|
||||
name: 'hexColor',
|
||||
type: 'color',
|
||||
default: 'hex_color',
|
||||
default: '#000000',
|
||||
routing: {
|
||||
send: {
|
||||
type: 'body',
|
||||
|
|
Loading…
Reference in New Issue
Block a user