2022-08-17 08:50:24 -07:00
import { INodeProperties } from 'n8n-workflow' ;
2021-04-30 14:00:28 -07:00
2021-12-03 00:44:16 -08:00
export const workItemOperations : INodeProperties [ ] = [
2021-04-30 14:00:28 -07:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2021-04-30 14:00:28 -07:00
default : 'get' ,
options : [
{
name : 'Create' ,
value : 'create' ,
2022-07-10 13:50:51 -07:00
action : 'Create a work item' ,
2021-04-30 14:00:28 -07:00
} ,
{
name : 'Get' ,
value : 'get' ,
2022-07-10 13:50:51 -07:00
action : 'Get a work item' ,
2021-04-30 14:00:28 -07:00
} ,
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2021-04-30 14:00:28 -07:00
value : 'getAll' ,
2022-09-08 08:10:13 -07:00
action : 'Get many work items' ,
2021-04-30 14:00:28 -07:00
} ,
{
name : 'Update' ,
value : 'update' ,
2022-07-10 13:50:51 -07:00
action : 'Update a work item' ,
2021-04-30 14:00:28 -07:00
} ,
] ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'workItem' ] ,
2021-04-30 14:00:28 -07:00
} ,
} ,
} ,
2021-12-03 00:44:16 -08:00
] ;
2021-04-30 14:00:28 -07:00
2021-12-03 00:44:16 -08:00
export const workItemFields : INodeProperties [ ] = [
2021-04-30 14:00:28 -07:00
// ----------------------------------
// workItem: create
// ----------------------------------
{
displayName : 'Title' ,
name : 'title' ,
type : 'string' ,
default : '' ,
required : true ,
2022-05-06 14:01:25 -07:00
description : 'Title of the work item to create' ,
2021-04-30 14:00:28 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'workItem' ] ,
operation : [ 'create' ] ,
2021-04-30 14:00:28 -07:00
} ,
} ,
} ,
2021-12-18 03:05:29 -08:00
{
2022-06-03 10:23:49 -07:00
displayName : 'Space Name or ID' ,
2021-12-18 03:05:29 -08:00
name : 'spaceId' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getSpaces' ,
} ,
default : [ ] ,
required : true ,
2022-08-17 08:50:24 -07:00
description :
'ID of the space to retrieve the work items from. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-12-18 03:05:29 -08:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'workItem' ] ,
operation : [ 'create' ] ,
2021-12-18 03:05:29 -08:00
} ,
} ,
} ,
2021-04-30 14:00:28 -07:00
{
2022-06-03 10:23:49 -07:00
displayName : 'Status Name or ID' ,
2021-04-30 14:00:28 -07:00
name : 'statusId' ,
type : 'options' ,
typeOptions : {
2021-12-18 03:05:29 -08:00
loadOptionsDependsOn : [ 'spaceId' ] ,
2021-04-30 14:00:28 -07:00
loadOptionsMethod : 'getStatuses' ,
} ,
default : [ ] ,
required : true ,
2022-08-17 08:50:24 -07:00
description :
'ID of the status to set on the item to create. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-04-30 14:00:28 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'workItem' ] ,
operation : [ 'create' ] ,
2021-04-30 14:00:28 -07:00
} ,
} ,
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'workItem' ] ,
operation : [ 'create' ] ,
2021-04-30 14:00:28 -07:00
} ,
} ,
options : [
{
displayName : 'Description' ,
name : 'description' ,
type : 'string' ,
default : '' ,
description : 'Description of the item to create. Markdown supported.' ,
} ,
{
displayName : 'Effort' ,
name : 'effort' ,
type : 'options' ,
default : 'SMALL' ,
2022-05-06 14:01:25 -07:00
description : 'Effort to set for the item to create' ,
2021-04-30 14:00:28 -07:00
options : [
{
name : 'Small' ,
value : 'SMALL' ,
} ,
{
name : 'Medium' ,
value : 'MEDIUM' ,
} ,
{
name : 'Large' ,
value : 'LARGE' ,
} ,
] ,
} ,
{
displayName : 'Impact' ,
name : 'impact' ,
type : 'options' ,
default : 'SMALL' ,
2022-05-06 14:01:25 -07:00
description : 'Impact to set for the item to create' ,
2021-04-30 14:00:28 -07:00
options : [
{
name : 'Small' ,
value : 'SMALL' ,
} ,
{
name : 'Medium' ,
value : 'MEDIUM' ,
} ,
{
name : 'Large' ,
value : 'LARGE' ,
} ,
] ,
} ,
{
2022-06-20 07:54:01 -07:00
displayName : 'Label Names or IDs' ,
2021-04-30 14:00:28 -07:00
name : 'labelIds' ,
type : 'multiOptions' ,
typeOptions : {
loadOptionsMethod : 'getLabels' ,
} ,
default : [ ] ,
2022-08-17 08:50:24 -07:00
description :
'ID of the label to set on the item to create. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-04-30 14:00:28 -07:00
} ,
{
2022-06-20 07:54:01 -07:00
displayName : 'Member Names or IDs' ,
2021-04-30 14:00:28 -07:00
name : 'memberIds' ,
type : 'multiOptions' ,
typeOptions : {
loadOptionsMethod : 'getUsers' ,
} ,
default : [ ] ,
2022-08-17 08:50:24 -07:00
description :
'ID of the user to assign to the item to create. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-04-30 14:00:28 -07:00
} ,
] ,
} ,
// ----------------------------------
// workItem: get
// ----------------------------------
{
displayName : 'Work Item ID' ,
name : 'workItemId' ,
type : 'string' ,
default : '' ,
required : true ,
2022-05-06 14:01:25 -07:00
description : 'ID of the work item to retrieve' ,
2021-04-30 14:00:28 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'workItem' ] ,
operation : [ 'get' ] ,
2021-04-30 14:00:28 -07:00
} ,
} ,
} ,
// ----------------------------------
// workItem: getAll
// ----------------------------------
{
2022-06-03 10:23:49 -07:00
displayName : 'Space Name or ID' ,
2021-04-30 14:00:28 -07:00
name : 'spaceId' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getSpaces' ,
} ,
default : [ ] ,
required : true ,
2022-08-17 08:50:24 -07:00
description :
'ID of the space to retrieve the work items from. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-04-30 14:00:28 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'workItem' ] ,
operation : [ 'getAll' ] ,
2021-04-30 14:00:28 -07:00
} ,
} ,
} ,
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Whether to return all results or only up to a given limit' ,
2021-04-30 14:00:28 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'workItem' ] ,
operation : [ 'getAll' ] ,
2021-04-30 14:00:28 -07:00
} ,
} ,
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
default : 5 ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2021-04-30 14:00:28 -07:00
typeOptions : {
minValue : 1 ,
maxValue : 1000 ,
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'workItem' ] ,
operation : [ 'getAll' ] ,
returnAll : [ false ] ,
2021-04-30 14:00:28 -07:00
} ,
} ,
} ,
// ----------------------------------
// workItem: update
// ----------------------------------
{
displayName : 'Work Item ID' ,
name : 'workItemId' ,
type : 'string' ,
default : '' ,
required : true ,
2022-05-06 14:01:25 -07:00
description : 'ID of the work item to update' ,
2021-04-30 14:00:28 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'workItem' ] ,
operation : [ 'update' ] ,
2021-04-30 14:00:28 -07:00
} ,
} ,
} ,
{
displayName : 'Update Fields' ,
name : 'updateFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'workItem' ] ,
operation : [ 'update' ] ,
2021-04-30 14:00:28 -07:00
} ,
} ,
options : [
{
displayName : 'Description' ,
name : 'description' ,
type : 'string' ,
default : '' ,
description : 'Description of the item to update. Markdown supported.' ,
} ,
{
displayName : 'Effort' ,
name : 'effort' ,
type : 'options' ,
default : 'SMALL' ,
2022-05-06 14:01:25 -07:00
description : 'Effort to set for the item to update' ,
2021-04-30 14:00:28 -07:00
options : [
{
name : 'Small' ,
value : 'SMALL' ,
} ,
{
name : 'Medium' ,
value : 'MEDIUM' ,
} ,
{
name : 'Large' ,
value : 'LARGE' ,
} ,
] ,
} ,
{
displayName : 'Impact' ,
name : 'impact' ,
type : 'options' ,
default : 'SMALL' ,
2022-05-06 14:01:25 -07:00
description : 'Impact to set for the item to update' ,
2021-04-30 14:00:28 -07:00
options : [
{
name : 'Small' ,
value : 'SMALL' ,
} ,
{
name : 'Medium' ,
value : 'MEDIUM' ,
} ,
{
name : 'Large' ,
value : 'LARGE' ,
} ,
] ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Status Name or ID' ,
2021-04-30 14:00:28 -07:00
name : 'statusId' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getStatuses' ,
} ,
default : [ ] ,
2022-08-17 08:50:24 -07:00
description :
'ID of the status to set on the item to update. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-04-30 14:00:28 -07:00
} ,
{
displayName : 'Title' ,
name : 'title' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Title to set for the work item to update' ,
2021-04-30 14:00:28 -07:00
} ,
] ,
} ,
2021-12-03 00:44:16 -08:00
] ;