n8n/packages/nodes-base/nodes/ClickUp/TimeEntryDescription.ts
Iván Ovejero 6dcdb30bf4
refactor: Apply more nodelinting rules (#3324)
* ✏️ Alphabetize lint rules

* 🔥 Remove duplicates

*  Update `lintfix` script

* 👕 Apply `node-param-operation-without-no-data-expression` (#3329)

* 👕 Apply `node-param-operation-without-no-data-expression`

* 👕 Add exceptions

* 👕 Apply `node-param-description-weak` (#3328)

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>

* 👕 Apply `node-param-option-value-duplicate` (#3331)

* 👕 Apply `node-param-description-miscased-json` (#3337)

* 👕 Apply `node-param-display-name-excess-inner-whitespace` (#3335)

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>

* 👕 Apply `node-param-type-options-missing-from-limit` (#3336)

* Rule workig as intended

* ✏️ Uncomment rules

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>

* 👕 Apply `node-param-option-name-duplicate` (#3338)

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>

* 👕 Apply `node-param-description-wrong-for-simplify` (#3334)

*  fix

*  exceptions

*  changed rule ignoring from file to line

* 👕 Apply `node-param-resource-without-no-data-expression` (#3339)

* 👕 Apply `node-param-display-name-untrimmed` (#3341)

* 👕 Apply `node-param-display-name-miscased-id` (#3340)

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>

* 👕 Apply `node-param-resource-with-plural-option` (#3342)

* 👕 Apply `node-param-description-wrong-for-upsert` (#3333)

*  fix

*  replaced record with contact in description

*  fix

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>

* 👕 Apply `node-param-option-description-identical-to-name` (#3343)

* 👕 Apply `node-param-option-name-containing-star` (#3347)

* 👕 Apply `node-param-display-name-wrong-for-update-fields` (#3348)

* 👕 Apply `node-param-option-name-wrong-for-get-all` (#3345)

*  fix

*  exceptions

* 👕 Apply node-param-display-name-wrong-for-simplify (#3344)

* Rule working as intended

* Uncomented other rules

* 👕 Undo and add exceptions

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>

*  Alphabetize lint rules

*  Restore `lintfix` script

Co-authored-by: Michael Kret <88898367+michael-radency@users.noreply.github.com>
Co-authored-by: agobrech <45268029+agobrech@users.noreply.github.com>
2022-05-20 23:47:24 +02:00

869 lines
14 KiB
TypeScript

import {
INodeProperties,
} from 'n8n-workflow';
export const timeEntryOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: [
'timeEntry',
],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create a time entry',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a time entry',
},
{
name: 'Get',
value: 'get',
description: 'Get a time entry',
},
{
name: 'Get All',
value: 'getAll',
description: 'Get all time entries',
},
{
name: 'Start',
value: 'start',
description: 'Start a time entry',
},
{
name: 'Stop',
value: 'stop',
description: 'Stop the current running timer',
},
{
name: 'Update',
value: 'update',
description: 'Update a time Entry',
},
],
default: 'create',
},
];
export const timeEntryFields: INodeProperties[] = [
/* -------------------------------------------------------------------------- */
/* timeEntry:getAll */
/* -------------------------------------------------------------------------- */
{
displayName: 'Team ID',
name: 'team',
type: 'options',
default: '',
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'getAll',
],
},
},
typeOptions: {
loadOptionsMethod: 'getTeams',
},
required: true,
},
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'getAll',
],
},
},
default: false,
description: 'Whether to return all results or only up to a given limit',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'getAll',
],
returnAll: [
false,
],
},
},
typeOptions: {
minValue: 1,
maxValue: 10,
},
default: 5,
description: 'Max number of results to return',
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'getAll',
],
},
},
options: [
{
displayName: 'End Date',
name: 'end_date',
type: 'dateTime',
default: '',
},
{
displayName: 'Start Date',
name: 'start_date',
type: 'dateTime',
default: '',
},
],
},
/* -------------------------------------------------------------------------- */
/* timeEntry:get */
/* -------------------------------------------------------------------------- */
{
displayName: 'Team ID',
name: 'team',
type: 'options',
default: '',
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'get',
],
},
},
typeOptions: {
loadOptionsMethod: 'getTeams',
},
required: true,
},
{
displayName: 'Running',
name: 'running',
type: 'boolean',
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'get',
],
},
},
default: false,
description: 'When set to true it will return just the current running time entry',
},
{
displayName: 'Time Entry ID',
name: 'timeEntry',
type: 'string',
default: '',
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'get',
],
running: [
false,
],
},
},
required: true,
},
/* -------------------------------------------------------------------------- */
/* timeEntry:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'Team ID',
name: 'team',
type: 'options',
default: '',
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'create',
],
},
},
typeOptions: {
loadOptionsMethod: 'getTeams',
},
required: true,
},
{
displayName: 'Space ID',
name: 'space',
type: 'options',
default: '',
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'create',
],
},
},
typeOptions: {
loadOptionsMethod: 'getSpaces',
loadOptionsDependsOn: [
'team',
],
},
required: true,
},
{
displayName: 'Folderless List',
name: 'folderless',
type: 'boolean',
default: false,
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'create',
],
},
},
required: true,
},
{
displayName: 'Folder ID',
name: 'folder',
type: 'options',
default: '',
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'create',
],
folderless: [
false,
],
},
},
typeOptions: {
loadOptionsMethod: 'getFolders',
loadOptionsDependsOn: [
'space',
],
},
required: true,
},
{
displayName: 'List ID',
name: 'list',
type: 'options',
default: '',
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'create',
],
folderless: [
true,
],
},
},
typeOptions: {
loadOptionsMethod: 'getFolderlessLists',
loadOptionsDependsOn: [
'space',
],
},
required: true,
},
{
displayName: 'List ID',
name: 'list',
type: 'options',
default: '',
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'create',
],
folderless: [
false,
],
},
},
typeOptions: {
loadOptionsMethod: 'getLists',
loadOptionsDependsOn: [
'folder',
],
},
required: true,
},
{
displayName: 'Start',
name: 'start',
type: 'dateTime',
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'create',
],
},
},
required: true,
default: '',
},
{
displayName: 'Duration (minutes)',
name: 'duration',
type: 'number',
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'create',
],
},
},
default: 0,
required: true,
description: 'Duration in minutes',
},
{
displayName: 'Task ID',
name: 'task',
type: 'options',
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'create',
],
},
},
typeOptions: {
loadOptionsMethod: 'getTasks',
loadOptionsDependsOn: [
'list',
],
},
default: '',
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'create',
],
},
},
options: [
{
displayName: 'Assignee IDs',
name: 'assignee',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getAssignees',
loadOptionsDependsOn: [
'list',
],
},
default: [],
},
{
displayName: 'Billable',
name: 'billable',
type: 'boolean',
default: true,
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: 'Description of the time entry',
},
{
displayName: 'Tags IDs',
name: 'tags',
type: 'multiOptions',
typeOptions: {
loadOptionsDependsOn: [
'team',
],
loadOptionsMethod: 'getTimeEntryTags',
},
default: [],
},
],
},
/* -------------------------------------------------------------------------- */
/* timeEntry:start */
/* -------------------------------------------------------------------------- */
{
displayName: 'Team ID',
name: 'team',
type: 'options',
default: '',
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'start',
],
},
},
typeOptions: {
loadOptionsMethod: 'getTeams',
},
required: true,
},
{
displayName: 'Task ID',
name: 'task',
type: 'string',
default: '',
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'start',
],
},
},
required: true,
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'start',
],
},
},
options: [
{
displayName: 'Billable',
name: 'billable',
type: 'boolean',
default: true,
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: 'Description of the time entry',
},
],
},
/* -------------------------------------------------------------------------- */
/* timeEntry:stop */
/* -------------------------------------------------------------------------- */
{
displayName: 'Team ID',
name: 'team',
type: 'options',
default: '',
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'stop',
],
},
},
typeOptions: {
loadOptionsMethod: 'getTeams',
},
required: true,
},
/* -------------------------------------------------------------------------- */
/* timeEntry:delete */
/* -------------------------------------------------------------------------- */
{
displayName: 'Team ID',
name: 'team',
type: 'options',
default: '',
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'delete',
],
},
},
typeOptions: {
loadOptionsMethod: 'getTeams',
},
required: true,
},
{
displayName: 'Time Entry ID',
name: 'timeEntry',
type: 'string',
default: '',
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'delete',
],
},
},
required: true,
},
/* -------------------------------------------------------------------------- */
/* timeEntry:update */
/* -------------------------------------------------------------------------- */
{
displayName: 'Team ID',
name: 'team',
type: 'options',
default: '',
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'update',
],
},
},
typeOptions: {
loadOptionsMethod: 'getTeams',
},
required: true,
},
{
displayName: 'Space ID',
name: 'space',
type: 'options',
default: '',
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'update',
],
},
},
typeOptions: {
loadOptionsMethod: 'getSpaces',
loadOptionsDependsOn: [
'team',
],
},
required: true,
},
{
displayName: 'Folderless List',
name: 'folderless',
type: 'boolean',
default: false,
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'update',
],
},
},
required: true,
},
{
displayName: 'Folder ID',
name: 'folder',
type: 'options',
default: '',
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'update',
],
folderless: [
false,
],
},
},
typeOptions: {
loadOptionsMethod: 'getFolders',
loadOptionsDependsOn: [
'space',
],
},
required: true,
},
{
displayName: 'List ID',
name: 'list',
type: 'options',
default: '',
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'update',
],
folderless: [
true,
],
},
},
typeOptions: {
loadOptionsMethod: 'getFolderlessLists',
loadOptionsDependsOn: [
'space',
],
},
required: true,
},
{
displayName: 'List ID',
name: 'list',
type: 'options',
default: '',
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'update',
],
folderless: [
false,
],
},
},
typeOptions: {
loadOptionsMethod: 'getLists',
loadOptionsDependsOn: [
'folder',
],
},
required: true,
},
{
displayName: 'Archived',
name: 'archived',
type: 'boolean',
default: false,
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'update',
],
},
},
required: true,
},
{
displayName: 'Time Entry ID',
name: 'timeEntry',
type: 'string',
default: '',
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'update',
],
},
},
required: true,
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'timeEntry',
],
operation: [
'update',
],
},
},
options: [
{
displayName: 'Assignee IDs',
name: 'assignee',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getAssignees',
loadOptionsDependsOn: [
'list',
],
},
default: [],
},
{
displayName: 'Billable',
name: 'billable',
type: 'boolean',
default: true,
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: 'Description of the time entry',
},
{
displayName: 'Duration (minutes)',
name: 'duration',
type: 'number',
default: 0,
description: 'Duration in minutes',
},
{
displayName: 'Start',
name: 'start',
type: 'dateTime',
default: '',
},
{
displayName: 'Tags IDs',
name: 'tags',
type: 'multiOptions',
typeOptions: {
loadOptionsDependsOn: [
'spaceId',
],
loadOptionsMethod: 'getTags',
},
default: [],
},
{
displayName: 'Task ID',
name: 'task',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getTasks',
loadOptionsDependsOn: [
'archived',
'list',
],
},
default: '',
},
],
},
];