2020-10-04 07:28:05 -07:00
import {
INodeProperties ,
} from 'n8n-workflow' ;
2021-12-03 00:44:16 -08:00
export const timeEntryOperations : INodeProperties [ ] = [
2020-10-04 07:28:05 -07:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2020-10-04 07:28:05 -07:00
displayOptions : {
show : {
resource : [
'timeEntry' ,
] ,
} ,
} ,
options : [
{
name : 'Create' ,
value : 'create' ,
description : 'Create a time entry' ,
2022-07-10 13:50:51 -07:00
action : 'Create a time entry' ,
2020-10-04 07:28:05 -07:00
} ,
{
name : 'Delete' ,
value : 'delete' ,
description : 'Delete a time entry' ,
2022-07-10 13:50:51 -07:00
action : 'Delete a time entry' ,
2020-10-04 07:28:05 -07:00
} ,
{
name : 'Get' ,
value : 'get' ,
description : 'Get time entrie' ,
2022-07-10 13:50:51 -07:00
action : 'Get a time entry' ,
2020-10-04 07:28:05 -07:00
} ,
{
name : 'Update' ,
value : 'update' ,
description : 'Update a time entry' ,
2022-07-10 13:50:51 -07:00
action : 'Update a time entry' ,
2020-10-04 07:28:05 -07:00
} ,
] ,
default : 'create' ,
} ,
2021-12-03 00:44:16 -08:00
] ;
2020-10-04 07:28:05 -07:00
2021-12-03 00:44:16 -08:00
export const timeEntryFields : INodeProperties [ ] = [
2020-10-04 07:28:05 -07:00
/* -------------------------------------------------------------------------- */
/* timeEntry:create */
/* -------------------------------------------------------------------------- */
{
displayName : 'Start' ,
name : 'start' ,
type : 'dateTime' ,
required : true ,
default : '' ,
displayOptions : {
show : {
resource : [
'timeEntry' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
operation : [
'create' ,
] ,
resource : [
'timeEntry' ,
] ,
} ,
} ,
default : { } ,
options : [
{
displayName : 'Billable' ,
name : 'billable' ,
type : 'boolean' ,
default : false ,
} ,
{
displayName : 'Custom Fields' ,
name : 'customFieldsUi' ,
placeholder : 'Add Custom Field' ,
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
} ,
2022-05-06 14:01:25 -07:00
description : 'Filter by custom fields' ,
2020-10-04 07:28:05 -07:00
default : { } ,
options : [
{
name : 'customFieldsValues' ,
displayName : 'Custom Field' ,
values : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Field Name or ID' ,
2020-10-04 07:28:05 -07:00
name : 'customFieldId' ,
type : 'options' ,
typeOptions : {
loadOptionsDependsOn : [
'workspaceId' ,
] ,
loadOptionsMethod : 'loadCustomFieldsForWorkspace' ,
} ,
default : '' ,
2022-06-03 10:23:49 -07:00
description : 'The ID of the field to add custom field to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.' ,
2020-10-04 07:28:05 -07:00
} ,
{
displayName : 'Value' ,
name : 'value' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The value to set on custom field' ,
2020-10-04 07:28:05 -07:00
} ,
] ,
} ,
] ,
} ,
{
displayName : 'Description' ,
name : 'description' ,
type : 'string' ,
typeOptions : {
alwaysOpenEditWindow : true ,
} ,
default : '' ,
} ,
{
displayName : 'End' ,
name : 'end' ,
type : 'dateTime' ,
default : '' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Project Name or ID' ,
2020-10-04 07:28:05 -07:00
name : 'projectId' ,
type : 'options' ,
2022-06-20 07:54:01 -07:00
description : 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>' ,
2020-10-04 07:28:05 -07:00
typeOptions : {
loadOptionsDependsOn : [
'workspaceId' ,
] ,
loadOptionsMethod : 'loadProjectsForWorkspace' ,
} ,
default : '' ,
} ,
{
2022-06-29 00:04:36 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-multi-options
2022-06-20 07:54:01 -07:00
displayName : 'Tag Names or IDs' ,
2020-10-04 07:28:05 -07:00
name : 'tagIds' ,
type : 'multiOptions' ,
2022-07-04 02:12:08 -07:00
description : 'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>' ,
2020-10-04 07:28:05 -07:00
typeOptions : {
loadOptionsDependsOn : [
'workspaceId' ,
] ,
loadOptionsMethod : 'loadTagsForWorkspace' ,
} ,
default : [ ] ,
} ,
{
displayName : 'Task ID' ,
name : 'taskId' ,
type : 'string' ,
default : '' ,
} ,
] ,
} ,
/* -------------------------------------------------------------------------- */
/* timeEntry:delete */
/* -------------------------------------------------------------------------- */
{
displayName : 'Time Entry ID' ,
name : 'timeEntryId' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
resource : [
'timeEntry' ,
] ,
operation : [
'delete' ,
] ,
} ,
} ,
} ,
/* -------------------------------------------------------------------------- */
/* timeEntry:get */
/* -------------------------------------------------------------------------- */
{
displayName : 'Time Entry ID' ,
name : 'timeEntryId' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
resource : [
'timeEntry' ,
] ,
operation : [
'get' ,
] ,
} ,
} ,
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
operation : [
'get' ,
] ,
resource : [
'timeEntry' ,
] ,
} ,
} ,
default : { } ,
options : [
{
displayName : 'Consider Duration Format' ,
name : 'consider-duration-format' ,
type : 'boolean' ,
default : false ,
2022-06-20 07:54:01 -07:00
description : 'Whether to return the time entry\'s duration rounded to minutes or seconds based on duration format (hh:mm or hh:mm:ss) from workspace settings' ,
2020-10-04 07:28:05 -07:00
} ,
{
displayName : 'Hydrated' ,
name : 'hydrated' ,
type : 'boolean' ,
default : false ,
2022-06-20 07:54:01 -07:00
description : 'Whether to return the time entry\'s project, task and tags in full and not just their IDs' ,
2020-10-04 07:28:05 -07:00
} ,
] ,
} ,
/* -------------------------------------------------------------------------- */
/* timeEntry:update */
/* -------------------------------------------------------------------------- */
{
displayName : 'Time Entry ID' ,
name : 'timeEntryId' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
resource : [
'timeEntry' ,
] ,
operation : [
'update' ,
] ,
} ,
} ,
} ,
{
displayName : 'Update Fields' ,
name : 'updateFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
operation : [
'update' ,
] ,
resource : [
'timeEntry' ,
] ,
} ,
} ,
default : { } ,
options : [
{
displayName : 'Billable' ,
name : 'billable' ,
type : 'boolean' ,
default : false ,
} ,
{
displayName : 'Custom Fields' ,
name : 'customFieldsUi' ,
placeholder : 'Add Custom Field' ,
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
} ,
2022-05-06 14:01:25 -07:00
description : 'Filter by custom fields' ,
2020-10-04 07:28:05 -07:00
default : { } ,
options : [
{
name : 'customFieldsValues' ,
displayName : 'Custom Field' ,
values : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Field Name or ID' ,
2020-10-04 07:28:05 -07:00
name : 'customFieldId' ,
type : 'options' ,
typeOptions : {
loadOptionsDependsOn : [
'workspaceId' ,
] ,
loadOptionsMethod : 'loadCustomFieldsForWorkspace' ,
} ,
default : '' ,
2022-06-03 10:23:49 -07:00
description : 'The ID of the field to add custom field to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.' ,
2020-10-04 07:28:05 -07:00
} ,
{
displayName : 'Value' ,
name : 'value' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The value to set on custom field' ,
2020-10-04 07:28:05 -07:00
} ,
] ,
} ,
] ,
} ,
{
displayName : 'Description' ,
name : 'description' ,
type : 'string' ,
typeOptions : {
alwaysOpenEditWindow : true ,
} ,
default : '' ,
} ,
{
displayName : 'End' ,
name : 'end' ,
type : 'dateTime' ,
default : '' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Project Name or ID' ,
2020-10-04 07:28:05 -07:00
name : 'projectId' ,
type : 'options' ,
2022-06-20 07:54:01 -07:00
description : 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>' ,
2020-10-04 07:28:05 -07:00
typeOptions : {
loadOptionsDependsOn : [
'workspaceId' ,
] ,
loadOptionsMethod : 'loadProjectsForWorkspace' ,
} ,
default : '' ,
} ,
{
displayName : 'Start' ,
name : 'start' ,
type : 'dateTime' ,
default : '' ,
} ,
{
2022-06-29 00:04:36 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-multi-options
2022-06-20 07:54:01 -07:00
displayName : 'Tag Names or IDs' ,
2020-10-04 07:28:05 -07:00
name : 'tagIds' ,
type : 'multiOptions' ,
2022-07-04 02:12:08 -07:00
description : 'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>' ,
2020-10-04 07:28:05 -07:00
typeOptions : {
loadOptionsDependsOn : [
'workspaceId' ,
] ,
loadOptionsMethod : 'loadTagsForWorkspace' ,
} ,
default : [ ] ,
} ,
{
displayName : 'Task ID' ,
name : 'taskId' ,
type : 'string' ,
default : '' ,
} ,
] ,
} ,
2021-12-03 00:44:16 -08:00
] ;