Fix and revert changes on Harvest-Node to not break for existing

users
This commit is contained in:
Jan Oberhauser 2020-02-07 20:38:13 -08:00
parent 19301d8004
commit 101df5882d
11 changed files with 879 additions and 837 deletions

View file

@ -1,6 +1,6 @@
import { INodeProperties } from "n8n-workflow";
import { INodeProperties } from 'n8n-workflow';
const resource = ['clients'];
const resource = ['client'];
export const clientOperations = [
{
@ -13,6 +13,16 @@ export const clientOperations = [
},
},
options: [
{
name: 'Create',
value: 'create',
description: `Create a client`,
},
{
name: 'Delete',
value: 'delete',
description: `Delete a client`,
},
{
name: 'Get',
value: 'get',
@ -23,21 +33,12 @@ export const clientOperations = [
value: 'getAll',
description: 'Get data of all clients',
},
{
name: 'Create',
value: 'create',
description: `Create a client`,
},
{
name: 'Update',
value: 'update',
description: `Update a client`,
},
{
name: 'Delete',
value: 'delete',
description: `Delete a client`,
},
],
default: 'getAll',
description: 'The operation to perform.',
@ -252,20 +253,6 @@ export const clientFields = [
},
default: {},
options: [
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
description: 'Whether the client is active, or archived. Defaults to true.'
},
{
displayName: 'Is Active',
name: 'is_active',
type: 'string',
default: '',
description: 'Whether the client is active, or archived. Defaults to true.'
},
{
displayName: 'Address',
name: 'address',
@ -280,6 +267,20 @@ export const clientFields = [
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.'
},
],
},

View file

@ -1,6 +1,6 @@
import { INodeProperties } from "n8n-workflow";
import { INodeProperties } from 'n8n-workflow';
const resource = [ 'companies' ];
const resource = [ 'company' ];
export const companyOperations = [
{

View file

@ -1,6 +1,6 @@
import { INodeProperties } from "n8n-workflow";
import { INodeProperties } from 'n8n-workflow';
const resource = ['contacts'];
const resource = ['contact'];
export const contactOperations = [
{
@ -13,6 +13,16 @@ export const contactOperations = [
},
},
options: [
{
name: 'Create',
value: 'create',
description: `Create a contact`,
},
{
name: 'Delete',
value: 'delete',
description: `Delete a contact`,
},
{
name: 'Get',
value: 'get',
@ -23,21 +33,11 @@ export const contactOperations = [
value: 'getAll',
description: 'Get data of all contacts',
},
{
name: 'Create',
value: 'create',
description: `Create a contact`,
},
{
name: 'Update',
value: 'update',
description: `Update a contact`,
},
{
name: 'Delete',
value: 'delete',
description: `Delete a contact`,
},
],
default: 'getAll',
description: 'The operation to perform.',
@ -107,7 +107,7 @@ export const contactFields = [
displayName: 'Is Active',
name: 'is_active',
type: 'boolean',
default: '',
default: true,
description: 'Pass true to only return active clients and false to return inactive clients.',
},
{
@ -164,8 +164,8 @@ export const contactFields = [
/* contact:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'First name',
name: 'first_name',
displayName: 'First Name',
name: 'firstName',
type: 'string',
displayOptions: {
show: {
@ -181,7 +181,7 @@ export const contactFields = [
},
{
displayName: 'Client Id',
name: 'client_id',
name: 'clientId',
type: 'string',
displayOptions: {
show: {
@ -297,7 +297,7 @@ export const contactFields = [
description: 'The ID of the client associated with this contact.',
},
{
displayName: 'First name',
displayName: 'First Name',
name: 'first_name',
type: 'string',
default: '',

View file

@ -1,6 +1,6 @@
import { INodeProperties } from "n8n-workflow";
import { INodeProperties } from 'n8n-workflow';
const resource = [ 'estimates' ];
const resource = [ 'estimate' ];
export const estimateOperations = [
{
@ -13,6 +13,16 @@ export const estimateOperations = [
},
},
options: [
{
name: 'Create',
value: 'create',
description: `Create a estimate`,
},
{
name: 'Delete',
value: 'delete',
description: `Delete an estimate`,
},
{
name: 'Get',
value: 'get',
@ -23,21 +33,11 @@ export const estimateOperations = [
value: 'getAll',
description: 'Get data of all estimates',
},
{
name: 'Create',
value: 'create',
description: `Create a estimate`,
},
{
name: 'Update',
value: 'update',
description: `Update a estimate`,
},
{
name: 'Delete',
value: 'delete',
description: `Delete an estimate`,
},
],
default: 'getAll',
description: 'The operation to perform.',
@ -110,13 +110,6 @@ export const estimateFields = [
default: '',
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',
name: 'from',
@ -124,6 +117,13 @@ export const estimateFields = [
default: '',
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',
name: 'to',
@ -132,11 +132,11 @@ export const estimateFields = [
description: 'Only return time entries with a spent_date on or before the given date.',
},
{
displayName: 'State',
name: 'state',
type: 'string',
displayName: 'Updated Since',
name: 'updated_since',
type: 'dateTime',
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',
@ -196,7 +196,7 @@ export const estimateFields = [
/* -------------------------------------------------------------------------- */
{
displayName: 'Client Id',
name: 'client_id',
name: 'clientId',
type: 'string',
displayOptions: {
show: {
@ -225,6 +225,34 @@ export const estimateFields = [
},
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',
@ -239,6 +267,13 @@ export const estimateFields = [
default: '',
description: 'The purchase order number.'
},
{
displayName: 'Subject',
name: 'subject',
type: 'string',
default: '',
description: 'The estimate subject.'
},
{
displayName: 'Tax',
name: 'tax',
@ -253,42 +288,6 @@ export const estimateFields = [
default: '',
description: 'This percentage is applied to the subtotal, including line items and discounts. Example: use 10.0 for 10.0%.'
},
{
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: 'Subject',
name: 'subject',
type: 'string',
default: '',
description: 'The estimate subject.'
},
{
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: 'Notes',
name: 'notes',
type: 'string',
default: '',
description: 'Any additional notes to include on the estimate.'
},
{
displayName: 'Issue Date',
name: 'issue_date',
type: 'dateTime',
default: '',
description: 'Date the invoice was issued. Defaults to todays date.'
},
],
},
@ -333,6 +332,27 @@ export const estimateFields = [
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',
@ -340,6 +360,13 @@ export const estimateFields = [
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',
@ -347,6 +374,13 @@ export const estimateFields = [
default: '',
description: 'The purchase order number.'
},
{
displayName: 'Subject',
name: 'subject',
type: 'string',
default: '',
description: 'The estimate subject.'
},
{
displayName: 'Tax',
name: 'tax',
@ -361,42 +395,6 @@ export const estimateFields = [
default: '',
description: 'This percentage is applied to the subtotal, including line items and discounts. Example: use 10.0 for 10.0%.'
},
{
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: 'Subject',
name: 'subject',
type: 'string',
default: '',
description: 'The estimate subject.'
},
{
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: 'Notes',
name: 'notes',
type: 'string',
default: '',
description: 'Any additional notes to include on the estimate.'
},
{
displayName: 'Issue Date',
name: 'issue_date',
type: 'dateTime',
default: '',
description: 'Date the invoice was issued. Defaults to todays date.'
},
],
},

View file

@ -1,6 +1,6 @@
import { INodeProperties } from "n8n-workflow";
import { INodeProperties } from 'n8n-workflow';
const resource = [ 'expenses' ];
const resource = [ 'expense' ];
export const expenseOperations = [
{
@ -103,13 +103,6 @@ export const expenseFields = [
},
},
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',
name: 'client_id',
@ -117,27 +110,6 @@ export const expenseFields = [
default: '',
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',
name: 'from',
@ -146,11 +118,11 @@ export const expenseFields = [
description: 'Only return time entries with a spent_date on or after the given date.',
},
{
displayName: 'To',
name: 'to',
type: 'dateTime',
default: '',
description: 'Only return time entries with a spent_date on or before the given date.',
displayName: 'Is Billed',
name: 'is_billed',
type: 'boolean',
default: false,
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',
@ -161,7 +133,35 @@ export const expenseFields = [
},
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.',
},
]
},
@ -210,7 +210,7 @@ export const expenseFields = [
/* -------------------------------------------------------------------------- */
{
displayName: 'Project Id',
name: 'project_id',
name: 'projectId',
type: 'string',
displayOptions: {
show: {
@ -226,7 +226,7 @@ export const expenseFields = [
},
{
displayName: 'Expense Category Id',
name: 'expense_category_id',
name: 'expenseCategoryId',
type: 'string',
displayOptions: {
show: {
@ -242,7 +242,7 @@ export const expenseFields = [
},
{
displayName: 'Spent Date',
name: 'spent_date',
name: 'spentDate',
type: 'dateTime',
displayOptions: {
show: {
@ -271,32 +271,11 @@ export const expenseFields = [
},
default: {},
options: [
{
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.'
},
{
displayName: 'Units',
name: 'units',
type: 'string',
default: '',
description: 'The quantity of units to use in calculating the total_cost of the expense.'
},
{
displayName: 'Total Cost',
name: 'total_cost',
type: 'string',
default: '',
description: 'The total amount of the expense.'
},
{
displayName: 'Billable',
name: 'billable',
type: 'string',
default: '',
type: 'boolean',
default: true,
description: 'Whether this expense is billable or not. Defaults to true.'
},
{
@ -306,7 +285,27 @@ export const expenseFields = [
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.'
},
],
},
@ -345,11 +344,11 @@ export const expenseFields = [
default: {},
options: [
{
displayName: 'Project Id',
name: 'project_id',
type: 'string',
default: '',
description: 'The ID of the project associated with this expense.',
displayName: 'Billable',
name: 'billable',
type: 'boolean',
default: true,
description: 'Whether this expense is billable or not. Defaults to true.'
},
{
displayName: 'Expense Category Id',
@ -358,6 +357,20 @@ export const expenseFields = [
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',
@ -365,20 +378,6 @@ export const expenseFields = [
default: '',
description: 'Date the expense occurred.',
},
{
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.'
},
{
displayName: 'Units',
name: 'units',
type: 'string',
default: '',
description: 'The quantity of units to use in calculating the total_cost of the expense.'
},
{
displayName: 'Total Cost',
name: 'total_cost',
@ -387,20 +386,19 @@ export const expenseFields = [
description: 'The total amount of the expense.'
},
{
displayName: 'Billable',
name: 'billable',
displayName: 'Units',
name: 'units',
type: 'string',
default: '',
description: 'Whether this expense is billable or not. Defaults to true.'
description: 'The quantity of units to use in calculating the total_cost of the expense.'
},
{
displayName: 'Notes',
name: 'notes',
type: 'string',
default: '',
description: 'Notes about 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.'
},
],
},

View file

@ -8,17 +8,17 @@ import {
INodeType,
} from 'n8n-workflow';
import { harvestApiRequest, harvestApiRequestAllItems } from './GenericFunctions';
import { timeEntryOperations, timeEntryFields } from './TimeEntryDescription';
import { clientOperations, clientFields } from './ClientDescription';
import { companyOperations } from './CompanyDescription';
import { contactOperations, contactFields } from './ContactDescription';
import { companyOperations } from './CompanyDescription';
import { estimateOperations, estimateFields } from './EstimateDescription';
import { expenseOperations, expenseFields } from './ExpenseDescription';
import { harvestApiRequest, harvestApiRequestAllItems } from './GenericFunctions';
import { invoiceOperations, invoiceFields } from './InvoiceDescription';
import { projectOperations, projectFields } from './ProjectDescription';
import { taskOperations, taskFields } from './TaskDescription';
import { timeEntryOperations, timeEntryFields } from './TimeEntryDescription';
import { userOperations, userFields } from './UserDescription';
import { estimateOperations, estimateFields } from './EstimateDescription';
/**
* fetch All resource using paginated calls
@ -75,46 +75,46 @@ export class Harvest implements INodeType {
{
name: 'Client',
value: 'clients',
value: 'client',
},
{
name: 'Company',
value: 'companies',
value: 'company',
},
{
name: 'Contact',
value: 'contacts',
value: 'contact',
},
{
name: 'Estimates',
value: 'estimates',
name: 'Estimate',
value: 'estimate',
},
{
name: 'Expense',
value: 'expenses',
value: 'expense',
},
{
name: 'Invoice',
value: 'invoices',
value: 'invoice',
},
{
name: 'Project',
value: 'projects',
value: 'project',
},
{
name: 'Task',
value: 'tasks',
value: 'task',
},
{
name: 'Time Entries',
value: 'time_entries',
value: 'timeEntry',
},
{
name: 'User',
value: 'users',
value: 'user',
},
],
default: 'tasks',
default: 'task',
description: 'The resource to operate on.',
},
@ -147,7 +147,6 @@ export class Harvest implements INodeType {
const items = this.getInputData();
const returnData: IDataObject[] = [];
const resource = this.getNodeParameter('resource', 0) as string;
const operation = this.getNodeParameter('operation', 0) as string;
@ -156,12 +155,11 @@ export class Harvest implements INodeType {
let body: IDataObject | Buffer;
let qs: IDataObject;
for (let i = 0; i < items.length; i++) {
body = {};
qs = {};
if (resource === 'time_entries') {
if (resource === 'timeEntry') {
if (operation === 'get') {
// ----------------------------------
// get
@ -170,7 +168,7 @@ export class Harvest implements INodeType {
requestMethod = 'GET';
const id = this.getNodeParameter('id', i) as string;
endpoint = `${resource}/${id}`;
endpoint = `time_entries/${id}`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData);
@ -179,7 +177,7 @@ export class Harvest implements INodeType {
// ----------------------------------
// getAll
// ----------------------------------
const responseData: IDataObject[] = await getAllResource.call(this, resource, i);
const responseData: IDataObject[] = await getAllResource.call(this, 'time_entries', i);
returnData.push.apply(returnData, responseData);
} else if (operation === 'createByStartEnd') {
@ -188,7 +186,7 @@ export class Harvest implements INodeType {
// ----------------------------------
requestMethod = 'POST';
endpoint = resource;
endpoint = 'time_entries';
body.project_id = this.getNodeParameter('projectId', i) as string;
body.task_id = this.getNodeParameter('taskId', i) as string;
@ -206,7 +204,7 @@ export class Harvest implements INodeType {
// ----------------------------------
requestMethod = 'POST';
endpoint = resource;
endpoint = 'time_entries';
body.project_id = this.getNodeParameter('projectId', i) as string;
body.task_id = this.getNodeParameter('taskId', i) as string;
@ -225,7 +223,7 @@ export class Harvest implements INodeType {
requestMethod = 'DELETE';
const id = this.getNodeParameter('id', i) as string;
endpoint = `${resource}/${id}`;
endpoint = `time_entries/${id}`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData);
@ -236,7 +234,7 @@ export class Harvest implements INodeType {
requestMethod = 'DELETE';
const id = this.getNodeParameter('id', i) as string;
endpoint = `${resource}/${id}/external_reference`;
endpoint = `time_entries/${id}/external_reference`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData);
@ -248,7 +246,7 @@ export class Harvest implements INodeType {
requestMethod = 'PATCH';
const id = this.getNodeParameter('id', i) as string;
endpoint = `${resource}/${id}/restart`;
endpoint = `time_entries/${id}/restart`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData);
@ -260,7 +258,7 @@ export class Harvest implements INodeType {
requestMethod = 'PATCH';
const id = this.getNodeParameter('id', i) as string;
endpoint = `${resource}/${id}/stop`;
endpoint = `time_entries/${id}/stop`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData);
@ -272,7 +270,7 @@ export class Harvest implements INodeType {
requestMethod = 'PATCH';
const id = this.getNodeParameter('id', i) as string;
endpoint = `${resource}/${id}`;
endpoint = `time_entries/${id}`;
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
@ -284,7 +282,7 @@ export class Harvest implements INodeType {
throw new Error(`The operation "${operation}" is not known!`);
}
} else if (resource === 'clients') {
} else if (resource === 'client') {
if (operation === 'get') {
// ----------------------------------
// get
@ -293,7 +291,7 @@ export class Harvest implements INodeType {
requestMethod = 'GET';
const id = this.getNodeParameter('id', i) as string;
endpoint = `${resource}/${id}`;
endpoint = `clients/${id}`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData);
@ -303,7 +301,7 @@ export class Harvest implements INodeType {
// getAll
// ----------------------------------
const responseData: IDataObject[] = await getAllResource.call(this, resource, i);
const responseData: IDataObject[] = await getAllResource.call(this, 'clients', i);
returnData.push.apply(returnData, responseData);
} else if (operation === 'create') {
@ -312,7 +310,7 @@ export class Harvest implements INodeType {
// ----------------------------------
requestMethod = 'POST';
endpoint = resource;
endpoint = 'clients';
body.name = this.getNodeParameter('name', i) as string;
@ -329,7 +327,7 @@ export class Harvest implements INodeType {
requestMethod = 'PATCH';
const id = this.getNodeParameter('id', i) as string;
endpoint = `${resource}/${id}`;
endpoint = `clients/${id}`;
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
Object.assign(qs, updateFields);
@ -344,14 +342,14 @@ export class Harvest implements INodeType {
requestMethod = 'DELETE';
const id = this.getNodeParameter('id', i) as string;
endpoint = `${resource}/${id}`;
endpoint = `clients/${id}`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData);
} else {
throw new Error(`The resource "${resource}" is not known!`);
}
} else if (resource === 'projects') {
} else if (resource === 'project') {
if (operation === 'get') {
// ----------------------------------
// get
@ -360,7 +358,7 @@ export class Harvest implements INodeType {
requestMethod = 'GET';
const id = this.getNodeParameter('id', i) as string;
endpoint = `${resource}/${id}`;
endpoint = `projects/${id}`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData);
@ -370,7 +368,7 @@ export class Harvest implements INodeType {
// getAll
// ----------------------------------
const responseData: IDataObject[] = await getAllResource.call(this, resource, i);
const responseData: IDataObject[] = await getAllResource.call(this, 'projects', i);
returnData.push.apply(returnData, responseData);
} else if (operation === 'create') {
@ -379,13 +377,13 @@ export class Harvest implements INodeType {
// ----------------------------------
requestMethod = 'POST';
endpoint = resource;
endpoint = 'projects';
body.client_id = this.getNodeParameter('client_id', i) as string;
body.client_id = this.getNodeParameter('clientId', i) as string;
body.name = this.getNodeParameter('name', i) as string;
body.is_billable = this.getNodeParameter('is_billable', i) as string;
body.bill_by = this.getNodeParameter('bill_by', i) as string;
body.budget_by = this.getNodeParameter('budget_by', 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);
@ -400,7 +398,7 @@ export class Harvest implements INodeType {
requestMethod = 'PATCH';
const id = this.getNodeParameter('id', i) as string;
endpoint = `${resource}/${id}`;
endpoint = `projects/${id}`;
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
@ -415,14 +413,14 @@ export class Harvest implements INodeType {
requestMethod = 'DELETE';
const id = this.getNodeParameter('id', i) as string;
endpoint = `${resource}/${id}`;
endpoint = `projects/${id}`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData);
} else {
throw new Error(`The resource "${resource}" is not known!`);
}
} else if (resource === 'users') {
} else if (resource === 'user') {
if (operation === 'get') {
// ----------------------------------
// get
@ -431,7 +429,7 @@ export class Harvest implements INodeType {
requestMethod = 'GET';
const id = this.getNodeParameter('id', i) as string;
endpoint = `${resource}/${id}`;
endpoint = `users/${id}`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData);
@ -441,7 +439,7 @@ export class Harvest implements INodeType {
// getAll
// ----------------------------------
const responseData: IDataObject[] = await getAllResource.call(this, resource, i);
const responseData: IDataObject[] = await getAllResource.call(this, 'users', i);
returnData.push.apply(returnData, responseData);
} else if (operation === 'me') {
@ -451,24 +449,23 @@ export class Harvest implements INodeType {
requestMethod = 'GET';
endpoint = `${resource}/me`;
endpoint = `users/me`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData);
} else if (operation === 'create') {
// ----------------------------------
// createByDuration
// create
// ----------------------------------
requestMethod = 'POST';
endpoint = resource;
endpoint = 'users';
body.first_name = this.getNodeParameter('first_name', i) as string;
body.last_name = this.getNodeParameter('last_name', i) as string;
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);
@ -482,7 +479,7 @@ export class Harvest implements INodeType {
requestMethod = 'PATCH';
const id = this.getNodeParameter('id', i) as string;
endpoint = `${resource}/${id}`;
endpoint = `users/${id}`;
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
Object.assign(qs, updateFields);
@ -497,14 +494,14 @@ export class Harvest implements INodeType {
requestMethod = 'DELETE';
const id = this.getNodeParameter('id', i) as string;
endpoint = `${resource}/${id}`;
endpoint = `users/${id}`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData);
} else {
throw new Error(`The resource "${resource}" is not known!`);
}
} else if (resource === 'contacts') {
} else if (resource === 'contact') {
if (operation === 'get') {
// ----------------------------------
// get
@ -513,7 +510,7 @@ export class Harvest implements INodeType {
requestMethod = 'GET';
const id = this.getNodeParameter('id', i) as string;
endpoint = `${resource}/${id}`;
endpoint = `contacts/${id}`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData);
@ -523,7 +520,7 @@ export class Harvest implements INodeType {
// getAll
// ----------------------------------
const responseData: IDataObject[] = await getAllResource.call(this, resource, i);
const responseData: IDataObject[] = await getAllResource.call(this, 'contacts', i);
returnData.push.apply(returnData, responseData);
} else if (operation === 'create') {
@ -532,10 +529,10 @@ export class Harvest implements INodeType {
// ----------------------------------
requestMethod = 'POST';
endpoint = resource;
endpoint = 'contacts';
body.client_id = this.getNodeParameter('client_id', i) as string;
body.first_name = this.getNodeParameter('first_name', i) as string;
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);
@ -550,7 +547,7 @@ export class Harvest implements INodeType {
requestMethod = 'PATCH';
const id = this.getNodeParameter('id', i) as string;
endpoint = `${resource}/${id}`;
endpoint = `contacts/${id}`;
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
Object.assign(qs, updateFields);
@ -565,14 +562,14 @@ export class Harvest implements INodeType {
requestMethod = 'DELETE';
const id = this.getNodeParameter('id', i) as string;
endpoint = `${resource}/${id}`;
endpoint = `contacts/${id}`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData);
} else {
throw new Error(`The resource "${resource}" is not known!`);
}
} else if (resource === 'companies') {
} else if (resource === 'company') {
if (operation === 'get') {
// ----------------------------------
// get
@ -587,7 +584,7 @@ export class Harvest implements INodeType {
} else {
throw new Error(`The resource "${resource}" is not known!`);
}
} else if (resource === 'tasks') {
} else if (resource === 'task') {
if (operation === 'get') {
// ----------------------------------
// get
@ -596,7 +593,7 @@ export class Harvest implements INodeType {
requestMethod = 'GET';
const id = this.getNodeParameter('id', i) as string;
endpoint = `${resource}/${id}`;
endpoint = `tasks/${id}`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData);
@ -606,7 +603,7 @@ export class Harvest implements INodeType {
// getAll
// ----------------------------------
const responseData: IDataObject[] = await getAllResource.call(this, resource, i);
const responseData: IDataObject[] = await getAllResource.call(this, 'tasks', i);
returnData.push.apply(returnData, responseData);
} else if (operation === 'delete') {
@ -616,14 +613,14 @@ export class Harvest implements INodeType {
requestMethod = 'DELETE';
const id = this.getNodeParameter('id', i) as string;
endpoint = `${resource}/${id}`;
endpoint = `tasks/${id}`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData);
} else {
throw new Error(`The resource "${resource}" is not known!`);
}
} else if (resource === 'invoices') {
} else if (resource === 'invoice') {
if (operation === 'get') {
// ----------------------------------
// get
@ -632,7 +629,7 @@ export class Harvest implements INodeType {
requestMethod = 'GET';
const id = this.getNodeParameter('id', i) as string;
endpoint = `${resource}/${id}`;
endpoint = `invoices/${id}`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData);
@ -642,7 +639,7 @@ export class Harvest implements INodeType {
// getAll
// ----------------------------------
const responseData: IDataObject[] = await getAllResource.call(this, resource, i);
const responseData: IDataObject[] = await getAllResource.call(this, 'invoices', i);
returnData.push.apply(returnData, responseData);
} else if (operation === 'create') {
@ -651,9 +648,9 @@ export class Harvest implements INodeType {
// ----------------------------------
requestMethod = 'POST';
endpoint = resource;
endpoint = 'invoices';
body.client_id = this.getNodeParameter('client_id', i) as string;
body.client_id = this.getNodeParameter('clientId', i) as string;
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
Object.assign(body, additionalFields);
@ -668,7 +665,7 @@ export class Harvest implements INodeType {
requestMethod = 'PATCH';
const id = this.getNodeParameter('id', i) as string;
endpoint = `${resource}/${id}`;
endpoint = `invoices/${id}`;
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
Object.assign(qs, updateFields);
@ -683,14 +680,14 @@ export class Harvest implements INodeType {
requestMethod = 'DELETE';
const id = this.getNodeParameter('id', i) as string;
endpoint = `${resource}/${id}`;
endpoint = `invoices/${id}`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData);
} else {
throw new Error(`The resource "${resource}" is not known!`);
}
} else if (resource === 'expenses') {
} else if (resource === 'expense') {
if (operation === 'get') {
// ----------------------------------
// get
@ -699,7 +696,7 @@ export class Harvest implements INodeType {
requestMethod = 'GET';
const id = this.getNodeParameter('id', i) as string;
endpoint = `${resource}/${id}`;
endpoint = `expenses/${id}`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData);
@ -709,7 +706,7 @@ export class Harvest implements INodeType {
// getAll
// ----------------------------------
const responseData: IDataObject[] = await getAllResource.call(this, resource, i);
const responseData: IDataObject[] = await getAllResource.call(this, 'expenses', i);
returnData.push.apply(returnData, responseData);
} else if (operation === 'create') {
@ -718,12 +715,11 @@ export class Harvest implements INodeType {
// ----------------------------------
requestMethod = 'POST';
endpoint = resource;
body.project_id = this.getNodeParameter('project_id', i) as string;
body.expense_category_id = this.getNodeParameter('expense_category_id', i) as string;
body.spent_date = this.getNodeParameter('spent_date', i) as string;
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);
@ -738,7 +734,7 @@ export class Harvest implements INodeType {
requestMethod = 'PATCH';
const id = this.getNodeParameter('id', i) as string;
endpoint = `${resource}/${id}`;
endpoint = `expenses/${id}`;
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
Object.assign(qs, updateFields);
@ -753,14 +749,14 @@ export class Harvest implements INodeType {
requestMethod = 'DELETE';
const id = this.getNodeParameter('id', i) as string;
endpoint = `${resource}/${id}`;
endpoint = `expenses/${id}`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData);
} else {
throw new Error(`The resource "${resource}" is not known!`);
}
} else if (resource === 'estimates') {
} else if (resource === 'estimate') {
if (operation === 'get') {
// ----------------------------------
// get
@ -769,7 +765,7 @@ export class Harvest implements INodeType {
requestMethod = 'GET';
const id = this.getNodeParameter('id', i) as string;
endpoint = `${resource}/${id}`;
endpoint = `estimates/${id}`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData);
@ -779,7 +775,7 @@ export class Harvest implements INodeType {
// getAll
// ----------------------------------
const responseData: IDataObject[] = await getAllResource.call(this, resource, i);
const responseData: IDataObject[] = await getAllResource.call(this, 'estimates', i);
returnData.push.apply(returnData, responseData);
} else if (operation === 'create') {
@ -788,9 +784,9 @@ export class Harvest implements INodeType {
// ----------------------------------
requestMethod = 'POST';
endpoint = resource;
endpoint = 'estimates';
body.client_id = this.getNodeParameter('client_id', i) as string;
body.client_id = this.getNodeParameter('clientId', i) as string;
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
Object.assign(body, additionalFields);
@ -805,7 +801,7 @@ export class Harvest implements INodeType {
requestMethod = 'PATCH';
const id = this.getNodeParameter('id', i) as string;
endpoint = `${resource}/${id}`;
endpoint = `estimates/${id}`;
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
Object.assign(qs, updateFields);
@ -820,7 +816,7 @@ export class Harvest implements INodeType {
requestMethod = 'DELETE';
const id = this.getNodeParameter('id', i) as string;
endpoint = `${resource}/${id}`;
endpoint = `estimates/${id}`;
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
returnData.push(responseData);

View file

@ -1,6 +1,6 @@
import { INodeProperties } from "n8n-workflow";
import { INodeProperties } from 'n8n-workflow';
const resource = [ 'invoices' ];
const resource = [ 'invoice' ];
export const invoiceOperations = [
{
@ -221,7 +221,7 @@ export const invoiceFields = [
/* -------------------------------------------------------------------------- */
{
displayName: 'Client Id',
name: 'client_id',
name: 'clientId',
type: 'string',
displayOptions: {
show: {
@ -251,11 +251,25 @@ export const invoiceFields = [
default: {},
options: [
{
displayName: 'Retainer Id',
name: 'retainer_id',
type: 'boolean',
default: true,
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',
@ -264,6 +278,20 @@ export const invoiceFields = [
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',
@ -271,6 +299,13 @@ export const invoiceFields = [
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',
@ -278,6 +313,20 @@ export const invoiceFields = [
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',
@ -292,56 +341,6 @@ export const invoiceFields = [
default: '',
description: 'This percentage is applied to the subtotal, including line items and discounts. Example: use 10.0 for 10.0%.'
},
{
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: 'Subject',
name: 'subject',
type: 'string',
default: '',
description: 'The invoice subject.'
},
{
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: '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: 'Notes',
name: 'notes',
type: 'string',
default: '',
description: 'Notes about the project.'
},
{
displayName: 'Issue Date',
name: 'issue_date',
type: 'dateTime',
default: '',
description: 'Date the invoice was issued. Defaults to todays date.'
},
{
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.'
},
],
},
@ -387,11 +386,25 @@ export const invoiceFields = [
description: 'The ID of the retainer associated with this invoice..',
},
{
displayName: 'Retainer Id',
name: 'retainer_id',
type: 'boolean',
default: true,
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',
@ -400,6 +413,20 @@ export const invoiceFields = [
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',
@ -407,6 +434,13 @@ export const invoiceFields = [
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',
@ -414,6 +448,20 @@ export const invoiceFields = [
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',
@ -428,56 +476,6 @@ export const invoiceFields = [
default: '',
description: 'This percentage is applied to the subtotal, including line items and discounts. Example: use 10.0 for 10.0%.'
},
{
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: 'Subject',
name: 'subject',
type: 'string',
default: '',
description: 'The invoice subject.'
},
{
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: '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: 'Notes',
name: 'notes',
type: 'string',
default: '',
description: 'Notes about the project.'
},
{
displayName: 'Issue Date',
name: 'issue_date',
type: 'dateTime',
default: '',
description: 'Date the invoice was issued. Defaults to todays date.'
},
{
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.'
},
],
},
] as INodeProperties[];

View file

@ -1,6 +1,6 @@
import { INodeProperties } from "n8n-workflow";
import { INodeProperties } from 'n8n-workflow';
const resource = ['projects'];
const resource = ['project'];
export const projectOperations = [
{
@ -13,6 +13,16 @@ export const projectOperations = [
},
},
options: [
{
name: 'Create',
value: 'create',
description: `Create a project`,
},
{
name: 'Delete',
value: 'delete',
description: `Delete a project`,
},
{
name: 'Get',
value: 'get',
@ -23,21 +33,11 @@ export const projectOperations = [
value: 'getAll',
description: 'Get data of all projects',
},
{
name: 'Create',
value: 'create',
description: `Create a project`,
},
{
name: 'Update',
value: 'update',
description: `Update a project`,
},
{
name: 'Delete',
value: 'delete',
description: `Delete a project`,
},
],
default: 'getAll',
description: 'The operation to perform.',
@ -103,13 +103,6 @@ export const projectFields = [
},
},
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',
name: 'client_id',
@ -118,11 +111,11 @@ export const projectFields = [
description: 'Only return projects belonging to the client with the given ID.',
},
{
displayName: 'Updated Since',
name: 'updated_since',
type: 'dateTime',
default: '',
description: 'Only return projects by updated_since.',
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: 'Page',
@ -134,7 +127,13 @@ export const projectFields = [
default: 1,
description: 'The page number to use in pagination.',
},
{
displayName: 'Updated Since',
name: 'updated_since',
type: 'dateTime',
default: '',
description: 'Only return projects by updated_since.',
},
]
},
@ -199,7 +198,7 @@ export const projectFields = [
},
{
displayName: 'Client Id',
name: 'client_id',
name: 'clientId',
type: 'string',
displayOptions: {
show: {
@ -215,8 +214,8 @@ export const projectFields = [
},
{
displayName: 'Is Billable',
name: 'is_billable',
type: 'string',
name: 'isBillable',
type: 'boolean',
displayOptions: {
show: {
operation: [
@ -225,14 +224,14 @@ export const projectFields = [
resource,
},
},
default: '',
default: true,
required: true,
description: 'Whether the project is billable or not.',
},
{
displayName: 'Bill By',
name: 'bill_by',
type: 'string',
name: 'billBy',
type: 'options',
displayOptions: {
show: {
operation: [
@ -241,13 +240,31 @@ export const projectFields = [
resource,
},
},
default: '',
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. Options: Project, Tasks, People, or none.',
description: 'The method by which the project is invoiced.',
},
{
displayName: 'Budget By',
name: 'budget_by',
name: 'budgetBy',
type: 'string',
displayOptions: {
show: {
@ -257,9 +274,10 @@ export const projectFields = [
resource,
},
},
default: '',
default: 'none',
placeholder: '',
required: true,
description: 'The email of the user.',
description: 'The email of the user or "none".',
},
{
displayName: 'Additional Fields',
@ -277,18 +295,49 @@ export const projectFields = [
default: {},
options: [
{
displayName: 'Is Active',
name: 'is_active',
type: 'boolean',
default: true,
description: 'Whether the project is active or archived. Defaults to true'
displayName: 'Budget',
name: 'budget',
type: 'number',
typeOptions: {
minValue: 0,
},
default: 0,
description: 'The budget in hours for the project when budgeting by time.'
},
{
displayName: 'Is Fixed Fee',
name: 'is_fixed_fee',
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: 'Whether the project is a fixed-fee project or not.'
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',
@ -298,24 +347,31 @@ export const projectFields = [
description: 'Rate for projects billed by Project Hourly Rate.'
},
{
displayName: 'Budget',
name: 'budget',
type: 'string',
default: '',
description: 'The budget in hours for the project when budgeting by time.'
displayName: 'Is Active',
name: 'is_active',
type: 'boolean',
default: true,
description: 'Whether the project is active or archived. Defaults to true'
},
{
displayName: 'Budget Is Monthly',
name: 'budget_is_monthly',
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: 'Option to have the budget reset every month. Defaults to false.'
description: 'Notes about the project.'
},
{
displayName: 'Notify When Over Budget',
name: 'notify_when_over_budget',
type: 'string',
default: '',
type: 'boolean',
default: false,
description: 'Whether project managers should be notified when the project goes over budget. Defaults to false.'
},
{
@ -328,38 +384,10 @@ export const projectFields = [
{
displayName: 'Show Budget To All',
name: 'show_budget_to_all',
type: 'string',
default: '',
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: '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: 'string',
default: '',
description: 'Option for budget of Total Project Fees projects to include tracked expenses. Defaults to false.'
},
{
displayName: 'Fee',
name: 'fee',
type: 'string',
default: '',
description: 'The amount you plan to invoice for the project. Only used by fixed-fee projects.'
},
{
displayName: 'Notes',
name: 'notes',
type: 'string',
default: '',
description: 'Notes about the project.'
},
{
displayName: 'Starts On',
name: 'starts_on',
@ -367,14 +395,6 @@ export const projectFields = [
default: '',
description: 'Date the project was started.'
},
{
displayName: 'Ends On',
name: 'ends_on',
type: 'dateTime',
default: '',
description: 'Date the project will end.'
},
],
},
@ -412,61 +432,30 @@ export const projectFields = [
},
default: {},
options: [
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
description: 'The name of the project.',
},
{
displayName: 'Client Id',
name: 'client_id',
type: 'string',
default: '',
description: 'The ID of the client to associate this project with.',
},
{
displayName: 'Is Billable',
name: 'is_billable',
type: 'string',
default: '',
description: 'Whether the project is billable or not.',
},
{
displayName: 'Bill By',
name: 'bill_by',
type: 'string',
default: '',
description: 'The method by which the project is invoiced. Options: Project, Tasks, People, or none.',
},
{
displayName: 'Budget By',
name: 'budget_by',
type: 'string',
default: '',
description: 'The email of the user.',
},
{
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: 'string',
default: '',
description: 'Whether the project is a fixed-fee project or not.'
},
{
displayName: 'Hourly Rate',
name: 'hourly_rate',
type: 'string',
default: '',
description: 'Rate for projects billed by Project Hourly Rate.'
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',
@ -476,17 +465,101 @@ export const projectFields = [
description: 'The budget in hours for the project when budgeting by time.'
},
{
displayName: 'Budget Is Monthly',
name: 'budget_is_monthly',
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: 'string',
default: '',
type: 'boolean',
default: false,
description: 'Whether project managers should be notified when the project goes over budget. Defaults to false.'
},
{
@ -499,38 +572,11 @@ export const projectFields = [
{
displayName: 'Show Budget To All',
name: 'show_budget_to_all',
type: 'string',
default: '',
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: '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: 'string',
default: '',
description: 'Option for budget of Total Project Fees projects to include tracked expenses. Defaults to false.'
},
{
displayName: 'Fee',
name: 'fee',
type: 'string',
default: '',
description: 'The amount you plan to invoice for the project. Only used by fixed-fee projects.'
},
{
displayName: 'Notes',
name: 'notes',
type: 'string',
default: '',
description: 'Notes about the project.'
},
{
displayName: 'Starts On',
name: 'starts_on',
@ -538,16 +584,7 @@ export const projectFields = [
default: '',
description: 'Date the project was started.'
},
{
displayName: 'Ends On',
name: 'ends_on',
type: 'dateTime',
default: '',
description: 'Date the project will end.'
},
],
},
] as INodeProperties[];

View file

@ -1,5 +1,5 @@
import { INodeProperties } from "n8n-workflow";
const resource = ['tasks'];
import { INodeProperties } from 'n8n-workflow';
const resource = ['task'];
export const taskOperations = [
{
displayName: 'Operation',
@ -11,6 +11,16 @@ export const taskOperations = [
},
},
options: [
{
name: 'Create',
value: 'create',
description: `Create a task`,
},
{
name: 'Delete',
value: 'delete',
description: `Delete a task`,
},
{
name: 'Get',
value: 'get',
@ -21,21 +31,11 @@ export const taskOperations = [
value: 'getAll',
description: 'Get data of all tasks',
},
{
name: 'Create',
value: 'create',
description: `Create a task`,
},
{
name: 'Update',
value: 'update',
description: `Update a task`,
},
{
name: 'Delete',
value: 'delete',
description: `Delete a task`,
},
],
default: 'getAll',
description: 'The operation to perform.',
@ -108,13 +108,6 @@ export const taskFields = [
default: true,
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',
name: 'page',
@ -124,7 +117,14 @@ export const taskFields = [
},
default: 1,
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.',
},
]
},
@ -250,13 +250,7 @@ export const taskFields = [
},
default: {},
options: [
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
description: 'Name of the task.'
},
{
displayName: 'Billable By Default',
name: 'billable_by_default',
@ -271,6 +265,13 @@ export const taskFields = [
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',
@ -279,12 +280,12 @@ export const taskFields = [
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'
}
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
description: 'Name of the task.'
},
],
},

View file

@ -1,5 +1,5 @@
import { INodeProperties } from "n8n-workflow";
export const resource = [ 'time_entries' ]
import { INodeProperties } from 'n8n-workflow';
export const resource = [ 'timeEntry' ];
export const timeEntryOperations = [
{
displayName: 'Operation',
@ -119,13 +119,6 @@ export const timeEntryFields = [
},
},
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',
name: 'client_id',
@ -133,6 +126,13 @@ export const timeEntryFields = [
default: '',
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',
name: 'is_billed',
@ -147,20 +147,6 @@ export const timeEntryFields = [
default: true,
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',
name: 'to',
@ -168,6 +154,13 @@ export const timeEntryFields = [
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: 'Page',
name: 'page',
@ -177,8 +170,15 @@ export const timeEntryFields = [
},
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.',
},
],
},
/* -------------------------------------------------------------------------- */

View file

@ -1,6 +1,6 @@
import { INodeProperties } from "n8n-workflow";
import { INodeProperties } from 'n8n-workflow';
const resource = ['users'];
const resource = ['user'];
export const userOperations = [
{
@ -14,9 +14,14 @@ export const userOperations = [
},
options: [
{
name: 'Me',
value: 'me',
description: 'Get data of authenticated user',
name: 'Create',
value: 'create',
description: `Create a user`,
},
{
name: 'Delete',
value: 'delete',
description: `Delete a user`,
},
{
name: 'Get',
@ -28,21 +33,17 @@ export const userOperations = [
value: 'getAll',
description: 'Get data of all users',
},
{
name: 'Create',
value: 'create',
description: `Create a user`,
name: 'Me',
value: 'me',
description: 'Get data of authenticated user',
},
{
name: 'Update',
value: 'update',
description: `Update a user`,
},
{
name: 'Delete',
value: 'delete',
description: `Delete a user`,
},
],
default: 'me',
description: 'The operation to perform.',
@ -180,7 +181,7 @@ export const userFields = [
/* -------------------------------------------------------------------------- */
{
displayName: 'First Name',
name: 'first_name',
name: 'firstName',
type: 'string',
displayOptions: {
show: {
@ -196,7 +197,7 @@ export const userFields = [
},
{
displayName: 'Last Name',
name: 'last_name',
name: 'lastName',
type: 'string',
displayOptions: {
show: {
@ -241,96 +242,102 @@ export const userFields = [
},
default: {},
options: [
{
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>.</td>'
},
{
displayName: 'Has Access To All Future Projects',
name: 'has_access_to_all_future_projects',
type: 'string',
default: '',
description: 'Whether the user should be automatically added to future projects. Defaults to <code class="language-plaintext highlighter-rouge">false</code>.</td>'
},
{
displayName: 'Is Contractor',
name: 'is_contractor',
type: 'string',
default: '',
description: 'Whether the user is a contractor or an employee. Defaults to <code class="language-plaintext highlighter-rouge">false</code>.</td>'
},
{
displayName: 'Is Admin',
name: 'is_admin',
type: 'string',
default: '',
description: 'Whether the user has Admin permissions. Defaults to <code class="language-plaintext highlighter-rouge">false</code>.</td>'
},
{
displayName: 'Is Project Manager',
name: 'is_project_manager',
type: 'string',
default: '',
description: 'Whether the user has Project Manager permissions. Defaults to <code class="language-plaintext highlighter-rouge">false</code>.</td>'
},
{
displayName: 'Can See Rates',
name: 'can_see_rates',
type: 'string',
default: '',
description: 'Whether the user can see billable rates on projects. Only applicable to Project Managers. Defaults to <code class="language-plaintext highlighter-rouge">false</code>.</td>'
},
{
displayName: 'Can Create Projects',
name: 'can_create_projects',
type: 'string',
default: '',
description: 'Whether the user can create projects. Only applicable to Project Managers. Defaults to <code class="language-plaintext highlighter-rouge">false</code>.</td>'
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: 'string',
default: '',
description: 'Whether the user can create invoices. Only applicable to Project Managers. Defaults to <code class="language-plaintext highlighter-rouge">false</code>.</td>'
type: 'boolean',
default: false,
description: 'Whether the user can create invoices. Only applicable to Project Managers.'
},
{
displayName: 'Is Active',
name: 'is_active',
type: 'string',
default: '',
description: 'Whether the user is active or archived. Defaults to <code class="language-plaintext highlighter-rouge">true</code>.</td>'
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: 'Weekly Capacity',
name: 'weekly_capacity',
type: 'string',
default: '',
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).</td>'
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: '',
description: 'The billable rate to use for this user when they are added to a project. Defaults to <code class="language-plaintext highlighter-rouge">0</code>.</td>'
default: '0',
description: 'The billable rate to use for this user when they are added to a project.'
},
{
displayName: 'Cost Rate',
name: 'cost_rate',
type: 'string',
default: '',
description: 'The cost rate to use for this user when calculating a projects costs vs billable amount. Defaults to <code class="language-plaintext highlighter-rouge">0</code>.</td>'
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.</td>'
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).'
},
],
},
@ -371,18 +378,42 @@ export const userFields = [
default: {},
options: [
{
displayName: 'First Name',
name: 'first_name',
type: 'string',
default: '',
description: 'The user first name'
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: 'Last Name',
name: 'last_name',
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: '',
description: 'The user last name'
default: '0',
description: 'The billable rate to use for this user when they are added to a project.'
},
{
displayName: 'Email',
@ -392,95 +423,77 @@ export const userFields = [
description: 'The user email'
},
{
displayName: 'Timezone',
name: 'timezone',
displayName: 'First Name',
name: 'first_name',
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>.</td>'
description: 'The user first name'
},
{
displayName: 'Has Access To All Future Projects',
name: 'has_access_to_all_future_projects',
type: 'string',
default: '',
description: 'Whether the user should be automatically added to future projects. Defaults to <code class="language-plaintext highlighter-rouge">false</code>.</td>'
},
{
displayName: 'Is Contractor',
name: 'is_contractor',
type: 'string',
default: '',
description: 'Whether the user is a contractor or an employee. Defaults to <code class="language-plaintext highlighter-rouge">false</code>.</td>'
},
{
displayName: 'Is Admin',
name: 'is_admin',
type: 'string',
default: '',
description: 'Whether the user has Admin permissions. Defaults to <code class="language-plaintext highlighter-rouge">false</code>.</td>'
},
{
displayName: 'Is Project Manager',
name: 'is_project_manager',
type: 'string',
default: '',
description: 'Whether the user has Project Manager permissions. Defaults to <code class="language-plaintext highlighter-rouge">false</code>.</td>'
},
{
displayName: 'Can See Rates',
name: 'can_see_rates',
type: 'string',
default: '',
description: 'Whether the user can see billable rates on projects. Only applicable to Project Managers. Defaults to <code class="language-plaintext highlighter-rouge">false</code>.</td>'
},
{
displayName: 'Can Create Projects',
name: 'can_create_projects',
type: 'string',
default: '',
description: 'Whether the user can create projects. Only applicable to Project Managers. Defaults to <code class="language-plaintext highlighter-rouge">false</code>.</td>'
},
{
displayName: 'Can Create Invoices',
name: 'can_create_invoices',
type: 'string',
default: '',
description: 'Whether the user can create invoices. Only applicable to Project Managers. Defaults to <code class="language-plaintext highlighter-rouge">false</code>.</td>'
type: 'boolean',
default: false,
description: 'Whether the user should be automatically added to future projects.'
},
{
displayName: 'Is Active',
name: 'is_active',
type: 'string',
default: '',
description: 'Whether the user is active or archived. Defaults to <code class="language-plaintext highlighter-rouge">true</code>.</td>'
type: 'boolean',
default: true,
description: 'Whether the user is active or archived.'
},
{
displayName: 'Weekly Capacity',
name: 'weekly_capacity',
type: 'string',
default: '',
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).</td>'
displayName: 'Is Admin',
name: 'is_admin',
type: 'boolean',
default: false,
description: 'Whether the user has Admin permissions.'
},
{
displayName: 'Default Hourly Rate',
name: 'default_hourly_rate',
type: 'string',
default: '',
description: 'The billable rate to use for this user when they are added to a project. Defaults to <code class="language-plaintext highlighter-rouge">0</code>.</td>'
displayName: 'Is Contractor',
name: 'is_contractor',
type: 'boolean',
default: false,
description: 'Whether the user is a contractor or an employee.'
},
{
displayName: 'Cost Rate',
name: 'cost_rate',
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 cost rate to use for this user when calculating a projects costs vs billable amount. Defaults to <code class="language-plaintext highlighter-rouge">0</code>.</td>'
description: 'The user last name'
},
{
displayName: 'Roles',
name: 'roles',
type: 'string',
default: '',
description: 'The role names assigned to this person.</td>'
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).'
},
],
},