2023-01-27 03:22:44 -08:00
import type { INodeProperties } from 'n8n-workflow' ;
2020-10-04 07:28:05 -07:00
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 : {
2022-08-01 13:47:55 -07:00
resource : [ 'timeEntry' ] ,
2020-10-04 07:28:05 -07:00
} ,
} ,
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 : {
2022-08-01 13:47:55 -07:00
resource : [ 'timeEntry' ] ,
operation : [ 'create' ] ,
2020-10-04 07:28:05 -07:00
} ,
} ,
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
operation : [ 'create' ] ,
resource : [ 'timeEntry' ] ,
2020-10-04 07:28:05 -07:00
} ,
} ,
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 : {
2022-08-01 13:47:55 -07:00
loadOptionsDependsOn : [ 'workspaceId' ] ,
2020-10-04 07:28:05 -07:00
loadOptionsMethod : 'loadCustomFieldsForWorkspace' ,
} ,
default : '' ,
2022-08-01 13:47:55 -07:00
description :
2024-09-12 07:53:36 -07:00
'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/code/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' ,
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-08-01 13:47:55 -07:00
description :
2024-09-12 07:53:36 -07:00
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>' ,
2020-10-04 07:28:05 -07:00
typeOptions : {
2022-08-01 13:47:55 -07:00
loadOptionsDependsOn : [ 'workspaceId' ] ,
2020-10-04 07:28:05 -07:00
loadOptionsMethod : 'loadProjectsForWorkspace' ,
} ,
default : '' ,
} ,
{
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-08-01 13:47:55 -07:00
description :
2024-09-12 07:53:36 -07:00
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>' ,
2020-10-04 07:28:05 -07:00
typeOptions : {
2022-08-01 13:47:55 -07:00
loadOptionsDependsOn : [ 'workspaceId' ] ,
2020-10-04 07:28:05 -07:00
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 : {
2022-08-01 13:47:55 -07:00
resource : [ 'timeEntry' ] ,
operation : [ 'delete' ] ,
2020-10-04 07:28:05 -07:00
} ,
} ,
} ,
/* -------------------------------------------------------------------------- */
/* timeEntry:get */
/* -------------------------------------------------------------------------- */
{
displayName : 'Time Entry ID' ,
name : 'timeEntryId' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'timeEntry' ] ,
operation : [ 'get' ] ,
2020-10-04 07:28:05 -07:00
} ,
} ,
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
operation : [ 'get' ] ,
resource : [ 'timeEntry' ] ,
2020-10-04 07:28:05 -07:00
} ,
} ,
default : { } ,
options : [
{
displayName : 'Consider Duration Format' ,
name : 'consider-duration-format' ,
type : 'boolean' ,
default : false ,
2022-08-01 13:47:55 -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-08-01 13:47:55 -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 : {
2022-08-01 13:47:55 -07:00
resource : [ 'timeEntry' ] ,
operation : [ 'update' ] ,
2020-10-04 07:28:05 -07:00
} ,
} ,
} ,
{
displayName : 'Update Fields' ,
name : 'updateFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
operation : [ 'update' ] ,
resource : [ 'timeEntry' ] ,
2020-10-04 07:28:05 -07:00
} ,
} ,
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 : {
2022-08-01 13:47:55 -07:00
loadOptionsDependsOn : [ 'workspaceId' ] ,
2020-10-04 07:28:05 -07:00
loadOptionsMethod : 'loadCustomFieldsForWorkspace' ,
} ,
default : '' ,
2022-08-01 13:47:55 -07:00
description :
2024-09-12 07:53:36 -07:00
'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/code/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' ,
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-08-01 13:47:55 -07:00
description :
2024-09-12 07:53:36 -07:00
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>' ,
2020-10-04 07:28:05 -07:00
typeOptions : {
2022-08-01 13:47:55 -07:00
loadOptionsDependsOn : [ 'workspaceId' ] ,
2020-10-04 07:28:05 -07:00
loadOptionsMethod : 'loadProjectsForWorkspace' ,
} ,
default : '' ,
} ,
{
displayName : 'Start' ,
name : 'start' ,
type : 'dateTime' ,
default : '' ,
} ,
{
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-08-01 13:47:55 -07:00
description :
2024-09-12 07:53:36 -07:00
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>' ,
2020-10-04 07:28:05 -07:00
typeOptions : {
2022-08-01 13:47:55 -07:00
loadOptionsDependsOn : [ 'workspaceId' ] ,
2020-10-04 07:28:05 -07:00
loadOptionsMethod : 'loadTagsForWorkspace' ,
} ,
default : [ ] ,
} ,
{
displayName : 'Task ID' ,
name : 'taskId' ,
type : 'string' ,
default : '' ,
} ,
] ,
} ,
2021-12-03 00:44:16 -08:00
] ;