🔀 Merge branch 'Kiprosh-harvest-remaining'

This commit is contained in:
Jan Oberhauser 2020-02-07 20:40:04 -08:00
commit fbbadafc76
12 changed files with 3042 additions and 721 deletions

View file

@ -1,4 +1,6 @@
import { INodeProperties } from "n8n-workflow"; import { INodeProperties } from 'n8n-workflow';
const resource = ['client'];
export const clientOperations = [ export const clientOperations = [
{ {
@ -7,12 +9,20 @@ export const clientOperations = [
type: 'options', type: 'options',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'client',
],
}, },
}, },
options: [ options: [
{
name: 'Create',
value: 'create',
description: `Create a client`,
},
{
name: 'Delete',
value: 'delete',
description: `Delete a client`,
},
{ {
name: 'Get', name: 'Get',
value: 'get', value: 'get',
@ -23,6 +33,12 @@ export const clientOperations = [
value: 'getAll', value: 'getAll',
description: 'Get data of all clients', description: 'Get data of all clients',
}, },
{
name: 'Update',
value: 'update',
description: `Update a client`,
},
], ],
default: 'getAll', default: 'getAll',
description: 'The operation to perform.', description: 'The operation to perform.',
@ -42,9 +58,7 @@ export const clientFields = [
type: 'boolean', type: 'boolean',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'client',
],
operation: [ operation: [
'getAll', 'getAll',
], ],
@ -59,9 +73,7 @@ export const clientFields = [
type: 'number', type: 'number',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'client',
],
operation: [ operation: [
'getAll', 'getAll',
], ],
@ -85,9 +97,7 @@ export const clientFields = [
default: {}, default: {},
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'client',
],
operation: [ operation: [
'getAll', 'getAll',
], ],
@ -125,12 +135,153 @@ export const clientFields = [
operation: [ operation: [
'get', 'get',
], ],
resource: [ resource
'client',
],
}, },
}, },
description: 'The ID of the client you are retrieving.', description: 'The ID of the client you are retrieving.',
} },
/* -------------------------------------------------------------------------- */
/* client:delete */
/* -------------------------------------------------------------------------- */
{
displayName: 'Client Id',
name: 'id',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: [
'delete',
],
resource
},
},
description: 'The ID of the client you want to delete.',
},
/* -------------------------------------------------------------------------- */
/* client:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'Name',
name: 'name',
type: 'string',
displayOptions: {
show: {
operation: [
'create',
],
resource,
},
},
default: '',
required: true,
description: 'The name of the client.',
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
displayOptions: {
show: {
operation: [
'create',
],
resource,
},
},
default: {},
options: [
{
displayName: 'Is Active',
name: 'is_active',
type: 'string',
default: '',
description: 'Whether the client is active, or archived. Defaults to true.'
},
{
displayName: 'Address',
name: 'address',
type: 'string',
default: '',
description: ' A textual representation of the clients physical address. May include new line characters.'
},
{
displayName: 'Currency',
name: 'currency',
type: 'string',
default: '',
description: 'The currency used by the estimate. If not provided, the clients currency will be used. See a list of supported currencies'
},
],
},
/* -------------------------------------------------------------------------- */
/* client:update */
/* -------------------------------------------------------------------------- */
{
displayName: 'Client Id',
name: 'id',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: [
'update',
],
resource,
},
},
description: 'The ID of the client want to update.',
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
displayOptions: {
show: {
operation: [
'update',
],
resource,
},
},
default: {},
options: [
{
displayName: 'Address',
name: 'address',
type: 'string',
default: '',
description: ' A textual representation of the clients physical address. May include new line characters.'
},
{
displayName: 'Currency',
name: 'currency',
type: 'string',
default: '',
description: 'The currency used by the estimate. If not provided, the clients currency will be used. See a list of supported currencies'
},
{
displayName: 'Is Active',
name: 'is_active',
type: 'boolean',
default: true,
description: 'Whether the client is active, or archived. Defaults to true.'
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
description: 'Whether the client is active, or archived. Defaults to true.'
},
],
},
] as INodeProperties[]; ] as INodeProperties[];

View file

@ -1,4 +1,6 @@
import { INodeProperties } from "n8n-workflow"; import { INodeProperties } from 'n8n-workflow';
const resource = [ 'company' ];
export const companyOperations = [ export const companyOperations = [
{ {
@ -7,9 +9,7 @@ export const companyOperations = [
type: 'options', type: 'options',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'company',
],
}, },
}, },
options: [ options: [

View file

@ -1,4 +1,6 @@
import { INodeProperties } from "n8n-workflow"; import { INodeProperties } from 'n8n-workflow';
const resource = ['contact'];
export const contactOperations = [ export const contactOperations = [
{ {
@ -7,12 +9,20 @@ export const contactOperations = [
type: 'options', type: 'options',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'contact',
],
}, },
}, },
options: [ options: [
{
name: 'Create',
value: 'create',
description: `Create a contact`,
},
{
name: 'Delete',
value: 'delete',
description: `Delete a contact`,
},
{ {
name: 'Get', name: 'Get',
value: 'get', value: 'get',
@ -23,6 +33,11 @@ export const contactOperations = [
value: 'getAll', value: 'getAll',
description: 'Get data of all contacts', description: 'Get data of all contacts',
}, },
{
name: 'Update',
value: 'update',
description: `Update a contact`,
},
], ],
default: 'getAll', default: 'getAll',
description: 'The operation to perform.', description: 'The operation to perform.',
@ -42,9 +57,7 @@ export const contactFields = [
type: 'boolean', type: 'boolean',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'contact',
],
operation: [ operation: [
'getAll', 'getAll',
], ],
@ -59,9 +72,7 @@ export const contactFields = [
type: 'number', type: 'number',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'contact',
],
operation: [ operation: [
'getAll', 'getAll',
], ],
@ -85,9 +96,7 @@ export const contactFields = [
default: {}, default: {},
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'contact',
],
operation: [ operation: [
'getAll', 'getAll',
], ],
@ -98,7 +107,7 @@ export const contactFields = [
displayName: 'Is Active', displayName: 'Is Active',
name: 'is_active', name: 'is_active',
type: 'boolean', type: 'boolean',
default: '', default: true,
description: 'Pass true to only return active clients and false to return inactive clients.', description: 'Pass true to only return active clients and false to return inactive clients.',
}, },
{ {
@ -125,12 +134,218 @@ export const contactFields = [
operation: [ operation: [
'get', 'get',
], ],
resource: [ resource,
'contact',
],
}, },
}, },
description: 'The ID of the contact you are retrieving.', description: 'The ID of the contact you are retrieving.',
} },
/* -------------------------------------------------------------------------- */
/* contact:delete */
/* -------------------------------------------------------------------------- */
{
displayName: 'Contact Id',
name: 'id',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: [
'delete',
],
resource,
},
},
description: 'The ID of the contact you want to delete.',
},
/* -------------------------------------------------------------------------- */
/* contact:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'First Name',
name: 'firstName',
type: 'string',
displayOptions: {
show: {
operation: [
'create',
],
resource,
},
},
default: '',
required: true,
description: 'The first name of the contact.',
},
{
displayName: 'Client Id',
name: 'clientId',
type: 'string',
displayOptions: {
show: {
operation: [
'create',
],
resource,
},
},
default: '',
required: true,
description: 'The ID of the client associated with this contact.',
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
displayOptions: {
show: {
operation: [
'create',
],
resource,
},
},
default: {},
options: [
{
displayName: 'Last Name',
name: 'last_name',
type: 'string',
default: '',
description: 'The last name of the contact.'
},
{
displayName: 'Title',
name: 'title',
type: 'string',
default: '',
description: 'The title of the contact.'
},
{
displayName: 'Email',
name: 'email',
type: 'string',
default: '',
description: 'The contacts email address.'
},
{
displayName: 'Phone Office',
name: 'phone_office',
type: 'string',
default: '',
description: 'The contacts office phone number.'
},
{
displayName: 'Phone Mobile',
name: 'phone_mobile',
type: 'string',
default: '',
description: 'The contacts mobile phone number.'
},
{
displayName: 'Fax',
name: 'fax',
type: 'string',
default: '',
description: 'The contacts fax number.'
},
],
},
/* -------------------------------------------------------------------------- */
/* contact:update */
/* -------------------------------------------------------------------------- */
{
displayName: 'Contact Id',
name: 'id',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: [
'update',
],
resource,
},
},
description: 'The ID of the contact want to update.',
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
displayOptions: {
show: {
operation: [
'update',
],
resource,
},
},
default: {},
options: [
{
displayName: 'Client Id',
name: 'client_id',
type: 'string',
default: '',
description: 'The ID of the client associated with this contact.',
},
{
displayName: 'First Name',
name: 'first_name',
type: 'string',
default: '',
description: 'The first name of the contact.',
},
{
displayName: 'Last Name',
name: 'last_name',
type: 'string',
default: '',
description: 'The last name of the contact.'
},
{
displayName: 'Title',
name: 'title',
type: 'string',
default: '',
description: 'The title of the contact.'
},
{
displayName: 'Email',
name: 'email',
type: 'string',
default: '',
description: 'The contacts email address.'
},
{
displayName: 'Phone Office',
name: 'phone_office',
type: 'string',
default: '',
description: 'The contacts office phone number.'
},
{
displayName: 'Phone Mobile',
name: 'phone_mobile',
type: 'string',
default: '',
description: 'The contacts mobile phone number.'
},
{
displayName: 'Fax',
name: 'fax',
type: 'string',
default: '',
description: 'The contacts fax number.'
},
],
},
] as INodeProperties[]; ] as INodeProperties[];

View file

@ -1,4 +1,6 @@
import { INodeProperties } from "n8n-workflow"; import { INodeProperties } from 'n8n-workflow';
const resource = [ 'estimate' ];
export const estimateOperations = [ export const estimateOperations = [
{ {
@ -7,12 +9,20 @@ export const estimateOperations = [
type: 'options', type: 'options',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'estimate',
],
}, },
}, },
options: [ options: [
{
name: 'Create',
value: 'create',
description: `Create a estimate`,
},
{
name: 'Delete',
value: 'delete',
description: `Delete an estimate`,
},
{ {
name: 'Get', name: 'Get',
value: 'get', value: 'get',
@ -23,6 +33,11 @@ export const estimateOperations = [
value: 'getAll', value: 'getAll',
description: 'Get data of all estimates', description: 'Get data of all estimates',
}, },
{
name: 'Update',
value: 'update',
description: `Update a estimate`,
},
], ],
default: 'getAll', default: 'getAll',
description: 'The operation to perform.', description: 'The operation to perform.',
@ -42,9 +57,7 @@ export const estimateFields = [
type: 'boolean', type: 'boolean',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'estimate',
],
operation: [ operation: [
'getAll', 'getAll',
], ],
@ -59,9 +72,7 @@ export const estimateFields = [
type: 'number', type: 'number',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'estimate',
],
operation: [ operation: [
'getAll', 'getAll',
], ],
@ -85,9 +96,7 @@ export const estimateFields = [
default: {}, default: {},
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'estimate',
],
operation: [ operation: [
'getAll', 'getAll',
], ],
@ -101,13 +110,6 @@ export const estimateFields = [
default: '', default: '',
description: 'Only return time entries belonging to the client with the given ID.', description: 'Only return time entries belonging to the client with the given ID.',
}, },
{
displayName: 'Updated Since',
name: 'updated_since',
type: 'dateTime',
default: '',
description: 'Only return time entries that have been updated since the given date and time.',
},
{ {
displayName: 'From', displayName: 'From',
name: 'from', name: 'from',
@ -115,6 +117,13 @@ export const estimateFields = [
default: '', default: '',
description: 'Only return time entries with a spent_date on or after the given date.', description: 'Only return time entries with a spent_date on or after the given date.',
}, },
{
displayName: 'State',
name: 'state',
type: 'string',
default: '',
description: 'Only return estimates with a state matching the value provided. Options: draft, sent, accepted, or declined.',
},
{ {
displayName: 'To', displayName: 'To',
name: 'to', name: 'to',
@ -123,11 +132,11 @@ export const estimateFields = [
description: 'Only return time entries with a spent_date on or before the given date.', description: 'Only return time entries with a spent_date on or before the given date.',
}, },
{ {
displayName: 'State', displayName: 'Updated Since',
name: 'state', name: 'updated_since',
type: 'string', type: 'dateTime',
default: '', default: '',
description: 'Only return estimates with a state matching the value provided. Options: draft, sent, accepted, or declined.', description: 'Only return time entries that have been updated since the given date and time.',
}, },
{ {
displayName: 'Page', displayName: 'Page',
@ -156,12 +165,237 @@ export const estimateFields = [
operation: [ operation: [
'get', 'get',
], ],
resource: [ resource,
'estimate',
],
}, },
}, },
description: 'The ID of the estimate you are retrieving.', description: 'The ID of the estimate you are retrieving.',
} },
/* -------------------------------------------------------------------------- */
/* estimate:delete */
/* -------------------------------------------------------------------------- */
{
displayName: 'Estimate Id',
name: 'id',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: [
'delete',
],
resource,
},
},
description: 'The ID of the estimate want to delete.',
},
/* -------------------------------------------------------------------------- */
/* estimate:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'Client Id',
name: 'clientId',
type: 'string',
displayOptions: {
show: {
operation: [
'create',
],
resource,
},
},
default: '',
required: true,
description: 'The ID of the client this estimate belongs to.',
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
displayOptions: {
show: {
operation: [
'create',
],
resource,
},
},
default: {},
options: [
{
displayName: 'Currency',
name: 'currency',
type: 'string',
default: '',
description: 'The currency used by the estimate. If not provided, the clients currency will be used. See a list of supported currencies'
},
{
displayName: 'Discount',
name: 'over_budget_notification_percentage',
type: 'string',
default: '',
description: 'This percentage is subtracted from the subtotal. Example: use 10.0 for 10.0%.'
},
{
displayName: 'Issue Date',
name: 'issue_date',
type: 'dateTime',
default: '',
description: 'Date the invoice was issued. Defaults to todays date.'
},
{
displayName: 'Notes',
name: 'notes',
type: 'string',
default: '',
description: 'Any additional notes to include on the estimate.'
},
{
displayName: 'Number',
name: 'number',
type: 'string',
default: '',
description: 'If no value is set, the number will be automatically generated.'
},
{
displayName: 'Purchase Order',
name: 'purchase_order',
type: 'string',
default: '',
description: 'The purchase order number.'
},
{
displayName: 'Subject',
name: 'subject',
type: 'string',
default: '',
description: 'The estimate subject.'
},
{
displayName: 'Tax',
name: 'tax',
type: 'string',
default: '',
description: 'This percentage is applied to the subtotal, including line items and discounts. Example: use 10.0 for 10.0%.'
},
{
displayName: 'Tax2',
name: 'tax2',
type: 'string',
default: '',
description: 'This percentage is applied to the subtotal, including line items and discounts. Example: use 10.0 for 10.0%.'
},
],
},
/* -------------------------------------------------------------------------- */
/* estimate:update */
/* -------------------------------------------------------------------------- */
{
displayName: 'Invoice Id',
name: 'id',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: [
'update',
],
resource,
},
},
description: 'The ID of the invoice want to update.',
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
displayOptions: {
show: {
operation: [
'update',
],
resource,
},
},
default: {},
options: [
{
displayName: 'Client Id',
name: 'client_id',
type: 'string',
default: '',
description: 'The ID of the retainer associated with this invoice..',
},
{
displayName: 'Currency',
name: 'currency',
type: 'string',
default: '',
description: 'The currency used by the estimate. If not provided, the clients currency will be used. See a list of supported currencies'
},
{
displayName: 'Discount',
name: 'over_budget_notification_percentage',
type: 'string',
default: '',
description: 'This percentage is subtracted from the subtotal. Example: use 10.0 for 10.0%.'
},
{
displayName: 'Issue Date',
name: 'issue_date',
type: 'dateTime',
default: '',
description: 'Date the invoice was issued. Defaults to todays date.'
},
{
displayName: 'Number',
name: 'number',
type: 'string',
default: '',
description: 'If no value is set, the number will be automatically generated.'
},
{
displayName: 'Notes',
name: 'notes',
type: 'string',
default: '',
description: 'Any additional notes to include on the estimate.'
},
{
displayName: 'Purchase Order',
name: 'purchase_order',
type: 'string',
default: '',
description: 'The purchase order number.'
},
{
displayName: 'Subject',
name: 'subject',
type: 'string',
default: '',
description: 'The estimate subject.'
},
{
displayName: 'Tax',
name: 'tax',
type: 'string',
default: '',
description: 'This percentage is applied to the subtotal, including line items and discounts. Example: use 10.0 for 10.0%.'
},
{
displayName: 'Tax2',
name: 'tax2',
type: 'string',
default: '',
description: 'This percentage is applied to the subtotal, including line items and discounts. Example: use 10.0 for 10.0%.'
},
],
},
] as INodeProperties[]; ] as INodeProperties[];

View file

@ -1,4 +1,6 @@
import { INodeProperties } from "n8n-workflow"; import { INodeProperties } from 'n8n-workflow';
const resource = [ 'expense' ];
export const expenseOperations = [ export const expenseOperations = [
{ {
@ -7,9 +9,7 @@ export const expenseOperations = [
type: 'options', type: 'options',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'expense',
],
}, },
}, },
options: [ options: [
@ -23,6 +23,21 @@ export const expenseOperations = [
value: 'getAll', value: 'getAll',
description: 'Get data of all expenses', description: 'Get data of all expenses',
}, },
{
name: 'Create',
value: 'create',
description: `Create a expense`,
},
{
name: 'Update',
value: 'update',
description: `Update a expense`,
},
{
name: 'Delete',
value: 'delete',
description: `Delete an expense`,
},
], ],
default: 'getAll', default: 'getAll',
description: 'The operation to perform.', description: 'The operation to perform.',
@ -42,9 +57,7 @@ export const expenseFields = [
type: 'boolean', type: 'boolean',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'expense',
],
operation: [ operation: [
'getAll', 'getAll',
], ],
@ -59,9 +72,7 @@ export const expenseFields = [
type: 'number', type: 'number',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'expense',
],
operation: [ operation: [
'getAll', 'getAll',
], ],
@ -85,22 +96,13 @@ export const expenseFields = [
default: {}, default: {},
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'expense',
],
operation: [ operation: [
'getAll', 'getAll',
], ],
}, },
}, },
options: [ options: [
{
displayName: 'User ID',
name: 'user_id',
type: 'string',
default: '',
description: 'Only return time entries belonging to the user with the given ID.',
},
{ {
displayName: 'Client ID', displayName: 'Client ID',
name: 'client_id', name: 'client_id',
@ -108,27 +110,6 @@ export const expenseFields = [
default: '', default: '',
description: 'Only return time entries belonging to the client with the given ID.', description: 'Only return time entries belonging to the client with the given ID.',
}, },
{
displayName: 'Project ID',
name: 'project_id',
type: 'string',
default: '',
description: 'Only return time entries belonging to the client with the given ID.',
},
{
displayName: 'Is Billed',
name: 'is_billed',
type: 'boolean',
default: '',
description: 'Pass true to only return time entries that have been invoiced and false to return time entries that have not been invoiced.',
},
{
displayName: 'Updated Since',
name: 'updated_since',
type: 'dateTime',
default: '',
description: 'Only return time entries that have been updated since the given date and time.',
},
{ {
displayName: 'From', displayName: 'From',
name: 'from', name: 'from',
@ -137,11 +118,11 @@ export const expenseFields = [
description: 'Only return time entries with a spent_date on or after the given date.', description: 'Only return time entries with a spent_date on or after the given date.',
}, },
{ {
displayName: 'To', displayName: 'Is Billed',
name: 'to', name: 'is_billed',
type: 'dateTime', type: 'boolean',
default: '', default: false,
description: 'Only return time entries with a spent_date on or before the given date.', description: 'Pass true to only return time entries that have been invoiced and false to return time entries that have not been invoiced.',
}, },
{ {
displayName: 'Page', displayName: 'Page',
@ -152,7 +133,35 @@ export const expenseFields = [
}, },
default: 1, default: 1,
description: 'The page number to use in pagination. For instance, if you make a list request and receive 100 records, your subsequent call can include page=2 to retrieve the next page of the list. (Default: 1)', description: 'The page number to use in pagination. For instance, if you make a list request and receive 100 records, your subsequent call can include page=2 to retrieve the next page of the list. (Default: 1)',
} },
{
displayName: 'Project ID',
name: 'project_id',
type: 'string',
default: '',
description: 'Only return time entries belonging to the client with the given ID.',
},
{
displayName: 'To',
name: 'to',
type: 'dateTime',
default: '',
description: 'Only return time entries with a spent_date on or before the given date.',
},
{
displayName: 'Updated Since',
name: 'updated_since',
type: 'dateTime',
default: '',
description: 'Only return time entries that have been updated since the given date and time.',
},
{
displayName: 'User ID',
name: 'user_id',
type: 'string',
default: '',
description: 'Only return time entries belonging to the user with the given ID.',
},
] ]
}, },
@ -170,12 +179,227 @@ export const expenseFields = [
operation: [ operation: [
'get', 'get',
], ],
resource: [ resource,
'expense',
],
}, },
}, },
description: 'The ID of the expense you are retrieving.', description: 'The ID of the expense you are retrieving.',
} },
/* -------------------------------------------------------------------------- */
/* expense:delete */
/* -------------------------------------------------------------------------- */
{
displayName: 'Expense Id',
name: 'id',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: [
'delete',
],
resource,
},
},
description: 'The ID of the expense you want to delete.',
},
/* -------------------------------------------------------------------------- */
/* expense:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'Project Id',
name: 'projectId',
type: 'string',
displayOptions: {
show: {
operation: [
'create',
],
resource,
},
},
default: '',
required: true,
description: 'The ID of the project associated with this expense.',
},
{
displayName: 'Expense Category Id',
name: 'expenseCategoryId',
type: 'string',
displayOptions: {
show: {
operation: [
'create',
],
resource,
},
},
default: '',
required: true,
description: 'The ID of the expense category this expense is being tracked against.',
},
{
displayName: 'Spent Date',
name: 'spentDate',
type: 'dateTime',
displayOptions: {
show: {
operation: [
'create',
],
resource,
},
},
default: '',
required: true,
description: 'Date the expense occurred.',
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
displayOptions: {
show: {
operation: [
'create',
],
resource,
},
},
default: {},
options: [
{
displayName: 'Billable',
name: 'billable',
type: 'boolean',
default: true,
description: 'Whether this expense is billable or not. Defaults to true.'
},
{
displayName: 'Notes',
name: 'notes',
type: 'string',
default: '',
description: 'Notes about the expense.'
},
{
displayName: 'Total Cost',
name: 'total_cost',
type: 'string',
default: '',
description: 'The total amount of the expense.'
},
{
displayName: 'Units',
name: 'units',
type: 'string',
default: '',
description: 'The quantity of units to use in calculating the total_cost of the expense.'
},
{
displayName: 'User Id',
name: 'user_id',
type: 'boolean',
default: true,
description: 'The ID of the user associated with this expense. Defaults to the ID of the currently authenticated user.'
},
],
},
/* -------------------------------------------------------------------------- */
/* invoice:update */
/* -------------------------------------------------------------------------- */
{
displayName: 'Invoice Id',
name: 'id',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: [
'update',
],
resource,
},
},
description: 'The ID of the invoice want to update.',
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
displayOptions: {
show: {
operation: [
'update',
],
resource,
},
},
default: {},
options: [
{
displayName: 'Billable',
name: 'billable',
type: 'boolean',
default: true,
description: 'Whether this expense is billable or not. Defaults to true.'
},
{
displayName: 'Expense Category Id',
name: 'expense_category_id',
type: 'string',
default: '',
description: 'The ID of the expense category this expense is being tracked against.',
},
{
displayName: 'Notes',
name: 'notes',
type: 'string',
default: '',
description: 'Notes about the expense.'
},
{
displayName: 'Project Id',
name: 'project_id',
type: 'string',
default: '',
description: 'The ID of the project associated with this expense.',
},
{
displayName: 'Spent Date',
name: 'spent_date',
type: 'dateTime',
default: '',
description: 'Date the expense occurred.',
},
{
displayName: 'Total Cost',
name: 'total_cost',
type: 'string',
default: '',
description: 'The total amount of the expense.'
},
{
displayName: 'Units',
name: 'units',
type: 'string',
default: '',
description: 'The quantity of units to use in calculating the total_cost of the expense.'
},
{
displayName: 'User Id',
name: 'user_id',
type: 'boolean',
default: true,
description: 'The ID of the user associated with this expense. Defaults to the ID of the currently authenticated user.'
},
],
},
] as INodeProperties[]; ] as INodeProperties[];

View file

@ -50,6 +50,7 @@ export async function harvestApiRequest(
if (Object.keys(options.body).length === 0) { if (Object.keys(options.body).length === 0) {
delete options.body; delete options.body;
} }
try { try {
const result = await this.helpers.request!(options); const result = await this.helpers.request!(options);

View file

@ -8,17 +8,17 @@ import {
INodeType, INodeType,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { harvestApiRequest, harvestApiRequestAllItems } from './GenericFunctions';
import { timeEntryOperations, timeEntryFields } from './TimeEntryDescription';
import { clientOperations, clientFields } from './ClientDescription'; import { clientOperations, clientFields } from './ClientDescription';
import { companyOperations } from './CompanyDescription';
import { contactOperations, contactFields } from './ContactDescription'; import { contactOperations, contactFields } from './ContactDescription';
import { companyOperations } from './CompanyDescription';
import { estimateOperations, estimateFields } from './EstimateDescription';
import { expenseOperations, expenseFields } from './ExpenseDescription'; import { expenseOperations, expenseFields } from './ExpenseDescription';
import { harvestApiRequest, harvestApiRequestAllItems } from './GenericFunctions';
import { invoiceOperations, invoiceFields } from './InvoiceDescription'; import { invoiceOperations, invoiceFields } from './InvoiceDescription';
import { projectOperations, projectFields } from './ProjectDescription'; import { projectOperations, projectFields } from './ProjectDescription';
import { taskOperations, taskFields } from './TaskDescription'; import { taskOperations, taskFields } from './TaskDescription';
import { timeEntryOperations, timeEntryFields } from './TimeEntryDescription';
import { userOperations, userFields } from './UserDescription'; import { userOperations, userFields } from './UserDescription';
import { estimateOperations, estimateFields } from './EstimateDescription';
/** /**
* fetch All resource using paginated calls * fetch All resource using paginated calls
@ -86,7 +86,7 @@ export class Harvest implements INodeType {
value: 'contact', value: 'contact',
}, },
{ {
name: 'Estimates', name: 'Estimate',
value: 'estimate', value: 'estimate',
}, },
{ {
@ -147,7 +147,6 @@ export class Harvest implements INodeType {
const items = this.getInputData(); const items = this.getInputData();
const returnData: IDataObject[] = []; const returnData: IDataObject[] = [];
const resource = this.getNodeParameter('resource', 0) as string; const resource = this.getNodeParameter('resource', 0) as string;
const operation = this.getNodeParameter('operation', 0) as string; const operation = this.getNodeParameter('operation', 0) as string;
@ -156,7 +155,6 @@ export class Harvest implements INodeType {
let body: IDataObject | Buffer; let body: IDataObject | Buffer;
let qs: IDataObject; let qs: IDataObject;
for (let i = 0; i < items.length; i++) { for (let i = 0; i < items.length; i++) {
body = {}; body = {};
qs = {}; qs = {};
@ -306,6 +304,48 @@ export class Harvest implements INodeType {
const responseData: IDataObject[] = await getAllResource.call(this, 'clients', i); const responseData: IDataObject[] = await getAllResource.call(this, 'clients', i);
returnData.push.apply(returnData, responseData); returnData.push.apply(returnData, responseData);
} else if (operation === 'create') {
// ----------------------------------
// create
// ----------------------------------
requestMethod = 'POST';
endpoint = 'clients';
body.name = this.getNodeParameter('name', i) as string;
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
Object.assign(body, additionalFields);
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
returnData.push(responseData);
} else if (operation === 'update') {
// ----------------------------------
// update
// ----------------------------------
requestMethod = 'PATCH';
const id = this.getNodeParameter('id', i) as string;
endpoint = `clients/${id}`;
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
Object.assign(qs, updateFields);
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
returnData.push(responseData);
} else if (operation === 'delete') {
// ----------------------------------
// delete
// ----------------------------------
requestMethod = 'DELETE';
const id = this.getNodeParameter('id', i) as string;
endpoint = `clients/${id}`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData);
} else { } else {
throw new Error(`The resource "${resource}" is not known!`); throw new Error(`The resource "${resource}" is not known!`);
} }
@ -331,6 +371,52 @@ export class Harvest implements INodeType {
const responseData: IDataObject[] = await getAllResource.call(this, 'projects', i); const responseData: IDataObject[] = await getAllResource.call(this, 'projects', i);
returnData.push.apply(returnData, responseData); returnData.push.apply(returnData, responseData);
} else if (operation === 'create') {
// ----------------------------------
// create
// ----------------------------------
requestMethod = 'POST';
endpoint = 'projects';
body.client_id = this.getNodeParameter('clientId', i) as string;
body.name = this.getNodeParameter('name', i) as string;
body.is_billable = this.getNodeParameter('isBillable', i) as string;
body.bill_by = this.getNodeParameter('billBy', i) as string;
body.budget_by = this.getNodeParameter('budgetBy', i) as string;
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
Object.assign(body, additionalFields);
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
returnData.push(responseData);
} else if (operation === 'update') {
// ----------------------------------
// update
// ----------------------------------
requestMethod = 'PATCH';
const id = this.getNodeParameter('id', i) as string;
endpoint = `projects/${id}`;
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
Object.assign(body, updateFields);
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
returnData.push(responseData);
} else if (operation === 'delete') {
// ----------------------------------
// delete
// ----------------------------------
requestMethod = 'DELETE';
const id = this.getNodeParameter('id', i) as string;
endpoint = `projects/${id}`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData);
} else { } else {
throw new Error(`The resource "${resource}" is not known!`); throw new Error(`The resource "${resource}" is not known!`);
} }
@ -363,11 +449,55 @@ export class Harvest implements INodeType {
requestMethod = 'GET'; requestMethod = 'GET';
endpoint = 'users/me'; endpoint = `users/me`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint); const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData); returnData.push(responseData);
} else if (operation === 'create') {
// ----------------------------------
// create
// ----------------------------------
requestMethod = 'POST';
endpoint = 'users';
body.first_name = this.getNodeParameter('firstName', i) as string;
body.last_name = this.getNodeParameter('lastName', i) as string;
body.email = this.getNodeParameter('email', i) as string;
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
Object.assign(body, additionalFields);
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
returnData.push(responseData);
} else if (operation === 'update') {
// ----------------------------------
// update
// ----------------------------------
requestMethod = 'PATCH';
const id = this.getNodeParameter('id', i) as string;
endpoint = `users/${id}`;
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
Object.assign(qs, updateFields);
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
returnData.push(responseData);
} else if (operation === 'delete') {
// ----------------------------------
// delete
// ----------------------------------
requestMethod = 'DELETE';
const id = this.getNodeParameter('id', i) as string;
endpoint = `users/${id}`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData);
} else { } else {
throw new Error(`The resource "${resource}" is not known!`); throw new Error(`The resource "${resource}" is not known!`);
} }
@ -393,6 +523,49 @@ export class Harvest implements INodeType {
const responseData: IDataObject[] = await getAllResource.call(this, 'contacts', i); const responseData: IDataObject[] = await getAllResource.call(this, 'contacts', i);
returnData.push.apply(returnData, responseData); returnData.push.apply(returnData, responseData);
} else if (operation === 'create') {
// ----------------------------------
// create
// ----------------------------------
requestMethod = 'POST';
endpoint = 'contacts';
body.client_id = this.getNodeParameter('clientId', i) as string;
body.first_name = this.getNodeParameter('firstName', i) as string;
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
Object.assign(body, additionalFields);
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
returnData.push(responseData);
} else if (operation === 'update') {
// ----------------------------------
// update
// ----------------------------------
requestMethod = 'PATCH';
const id = this.getNodeParameter('id', i) as string;
endpoint = `contacts/${id}`;
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
Object.assign(qs, updateFields);
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
returnData.push(responseData);
} else if (operation === 'delete') {
// ----------------------------------
// delete
// ----------------------------------
requestMethod = 'DELETE';
const id = this.getNodeParameter('id', i) as string;
endpoint = `contacts/${id}`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData);
} else { } else {
throw new Error(`The resource "${resource}" is not known!`); throw new Error(`The resource "${resource}" is not known!`);
} }
@ -433,6 +606,17 @@ export class Harvest implements INodeType {
const responseData: IDataObject[] = await getAllResource.call(this, 'tasks', i); const responseData: IDataObject[] = await getAllResource.call(this, 'tasks', i);
returnData.push.apply(returnData, responseData); returnData.push.apply(returnData, responseData);
} else if (operation === 'delete') {
// ----------------------------------
// delete
// ----------------------------------
requestMethod = 'DELETE';
const id = this.getNodeParameter('id', i) as string;
endpoint = `tasks/${id}`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData);
} else { } else {
throw new Error(`The resource "${resource}" is not known!`); throw new Error(`The resource "${resource}" is not known!`);
} }
@ -458,6 +642,48 @@ export class Harvest implements INodeType {
const responseData: IDataObject[] = await getAllResource.call(this, 'invoices', i); const responseData: IDataObject[] = await getAllResource.call(this, 'invoices', i);
returnData.push.apply(returnData, responseData); returnData.push.apply(returnData, responseData);
} else if (operation === 'create') {
// ----------------------------------
// create
// ----------------------------------
requestMethod = 'POST';
endpoint = 'invoices';
body.client_id = this.getNodeParameter('clientId', i) as string;
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
Object.assign(body, additionalFields);
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
returnData.push(responseData);
} else if (operation === 'update') {
// ----------------------------------
// update
// ----------------------------------
requestMethod = 'PATCH';
const id = this.getNodeParameter('id', i) as string;
endpoint = `invoices/${id}`;
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
Object.assign(qs, updateFields);
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
returnData.push(responseData);
} else if (operation === 'delete') {
// ----------------------------------
// delete
// ----------------------------------
requestMethod = 'DELETE';
const id = this.getNodeParameter('id', i) as string;
endpoint = `invoices/${id}`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData);
} else { } else {
throw new Error(`The resource "${resource}" is not known!`); throw new Error(`The resource "${resource}" is not known!`);
} }
@ -483,6 +709,50 @@ export class Harvest implements INodeType {
const responseData: IDataObject[] = await getAllResource.call(this, 'expenses', i); const responseData: IDataObject[] = await getAllResource.call(this, 'expenses', i);
returnData.push.apply(returnData, responseData); returnData.push.apply(returnData, responseData);
} else if (operation === 'create') {
// ----------------------------------
// create
// ----------------------------------
requestMethod = 'POST';
endpoint = 'expenses';
body.project_id = this.getNodeParameter('projectId', i) as string;
body.expense_category_id = this.getNodeParameter('expenseCategoryId', i) as string;
body.spent_date = this.getNodeParameter('spentDate', i) as string;
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
Object.assign(body, additionalFields);
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
returnData.push(responseData);
} else if (operation === 'update') {
// ----------------------------------
// update
// ----------------------------------
requestMethod = 'PATCH';
const id = this.getNodeParameter('id', i) as string;
endpoint = `expenses/${id}`;
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
Object.assign(qs, updateFields);
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
returnData.push(responseData);
} else if (operation === 'delete') {
// ----------------------------------
// delete
// ----------------------------------
requestMethod = 'DELETE';
const id = this.getNodeParameter('id', i) as string;
endpoint = `expenses/${id}`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData);
} else { } else {
throw new Error(`The resource "${resource}" is not known!`); throw new Error(`The resource "${resource}" is not known!`);
} }
@ -508,6 +778,48 @@ export class Harvest implements INodeType {
const responseData: IDataObject[] = await getAllResource.call(this, 'estimates', i); const responseData: IDataObject[] = await getAllResource.call(this, 'estimates', i);
returnData.push.apply(returnData, responseData); returnData.push.apply(returnData, responseData);
} else if (operation === 'create') {
// ----------------------------------
// create
// ----------------------------------
requestMethod = 'POST';
endpoint = 'estimates';
body.client_id = this.getNodeParameter('clientId', i) as string;
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
Object.assign(body, additionalFields);
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
returnData.push(responseData);
} else if (operation === 'update') {
// ----------------------------------
// update
// ----------------------------------
requestMethod = 'PATCH';
const id = this.getNodeParameter('id', i) as string;
endpoint = `estimates/${id}`;
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
Object.assign(qs, updateFields);
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
returnData.push(responseData);
} else if (operation === 'delete') {
// ----------------------------------
// delete
// ----------------------------------
requestMethod = 'DELETE';
const id = this.getNodeParameter('id', i) as string;
endpoint = `estimates/${id}`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData);
} else { } else {
throw new Error(`The resource "${resource}" is not known!`); throw new Error(`The resource "${resource}" is not known!`);
} }

View file

@ -1,4 +1,6 @@
import { INodeProperties } from "n8n-workflow"; import { INodeProperties } from 'n8n-workflow';
const resource = [ 'invoice' ];
export const invoiceOperations = [ export const invoiceOperations = [
{ {
@ -7,9 +9,7 @@ export const invoiceOperations = [
type: 'options', type: 'options',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'invoice',
],
}, },
}, },
options: [ options: [
@ -23,6 +23,21 @@ export const invoiceOperations = [
value: 'getAll', value: 'getAll',
description: 'Get data of all invoices', description: 'Get data of all invoices',
}, },
{
name: 'Create',
value: 'create',
description: `Create a invoice`,
},
{
name: 'Update',
value: 'update',
description: `Update a invoice`,
},
{
name: 'Delete',
value: 'delete',
description: `Delete a invoice`,
},
], ],
default: 'getAll', default: 'getAll',
description: 'The operation to perform.', description: 'The operation to perform.',
@ -42,9 +57,7 @@ export const invoiceFields = [
type: 'boolean', type: 'boolean',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'invoice',
],
operation: [ operation: [
'getAll', 'getAll',
], ],
@ -59,9 +72,7 @@ export const invoiceFields = [
type: 'number', type: 'number',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'invoice',
],
operation: [ operation: [
'getAll', 'getAll',
], ],
@ -85,9 +96,7 @@ export const invoiceFields = [
default: {}, default: {},
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'invoice',
],
operation: [ operation: [
'getAll', 'getAll',
], ],
@ -181,12 +190,292 @@ export const invoiceFields = [
operation: [ operation: [
'get', 'get',
], ],
resource: [ resource,
'invoice',
],
}, },
}, },
description: 'The ID of the invoice you are retrieving.', description: 'The ID of the invoice you are retrieving.',
} },
/* -------------------------------------------------------------------------- */
/* invoice:delete */
/* -------------------------------------------------------------------------- */
{
displayName: 'Invoice Id',
name: 'id',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: [
'delete',
],
resource,
},
},
description: 'The ID of the invoice want to delete.',
},
/* -------------------------------------------------------------------------- */
/* invoice:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'Client Id',
name: 'clientId',
type: 'string',
displayOptions: {
show: {
operation: [
'create',
],
resource,
},
},
default: '',
required: true,
description: 'The ID of the retainer associated with this invoice..',
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
displayOptions: {
show: {
operation: [
'create',
],
resource,
},
},
default: {},
options: [
{
displayName: 'Currency',
name: 'currency',
type: 'string',
default: '',
description: 'The currency used by the invoice. If not provided, the clients currency will be used. See a list of supported currencies'
},
{
displayName: 'Discount',
name: 'over_budget_notification_percentage',
type: 'string',
default: '',
description: 'This percentage is subtracted from the subtotal. Example: use 10.0 for 10.0%.'
},
{
displayName: 'Due Date',
name: 'ends_on',
type: 'dateTime',
default: '',
description: 'Date the invoice is due. Defaults to the issue_date if no payment_term is specified.'
},
{
displayName: 'Estimate Id',
name: 'estimate_id',
type: 'string',
default: '',
description: 'The ID of the estimate associated with this invoice.'
},
{
displayName: 'Issue Date',
name: 'issue_date',
type: 'dateTime',
default: '',
description: 'Date the invoice was issued. Defaults to todays date.'
},
{
displayName: 'Notes',
name: 'notes',
type: 'string',
default: '',
description: 'Notes about the project.'
},
{
displayName: 'Number',
name: 'number',
type: 'string',
default: '',
description: 'If no value is set, the number will be automatically generated.'
},
{
displayName: 'Payment Term',
name: 'payment_term',
type: 'string',
default: '',
description: 'The timeframe in which the invoice should be paid. Defaults to custom. Options: upon receipt, net 15, net 30, net 45, or net 60.'
},
{
displayName: 'Purchase Order',
name: 'purchase_order',
type: 'string',
default: '',
description: 'The purchase order number.'
},
{
displayName: 'Retainer Id',
name: 'retainer_id',
type: 'boolean',
default: true,
description: 'The ID of the retainer associated with this invoice.'
},
{
displayName: 'Subject',
name: 'subject',
type: 'string',
default: '',
description: 'The invoice subject.'
},
{
displayName: 'Tax',
name: 'tax',
type: 'string',
default: '',
description: 'This percentage is applied to the subtotal, including line items and discounts. Example: use 10.0 for 10.0%.'
},
{
displayName: 'Tax2',
name: 'tax2',
type: 'string',
default: '',
description: 'This percentage is applied to the subtotal, including line items and discounts. Example: use 10.0 for 10.0%.'
},
],
},
/* -------------------------------------------------------------------------- */
/* invoice:update */
/* -------------------------------------------------------------------------- */
{
displayName: 'Invoice Id',
name: 'id',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: [
'update',
],
resource,
},
},
description: 'The ID of the invoice want to update.',
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
displayOptions: {
show: {
operation: [
'update',
],
resource,
},
},
default: {},
options: [
{
displayName: 'Client Id',
name: 'client_id',
type: 'string',
default: '',
description: 'The ID of the retainer associated with this invoice..',
},
{
displayName: 'Currency',
name: 'currency',
type: 'string',
default: '',
description: 'The currency used by the invoice. If not provided, the clients currency will be used. See a list of supported currencies'
},
{
displayName: 'Discount',
name: 'over_budget_notification_percentage',
type: 'string',
default: '',
description: 'This percentage is subtracted from the subtotal. Example: use 10.0 for 10.0%.'
},
{
displayName: 'Due Date',
name: 'ends_on',
type: 'dateTime',
default: '',
description: 'Date the invoice is due. Defaults to the issue_date if no payment_term is specified.'
},
{
displayName: 'Estimate Id',
name: 'estimate_id',
type: 'string',
default: '',
description: 'The ID of the estimate associated with this invoice.'
},
{
displayName: 'Issue Date',
name: 'issue_date',
type: 'dateTime',
default: '',
description: 'Date the invoice was issued. Defaults to todays date.'
},
{
displayName: 'Notes',
name: 'notes',
type: 'string',
default: '',
description: 'Notes about the project.'
},
{
displayName: 'Number',
name: 'number',
type: 'string',
default: '',
description: 'If no value is set, the number will be automatically generated.'
},
{
displayName: 'Payment Term',
name: 'payment_term',
type: 'string',
default: '',
description: 'The timeframe in which the invoice should be paid. Defaults to custom. Options: upon receipt, net 15, net 30, net 45, or net 60.'
},
{
displayName: 'Purchase Order',
name: 'purchase_order',
type: 'string',
default: '',
description: 'The purchase order number.'
},
{
displayName: 'Retainer Id',
name: 'retainer_id',
type: 'boolean',
default: true,
description: 'The ID of the retainer associated with this invoice.'
},
{
displayName: 'Subject',
name: 'subject',
type: 'string',
default: '',
description: 'The invoice subject.'
},
{
displayName: 'Tax',
name: 'tax',
type: 'string',
default: '',
description: 'This percentage is applied to the subtotal, including line items and discounts. Example: use 10.0 for 10.0%.'
},
{
displayName: 'Tax2',
name: 'tax2',
type: 'string',
default: '',
description: 'This percentage is applied to the subtotal, including line items and discounts. Example: use 10.0 for 10.0%.'
},
],
},
] as INodeProperties[]; ] as INodeProperties[];

View file

@ -1,4 +1,6 @@
import { INodeProperties } from "n8n-workflow"; import { INodeProperties } from 'n8n-workflow';
const resource = ['project'];
export const projectOperations = [ export const projectOperations = [
{ {
@ -7,12 +9,20 @@ export const projectOperations = [
type: 'options', type: 'options',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'project',
],
}, },
}, },
options: [ options: [
{
name: 'Create',
value: 'create',
description: `Create a project`,
},
{
name: 'Delete',
value: 'delete',
description: `Delete a project`,
},
{ {
name: 'Get', name: 'Get',
value: 'get', value: 'get',
@ -23,6 +33,11 @@ export const projectOperations = [
value: 'getAll', value: 'getAll',
description: 'Get data of all projects', description: 'Get data of all projects',
}, },
{
name: 'Update',
value: 'update',
description: `Update a project`,
},
], ],
default: 'getAll', default: 'getAll',
description: 'The operation to perform.', description: 'The operation to perform.',
@ -42,9 +57,7 @@ export const projectFields = [
type: 'boolean', type: 'boolean',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'project',
],
operation: [ operation: [
'getAll', 'getAll',
], ],
@ -59,9 +72,7 @@ export const projectFields = [
type: 'number', type: 'number',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'project',
],
operation: [ operation: [
'getAll', 'getAll',
], ],
@ -85,22 +96,13 @@ export const projectFields = [
default: {}, default: {},
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'project',
],
operation: [ operation: [
'getAll', 'getAll',
], ],
}, },
}, },
options: [ options: [
{
displayName: 'Is Active',
name: 'is_active',
type: 'boolean',
default: true,
description: 'Pass true to only return active projects and false to return inactive projects.',
},
{ {
displayName: 'Client Id', displayName: 'Client Id',
name: 'client_id', name: 'client_id',
@ -109,11 +111,11 @@ export const projectFields = [
description: 'Only return projects belonging to the client with the given ID.', description: 'Only return projects belonging to the client with the given ID.',
}, },
{ {
displayName: 'Updated Since', displayName: 'Is Active',
name: 'updated_since', name: 'is_active',
type: 'dateTime', type: 'boolean',
default: '', default: true,
description: 'Only return projects by updated_since.', description: 'Pass true to only return active projects and false to return inactive projects.',
}, },
{ {
displayName: 'Page', displayName: 'Page',
@ -125,7 +127,13 @@ export const projectFields = [
default: 1, default: 1,
description: 'The page number to use in pagination.', description: 'The page number to use in pagination.',
}, },
{
displayName: 'Updated Since',
name: 'updated_since',
type: 'dateTime',
default: '',
description: 'Only return projects by updated_since.',
},
] ]
}, },
@ -143,12 +151,440 @@ export const projectFields = [
operation: [ operation: [
'get', 'get',
], ],
resource: [ resource,
'project',
],
}, },
}, },
description: 'The ID of the project you are retrieving.', description: 'The ID of the project you are retrieving.',
} },
/* -------------------------------------------------------------------------- */
/* project:delete */
/* -------------------------------------------------------------------------- */
{
displayName: 'Project Id',
name: 'id',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: [
'delete',
],
resource,
},
},
description: 'The ID of the project want to delete.',
},
/* -------------------------------------------------------------------------- */
/* project:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'Name',
name: 'name',
type: 'string',
displayOptions: {
show: {
operation: [
'create',
],
resource,
},
},
default: '',
required: true,
description: 'The name of the project.',
},
{
displayName: 'Client Id',
name: 'clientId',
type: 'string',
displayOptions: {
show: {
operation: [
'create',
],
resource,
},
},
default: '',
required: true,
description: 'The ID of the client to associate this project with.',
},
{
displayName: 'Is Billable',
name: 'isBillable',
type: 'boolean',
displayOptions: {
show: {
operation: [
'create',
],
resource,
},
},
default: true,
required: true,
description: 'Whether the project is billable or not.',
},
{
displayName: 'Bill By',
name: 'billBy',
type: 'options',
displayOptions: {
show: {
operation: [
'create',
],
resource,
},
},
options: [
{
name: 'none',
value: 'none',
},
{
name: 'People',
value: 'People',
},
{
name: 'Project',
value: 'Project',
},
{
name: 'Tasks',
value: 'Tasks',
},
],
default: 'none',
required: true,
description: 'The method by which the project is invoiced.',
},
{
displayName: 'Budget By',
name: 'budgetBy',
type: 'string',
displayOptions: {
show: {
operation: [
'create',
],
resource,
},
},
default: 'none',
placeholder: '',
required: true,
description: 'The email of the user or "none".',
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
displayOptions: {
show: {
operation: [
'create',
],
resource,
},
},
default: {},
options: [
{
displayName: 'Budget',
name: 'budget',
type: 'number',
typeOptions: {
minValue: 0,
},
default: 0,
description: 'The budget in hours for the project when budgeting by time.'
},
{
displayName: 'Budget Is Monthly',
name: 'budget_is_monthly',
type: 'boolean',
default: false,
description: 'Option to have the budget reset every month. Defaults to false.'
},
{
displayName: 'Cost Budget',
name: 'cost_budget',
type: 'string',
default: '',
description: 'The monetary budget for the project when budgeting by money.'
},
{
displayName: 'Cost Budget Include Expenses',
name: 'cost_budget_include_expenses',
type: 'boolean',
default: false,
description: 'Option for budget of Total Project Fees projects to include tracked expenses. Defaults to false.'
},
{
displayName: 'Ends On',
name: 'ends_on',
type: 'dateTime',
default: '',
description: 'Date the project will end.'
},
{
displayName: 'Fee',
name: 'fee',
type: 'string',
default: '',
description: 'The amount you plan to invoice for the project. Only used by fixed-fee projects.'
},
{
displayName: 'Hourly Rate',
name: 'hourly_rate',
type: 'string',
default: '',
description: 'Rate for projects billed by Project Hourly Rate.'
},
{
displayName: 'Is Active',
name: 'is_active',
type: 'boolean',
default: true,
description: 'Whether the project is active or archived. Defaults to true'
},
{
displayName: 'Is Fixed Fee',
name: 'is_fixed_fee',
type: 'boolean',
default: false,
description: 'Whether the project is a fixed-fee project or not.'
},
{
displayName: 'Notes',
name: 'notes',
type: 'string',
default: '',
description: 'Notes about the project.'
},
{
displayName: 'Notify When Over Budget',
name: 'notify_when_over_budget',
type: 'boolean',
default: false,
description: 'Whether project managers should be notified when the project goes over budget. Defaults to false.'
},
{
displayName: 'Over Budget Notification Percentage',
name: 'over_budget_notification_percentage',
type: 'string',
default: '',
description: 'Percentage value used to trigger over budget email alerts. Example: use 10.0 for 10.0%.'
},
{
displayName: 'Show Budget To All',
name: 'show_budget_to_all',
type: 'boolean',
default: false,
description: 'Option to show project budget to all employees. Does not apply to Total Project Fee projects. Defaults to false.'
},
{
displayName: 'Starts On',
name: 'starts_on',
type: 'dateTime',
default: '',
description: 'Date the project was started.'
},
],
},
/* -------------------------------------------------------------------------- */
/* project:update */
/* -------------------------------------------------------------------------- */
{
displayName: 'Project Id',
name: 'id',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: [
'update',
],
resource,
},
},
description: 'The ID of the project want to update.',
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
displayOptions: {
show: {
operation: [
'update',
],
resource,
},
},
default: {},
options: [
{
displayName: 'Bill By',
name: 'bill_by',
type: 'options',
options: [
{
name: 'none',
value: 'none',
},
{
name: 'People',
value: 'People',
},
{
name: 'Project',
value: 'Project',
},
{
name: 'Tasks',
value: 'Tasks',
},
],
default: 'none',
description: 'The method by which the project is invoiced.',
},
{
displayName: 'Budget',
name: 'budget',
type: 'string',
default: '',
description: 'The budget in hours for the project when budgeting by time.'
},
{
displayName: 'Budget By',
name: 'budget_by',
type: 'string',
default: '',
description: 'The email of the user or "none".',
},
{
displayName: 'Budget Is Monthly',
name: 'budget_is_monthly',
type: 'boolean',
default: false,
description: 'Option to have the budget reset every month. Defaults to false.'
},
{
displayName: 'Client Id',
name: 'client_id',
type: 'string',
default: '',
description: 'The ID of the client to associate this project with.',
},
{
displayName: 'Cost Budget',
name: 'cost_budget',
type: 'string',
default: '',
description: 'The monetary budget for the project when budgeting by money.'
},
{
displayName: 'Cost Budget Include Expenses',
name: 'cost_budget_include_expenses',
type: 'boolean',
default: false,
description: 'Option for budget of Total Project Fees projects to include tracked expenses. Defaults to false.'
},
{
displayName: 'Ends On',
name: 'ends_on',
type: 'dateTime',
default: '',
description: 'Date the project will end.'
},
{
displayName: 'Fee',
name: 'fee',
type: 'string',
default: '',
description: 'The amount you plan to invoice for the project. Only used by fixed-fee projects.'
},
{
displayName: 'Hourly Rate',
name: 'hourly_rate',
type: 'string',
default: '',
description: 'Rate for projects billed by Project Hourly Rate.'
},
{
displayName: 'Is Active',
name: 'is_active',
type: 'boolean',
default: true,
description: 'Whether the project is active or archived. Defaults to true'
},
{
displayName: 'Is Billable',
name: 'is_billable',
type: 'boolean',
default: true,
description: 'Whether the project is billable or not.',
},
{
displayName: 'Is Fixed Fee',
name: 'is_fixed_fee',
type: 'boolean',
default: false,
description: 'Whether the project is a fixed-fee project or not.'
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
description: 'The name of the project.',
},
{
displayName: 'Notes',
name: 'notes',
type: 'string',
default: '',
description: 'Notes about the project.'
},
{
displayName: 'Notify When Over Budget',
name: 'notify_when_over_budget',
type: 'boolean',
default: false,
description: 'Whether project managers should be notified when the project goes over budget. Defaults to false.'
},
{
displayName: 'Over Budget Notification Percentage',
name: 'over_budget_notification_percentage',
type: 'string',
default: '',
description: 'Percentage value used to trigger over budget email alerts. Example: use 10.0 for 10.0%.'
},
{
displayName: 'Show Budget To All',
name: 'show_budget_to_all',
type: 'boolean',
default: false,
description: 'Option to show project budget to all employees. Does not apply to Total Project Fee projects. Defaults to false.'
},
{
displayName: 'Starts On',
name: 'starts_on',
type: 'dateTime',
default: '',
description: 'Date the project was started.'
},
],
},
] as INodeProperties[]; ] as INodeProperties[];

View file

@ -1,5 +1,5 @@
import { INodeProperties } from "n8n-workflow"; import { INodeProperties } from 'n8n-workflow';
const resource = ['task'];
export const taskOperations = [ export const taskOperations = [
{ {
displayName: 'Operation', displayName: 'Operation',
@ -7,12 +7,20 @@ export const taskOperations = [
type: 'options', type: 'options',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'task',
],
}, },
}, },
options: [ options: [
{
name: 'Create',
value: 'create',
description: `Create a task`,
},
{
name: 'Delete',
value: 'delete',
description: `Delete a task`,
},
{ {
name: 'Get', name: 'Get',
value: 'get', value: 'get',
@ -23,6 +31,11 @@ export const taskOperations = [
value: 'getAll', value: 'getAll',
description: 'Get data of all tasks', description: 'Get data of all tasks',
}, },
{
name: 'Update',
value: 'update',
description: `Update a task`,
},
], ],
default: 'getAll', default: 'getAll',
description: 'The operation to perform.', description: 'The operation to perform.',
@ -42,9 +55,7 @@ export const taskFields = [
type: 'boolean', type: 'boolean',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'task',
],
operation: [ operation: [
'getAll', 'getAll',
], ],
@ -59,9 +70,7 @@ export const taskFields = [
type: 'number', type: 'number',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'task',
],
operation: [ operation: [
'getAll', 'getAll',
], ],
@ -85,9 +94,7 @@ export const taskFields = [
default: {}, default: {},
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'task',
],
operation: [ operation: [
'getAll', 'getAll',
], ],
@ -101,13 +108,6 @@ export const taskFields = [
default: true, default: true,
description: 'Pass true to only return active tasks and false to return inactive tasks.', description: 'Pass true to only return active tasks and false to return inactive tasks.',
}, },
{
displayName: 'Updated Since',
name: 'updated_since',
type: 'dateTime',
default: '',
description: 'Only return tasks belonging to the task with the given ID.',
},
{ {
displayName: 'Page', displayName: 'Page',
name: 'page', name: 'page',
@ -117,7 +117,14 @@ export const taskFields = [
}, },
default: 1, default: 1,
description: 'The page number to use in pagination.', description: 'The page number to use in pagination.',
} },
{
displayName: 'Updated Since',
name: 'updated_since',
type: 'dateTime',
default: '',
description: 'Only return tasks belonging to the task with the given ID.',
},
] ]
}, },
@ -135,12 +142,152 @@ export const taskFields = [
operation: [ operation: [
'get', 'get',
], ],
resource: [ resource,
'task',
],
}, },
}, },
description: 'The ID of the task you are retrieving.', description: 'The ID of the task you are retrieving.',
} },
/* -------------------------------------------------------------------------- */
/* task:delete */
/* -------------------------------------------------------------------------- */
{
displayName: 'Task Id',
name: 'id',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: [
'delete',
],
resource,
},
},
description: 'The ID of the task you wan to delete.',
},
/* -------------------------------------------------------------------------- */
/* task:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'Name',
name: 'name',
type: 'string',
displayOptions: {
show: {
operation: [
'create',
],
resource,
},
},
default: '',
required: true,
description: 'The name of the task.',
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
displayOptions: {
show: {
operation: [
'create',
],
resource,
},
},
default: {},
options: [
{
displayName: 'Billable By Default',
name: 'billable_by_default',
type: 'boolean',
default: '',
description: 'Used in determining whether default tasks should be marked billable when creating a new project. Defaults to true.'
},
{
displayName: 'Default Hourly Rate',
name: 'default_hourly_rate',
type: 'string',
default: '0',
description: 'The default hourly rate to use for this task when it is added to a project. Defaults to 0.'
},
{
displayName: 'Is Default',
name: 'is_default',
type: 'boolean',
default: false,
description: 'Whether this task should be automatically added to future projects. Defaults to false.'
},
{
displayName: 'Is Active',
name: 'is_active',
type: 'boolean',
default: true,
description: 'Whether this task is active or archived. Defaults to true'
},
],
},
/* -------------------------------------------------------------------------- */
/* task:update */
/* -------------------------------------------------------------------------- */
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Update Field',
displayOptions: {
show: {
operation: [
'update',
],
resource,
},
},
default: {},
options: [
{
displayName: 'Billable By Default',
name: 'billable_by_default',
type: 'boolean',
default: '',
description: 'Used in determining whether default tasks should be marked billable when creating a new project. Defaults to true.'
},
{
displayName: 'Default Hourly Rate',
name: 'default_hourly_rate',
type: 'string',
default: '0',
description: 'The default hourly rate to use for this task when it is added to a project. Defaults to 0.'
},
{
displayName: 'Is Active',
name: 'is_active',
type: 'boolean',
default: true,
description: 'Whether this task is active or archived. Defaults to true'
},
{
displayName: 'Is Default',
name: 'is_default',
type: 'boolean',
default: false,
description: 'Whether this task should be automatically added to future projects. Defaults to false.'
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
description: 'Name of the task.'
},
],
},
] as INodeProperties[]; ] as INodeProperties[];

View file

@ -1,5 +1,5 @@
import { INodeProperties } from "n8n-workflow"; import { INodeProperties } from 'n8n-workflow';
export const resource = [ 'timeEntry' ];
export const timeEntryOperations = [ export const timeEntryOperations = [
{ {
displayName: 'Operation', displayName: 'Operation',
@ -7,9 +7,7 @@ export const timeEntryOperations = [
type: 'options', type: 'options',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'timeEntry',
],
}, },
}, },
options: [ options: [
@ -75,9 +73,7 @@ export const timeEntryFields = [
type: 'boolean', type: 'boolean',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'timeEntry',
],
operation: [ operation: [
'getAll', 'getAll',
], ],
@ -92,9 +88,7 @@ export const timeEntryFields = [
type: 'number', type: 'number',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'timeEntry',
],
operation: [ operation: [
'getAll', 'getAll',
], ],
@ -118,22 +112,13 @@ export const timeEntryFields = [
default: {}, default: {},
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'timeEntry',
],
operation: [ operation: [
'getAll', 'getAll',
], ],
}, },
}, },
options: [ options: [
{
displayName: 'User ID',
name: 'user_id',
type: 'string',
default: '',
description: 'Only return time entries belonging to the user with the given ID.',
},
{ {
displayName: 'Client ID', displayName: 'Client ID',
name: 'client_id', name: 'client_id',
@ -141,6 +126,13 @@ export const timeEntryFields = [
default: '', default: '',
description: 'Only return time entries belonging to the client with the given ID.', description: 'Only return time entries belonging to the client with the given ID.',
}, },
{
displayName: 'From',
name: 'from',
type: 'dateTime',
default: '',
description: 'Only return time entries with a spent_date on or after the given date.',
},
{ {
displayName: 'Is Billed', displayName: 'Is Billed',
name: 'is_billed', name: 'is_billed',
@ -155,20 +147,6 @@ export const timeEntryFields = [
default: true, default: true,
description: 'Pass true to only return running time entries and false to return non-running time entries.', description: 'Pass true to only return running time entries and false to return non-running time entries.',
}, },
{
displayName: 'Updated Since',
name: 'updated_since',
type: 'dateTime',
default: '',
description: 'Only return time entries that have been updated since the given date and time.',
},
{
displayName: 'From',
name: 'from',
type: 'dateTime',
default: '',
description: 'Only return time entries with a spent_date on or after the given date.',
},
{ {
displayName: 'To', displayName: 'To',
name: 'to', name: 'to',
@ -176,6 +154,13 @@ export const timeEntryFields = [
default: '', default: '',
description: 'Only return time entries with a spent_date on or before the given date.', description: 'Only return time entries with a spent_date on or before the given date.',
}, },
{
displayName: 'Updated Since',
name: 'updated_since',
type: 'dateTime',
default: '',
description: 'Only return time entries that have been updated since the given date and time.',
},
{ {
displayName: 'Page', displayName: 'Page',
name: 'page', name: 'page',
@ -185,8 +170,15 @@ export const timeEntryFields = [
}, },
default: 1, default: 1,
description: 'The page number to use in pagination. For instance, if you make a list request and receive 100 records, your subsequent call can include page=2 to retrieve the next page of the list. (Default: 1)', description: 'The page number to use in pagination. For instance, if you make a list request and receive 100 records, your subsequent call can include page=2 to retrieve the next page of the list. (Default: 1)',
} },
] {
displayName: 'User ID',
name: 'user_id',
type: 'string',
default: '',
description: 'Only return time entries belonging to the user with the given ID.',
},
],
}, },
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
@ -203,9 +195,7 @@ export const timeEntryFields = [
operation: [ operation: [
'get', 'get',
], ],
resource: [ resource,
'timeEntry',
],
}, },
}, },
description: 'The ID of the time entry you are retrieving.', description: 'The ID of the time entry you are retrieving.',
@ -225,9 +215,7 @@ export const timeEntryFields = [
operation: [ operation: [
'delete', 'delete',
], ],
resource: [ resource,
'timeEntry',
],
}, },
}, },
description: 'The ID of the time entry you are deleting.', description: 'The ID of the time entry you are deleting.',
@ -247,9 +235,7 @@ export const timeEntryFields = [
operation: [ operation: [
'deleteExternal', 'deleteExternal',
], ],
resource: [ resource,
'timeEntry',
],
}, },
}, },
description: 'The ID of the time entry whose external reference you are deleting.', description: 'The ID of the time entry whose external reference you are deleting.',
@ -269,9 +255,7 @@ export const timeEntryFields = [
operation: [ operation: [
'stopTime', 'stopTime',
], ],
resource: [ resource,
'timeEntry',
],
}, },
}, },
description: 'Stop a running time entry. Stopping a time entry is only possible if its currently running.', description: 'Stop a running time entry. Stopping a time entry is only possible if its currently running.',
@ -291,9 +275,7 @@ export const timeEntryFields = [
operation: [ operation: [
'restartTime', 'restartTime',
], ],
resource: [ resource,
'timeEntry',
],
}, },
}, },
description: 'Restart a stopped time entry. Restarting a time entry is only possible if it isnt currently running.', description: 'Restart a stopped time entry. Restarting a time entry is only possible if it isnt currently running.',
@ -313,9 +295,7 @@ export const timeEntryFields = [
operation: [ operation: [
'update', 'update',
], ],
resource: [ resource,
'timeEntry',
],
}, },
}, },
description: 'The ID of the time entry to update.', description: 'The ID of the time entry to update.',
@ -330,9 +310,7 @@ export const timeEntryFields = [
operation: [ operation: [
'update', 'update',
], ],
resource: [ resource,
'timeEntry',
],
}, },
}, },
default: {}, default: {},
@ -385,9 +363,7 @@ export const timeEntryFields = [
operation: [ operation: [
'createByDuration', 'createByDuration',
], ],
resource: [ resource,
'timeEntry',
],
}, },
}, },
default: '', default: '',
@ -403,9 +379,7 @@ export const timeEntryFields = [
operation: [ operation: [
'createByDuration', 'createByDuration',
], ],
resource: [ resource,
'timeEntry',
],
}, },
}, },
default: '', default: '',
@ -421,9 +395,7 @@ export const timeEntryFields = [
operation: [ operation: [
'createByDuration', 'createByDuration',
], ],
resource: [ resource,
'timeEntry',
],
}, },
}, },
default: '', default: '',
@ -440,9 +412,7 @@ export const timeEntryFields = [
operation: [ operation: [
'createByDuration', 'createByDuration',
], ],
resource: [ resource,
'timeEntry',
],
}, },
}, },
default: {}, default: {},
@ -486,9 +456,7 @@ export const timeEntryFields = [
operation: [ operation: [
'createByStartEnd', 'createByStartEnd',
], ],
resource: [ resource,
'timeEntry',
],
}, },
}, },
default: '', default: '',
@ -504,9 +472,7 @@ export const timeEntryFields = [
operation: [ operation: [
'createByStartEnd', 'createByStartEnd',
], ],
resource: [ resource,
'timeEntry',
],
}, },
}, },
default: '', default: '',
@ -522,9 +488,7 @@ export const timeEntryFields = [
operation: [ operation: [
'createByStartEnd', 'createByStartEnd',
], ],
resource: [ resource,
'timeEntry',
],
}, },
}, },
default: '', default: '',
@ -541,9 +505,7 @@ export const timeEntryFields = [
operation: [ operation: [
'createByStartEnd', 'createByStartEnd',
], ],
resource: [ resource,
'timeEntry',
],
}, },
}, },
default: {}, default: {},

View file

@ -1,4 +1,6 @@
import { INodeProperties } from "n8n-workflow"; import { INodeProperties } from 'n8n-workflow';
const resource = ['user'];
export const userOperations = [ export const userOperations = [
{ {
@ -7,16 +9,19 @@ export const userOperations = [
type: 'options', type: 'options',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'user',
],
}, },
}, },
options: [ options: [
{ {
name: 'Me', name: 'Create',
value: 'me', value: 'create',
description: 'Get data of authenticated user', description: `Create a user`,
},
{
name: 'Delete',
value: 'delete',
description: `Delete a user`,
}, },
{ {
name: 'Get', name: 'Get',
@ -28,6 +33,17 @@ export const userOperations = [
value: 'getAll', value: 'getAll',
description: 'Get data of all users', description: 'Get data of all users',
}, },
{
name: 'Me',
value: 'me',
description: 'Get data of authenticated user',
},
{
name: 'Update',
value: 'update',
description: `Update a user`,
},
], ],
default: 'me', default: 'me',
description: 'The operation to perform.', description: 'The operation to perform.',
@ -47,9 +63,7 @@ export const userFields = [
type: 'boolean', type: 'boolean',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'user',
],
operation: [ operation: [
'getAll', 'getAll',
], ],
@ -64,9 +78,7 @@ export const userFields = [
type: 'number', type: 'number',
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'user',
],
operation: [ operation: [
'getAll', 'getAll',
], ],
@ -90,9 +102,7 @@ export const userFields = [
default: {}, default: {},
displayOptions: { displayOptions: {
show: { show: {
resource: [ resource,
'user',
],
operation: [ operation: [
'getAll', 'getAll',
], ],
@ -140,12 +150,352 @@ export const userFields = [
operation: [ operation: [
'get', 'get',
], ],
resource: [ resource,
'user',
],
}, },
}, },
description: 'The ID of the user you are retrieving.', description: 'The ID of the user you are retrieving.',
} },
/* -------------------------------------------------------------------------- */
/* user:delete */
/* -------------------------------------------------------------------------- */
{
displayName: 'User Id',
name: 'id',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: [
'delete',
],
resource,
},
},
description: 'The ID of the user you want to delete.',
},
/* -------------------------------------------------------------------------- */
/* user:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'First Name',
name: 'firstName',
type: 'string',
displayOptions: {
show: {
operation: [
'create',
],
resource,
},
},
default: '',
required: true,
description: 'The first name of the user.',
},
{
displayName: 'Last Name',
name: 'lastName',
type: 'string',
displayOptions: {
show: {
operation: [
'create',
],
resource,
},
},
default: '',
required: true,
description: 'The last name of the user.',
},
{
displayName: 'Email',
name: 'email',
type: 'string',
displayOptions: {
show: {
operation: [
'create',
],
resource,
},
},
default: '',
required: true,
description: 'The email of the user.',
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
displayOptions: {
show: {
operation: [
'create',
],
resource,
},
},
default: {},
options: [
{
displayName: 'Can Create Projects',
name: 'can_create_projects',
type: 'boolean',
default: false,
description: 'Whether the user can create projects. Only applicable to Project Managers.'
},
{
displayName: 'Can Create Invoices',
name: 'can_create_invoices',
type: 'boolean',
default: false,
description: 'Whether the user can create invoices. Only applicable to Project Managers.'
},
{
displayName: 'Can See Rates',
name: 'can_see_rates',
type: 'boolean',
default: false,
description: 'Whether the user can see billable rates on projects. Only applicable to Project Managers.'
},
{
displayName: 'Cost Rate',
name: 'cost_rate',
type: 'number',
typeOptions: {
minValue: 0,
},
default: 0,
description: 'The cost rate to use for this user when calculating a projects costs vs billable amount.'
},
{
displayName: 'Default Hourly Rate',
name: 'default_hourly_rate',
type: 'string',
default: '0',
description: 'The billable rate to use for this user when they are added to a project.'
},
{
displayName: 'Has Access To All Future Projects',
name: 'has_access_to_all_future_projects',
type: 'boolean',
default: false,
description: 'Whether the user should be automatically added to future projects.'
},
{
displayName: 'Is Active',
name: 'is_active',
type: 'boolean',
default: true,
description: 'Whether the user is active or archived.'
},
{
displayName: 'Is Admin',
name: 'is_admin',
type: 'boolean',
default: false,
description: 'Whether the user has Admin permissions.'
},
{
displayName: 'Is Contractor',
name: 'is_contractor',
type: 'boolean',
default: false,
description: 'Whether the user is a contractor or an employee.'
},
{
displayName: 'Is Project Manager',
name: 'is_project_manager',
type: 'boolean',
default: false,
description: 'Whether the user has Project Manager permissions.'
},
{
displayName: 'Roles',
name: 'roles',
type: 'string',
default: '',
description: 'The role names assigned to this person.'
},
{
displayName: 'Timezone',
name: 'timezone',
type: 'string',
default: '',
description: 'The users timezone. Defaults to the companys timezone. See a list of <a href="/api-v2/introduction/overview/supported-timezones/">supported time zones</a>.'
},
{
displayName: 'Weekly Capacity',
name: 'weekly_capacity',
type: 'number',
typeOptions: {
minValue: 0,
},
default: 126000,
description: 'The number of hours per week this person is available to work in seconds. Defaults to <code class="language-plaintext highlighter-rouge">126000</code> seconds (35 hours).'
},
],
},
/* -------------------------------------------------------------------------- */
/* user:update */
/* -------------------------------------------------------------------------- */
{
displayName: 'Time Entry Id',
name: 'id',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: [
'update',
],
resource,
},
},
description: 'The ID of the time entry to update.',
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
displayOptions: {
show: {
operation: [
'update',
],
resource
},
},
default: {},
options: [
{
displayName: 'Can Create Projects',
name: 'can_create_projects',
type: 'boolean',
default: false,
description: 'Whether the user can create projects. Only applicable to Project Managers.'
},
{
displayName: 'Can Create Invoices',
name: 'can_create_invoices',
type: 'boolean',
default: false,
description: 'Whether the user can create invoices. Only applicable to Project Managers.'
},
{
displayName: 'Can See Rates',
name: 'can_see_rates',
type: 'boolean',
default: false,
description: 'Whether the user can see billable rates on projects. Only applicable to Project Managers.'
},
{
displayName: 'Cost Rate',
name: 'cost_rate',
type: 'number',
typeOptions: {
minValue: 0,
},
default: 0,
description: 'The cost rate to use for this user when calculating a projects costs vs billable amount.'
},
{
displayName: 'Default Hourly Rate',
name: 'default_hourly_rate',
type: 'string',
default: '0',
description: 'The billable rate to use for this user when they are added to a project.'
},
{
displayName: 'Email',
name: 'email',
type: 'string',
default: '',
description: 'The user email'
},
{
displayName: 'First Name',
name: 'first_name',
type: 'string',
default: '',
description: 'The user first name'
},
{
displayName: 'Has Access To All Future Projects',
name: 'has_access_to_all_future_projects',
type: 'boolean',
default: false,
description: 'Whether the user should be automatically added to future projects.'
},
{
displayName: 'Is Active',
name: 'is_active',
type: 'boolean',
default: true,
description: 'Whether the user is active or archived.'
},
{
displayName: 'Is Admin',
name: 'is_admin',
type: 'boolean',
default: false,
description: 'Whether the user has Admin permissions.'
},
{
displayName: 'Is Contractor',
name: 'is_contractor',
type: 'boolean',
default: false,
description: 'Whether the user is a contractor or an employee.'
},
{
displayName: 'Is Project Manager',
name: 'is_project_manager',
type: 'boolean',
default: false,
description: 'Whether the user has Project Manager permissions.'
},
{
displayName: 'Last Name',
name: 'last_name',
type: 'string',
default: '',
description: 'The user last name'
},
{
displayName: 'Roles',
name: 'roles',
type: 'string',
default: '',
description: 'The role names assigned to this person.'
},
{
displayName: 'Timezone',
name: 'timezone',
type: 'string',
default: '',
description: 'The users timezone. Defaults to the companys timezone. See a list of <a href="/api-v2/introduction/overview/supported-timezones/">supported time zones</a>.'
},
{
displayName: 'Weekly Capacity',
name: 'weekly_capacity',
type: 'number',
typeOptions: {
minValue: 0,
},
default: 126000,
description: 'The number of hours per week this person is available to work in seconds. Defaults to <code class="language-plaintext highlighter-rouge">126000</code> seconds (35 hours).'
},
],
},
] as INodeProperties[]; ] as INodeProperties[];