mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 21:37:32 -08:00
Add DELETE for Harvest APIs
This commit is contained in:
parent
481d6d2bc1
commit
8374a23389
|
@ -23,6 +23,11 @@ export const clientOperations = [
|
|||
value: 'getAll',
|
||||
description: 'Get data of all clients',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: `Delete a client`,
|
||||
},
|
||||
],
|
||||
default: 'getAll',
|
||||
description: 'The operation to perform.',
|
||||
|
@ -131,6 +136,28 @@ export const clientFields = [
|
|||
},
|
||||
},
|
||||
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: [
|
||||
'client',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The ID of the client you want to delete.',
|
||||
}
|
||||
|
||||
] as INodeProperties[];
|
||||
|
|
|
@ -23,6 +23,11 @@ export const contactOperations = [
|
|||
value: 'getAll',
|
||||
description: 'Get data of all contacts',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: `Delete a contact`,
|
||||
},
|
||||
],
|
||||
default: 'getAll',
|
||||
description: 'The operation to perform.',
|
||||
|
@ -131,6 +136,28 @@ export const contactFields = [
|
|||
},
|
||||
},
|
||||
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: [
|
||||
'contact',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The ID of the contact you want to delete.',
|
||||
}
|
||||
|
||||
] as INodeProperties[];
|
||||
|
|
|
@ -23,6 +23,11 @@ export const estimateOperations = [
|
|||
value: 'getAll',
|
||||
description: 'Get data of all estimates',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: `Delete an estimate`,
|
||||
},
|
||||
],
|
||||
default: 'getAll',
|
||||
description: 'The operation to perform.',
|
||||
|
@ -162,6 +167,28 @@ export const estimateFields = [
|
|||
},
|
||||
},
|
||||
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: [
|
||||
'estimate',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The ID of the estimate want to delete.',
|
||||
}
|
||||
|
||||
] as INodeProperties[];
|
||||
|
|
|
@ -23,6 +23,11 @@ export const expenseOperations = [
|
|||
value: 'getAll',
|
||||
description: 'Get data of all expenses',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: `Delete an expense`,
|
||||
},
|
||||
],
|
||||
default: 'getAll',
|
||||
description: 'The operation to perform.',
|
||||
|
@ -176,6 +181,28 @@ export const expenseFields = [
|
|||
},
|
||||
},
|
||||
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: [
|
||||
'expense',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The ID of the expense you want to delete.',
|
||||
}
|
||||
|
||||
] as INodeProperties[];
|
||||
|
|
|
@ -306,6 +306,17 @@ export class Harvest implements INodeType {
|
|||
const responseData: IDataObject[] = await getAllResource.call(this, 'clients', i);
|
||||
returnData.push.apply(returnData, 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 {
|
||||
throw new Error(`The resource "${resource}" is not known!`);
|
||||
}
|
||||
|
@ -331,6 +342,17 @@ export class Harvest implements INodeType {
|
|||
const responseData: IDataObject[] = await getAllResource.call(this, 'projects', i);
|
||||
returnData.push.apply(returnData, 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 {
|
||||
throw new Error(`The resource "${resource}" is not known!`);
|
||||
}
|
||||
|
@ -368,7 +390,18 @@ export class Harvest implements INodeType {
|
|||
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
|
||||
returnData.push(responseData);
|
||||
|
||||
} else {
|
||||
} 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 {
|
||||
throw new Error(`The resource "${resource}" is not known!`);
|
||||
}
|
||||
} else if (resource === 'contact') {
|
||||
|
@ -393,7 +426,18 @@ export class Harvest implements INodeType {
|
|||
const responseData: IDataObject[] = await getAllResource.call(this, 'contacts', i);
|
||||
returnData.push.apply(returnData, responseData);
|
||||
|
||||
} else {
|
||||
} 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 {
|
||||
throw new Error(`The resource "${resource}" is not known!`);
|
||||
}
|
||||
} else if (resource === 'company') {
|
||||
|
@ -433,6 +477,17 @@ export class Harvest implements INodeType {
|
|||
const responseData: IDataObject[] = await getAllResource.call(this, 'tasks', i);
|
||||
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 {
|
||||
throw new Error(`The resource "${resource}" is not known!`);
|
||||
}
|
||||
|
@ -458,7 +513,18 @@ export class Harvest implements INodeType {
|
|||
const responseData: IDataObject[] = await getAllResource.call(this, 'invoices', i);
|
||||
returnData.push.apply(returnData, responseData);
|
||||
|
||||
} else {
|
||||
} 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 {
|
||||
throw new Error(`The resource "${resource}" is not known!`);
|
||||
}
|
||||
} else if (resource === 'expense') {
|
||||
|
@ -483,7 +549,18 @@ export class Harvest implements INodeType {
|
|||
const responseData: IDataObject[] = await getAllResource.call(this, 'expenses', i);
|
||||
returnData.push.apply(returnData, responseData);
|
||||
|
||||
} else {
|
||||
} 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 {
|
||||
throw new Error(`The resource "${resource}" is not known!`);
|
||||
}
|
||||
} else if (resource === 'estimate') {
|
||||
|
@ -508,7 +585,18 @@ export class Harvest implements INodeType {
|
|||
const responseData: IDataObject[] = await getAllResource.call(this, 'estimates', i);
|
||||
returnData.push.apply(returnData, responseData);
|
||||
|
||||
} else {
|
||||
} 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 {
|
||||
throw new Error(`The resource "${resource}" is not known!`);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -23,6 +23,11 @@ export const invoiceOperations = [
|
|||
value: 'getAll',
|
||||
description: 'Get data of all invoices',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: `Delete a invoice`,
|
||||
},
|
||||
],
|
||||
default: 'getAll',
|
||||
description: 'The operation to perform.',
|
||||
|
@ -187,6 +192,28 @@ export const invoiceFields = [
|
|||
},
|
||||
},
|
||||
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: [
|
||||
'invoice',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The ID of the invoice want to delete.',
|
||||
}
|
||||
|
||||
] as INodeProperties[];
|
||||
|
|
|
@ -23,6 +23,11 @@ export const projectOperations = [
|
|||
value: 'getAll',
|
||||
description: 'Get data of all projects',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: `Delete a project`,
|
||||
},
|
||||
],
|
||||
default: 'getAll',
|
||||
description: 'The operation to perform.',
|
||||
|
@ -149,6 +154,28 @@ export const projectFields = [
|
|||
},
|
||||
},
|
||||
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: [
|
||||
'project',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The ID of the project want to delete.',
|
||||
}
|
||||
|
||||
] as INodeProperties[];
|
||||
|
|
|
@ -23,6 +23,11 @@ export const taskOperations = [
|
|||
value: 'getAll',
|
||||
description: 'Get data of all tasks',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: `Delete a task`,
|
||||
},
|
||||
],
|
||||
default: 'getAll',
|
||||
description: 'The operation to perform.',
|
||||
|
@ -141,6 +146,29 @@ export const taskFields = [
|
|||
},
|
||||
},
|
||||
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: [
|
||||
'task',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The ID of the task you wan to delete.',
|
||||
},
|
||||
|
||||
|
||||
] as INodeProperties[];
|
||||
|
|
|
@ -28,6 +28,11 @@ export const userOperations = [
|
|||
value: 'getAll',
|
||||
description: 'Get data of all users',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: `Delete a user`,
|
||||
},
|
||||
],
|
||||
default: 'me',
|
||||
description: 'The operation to perform.',
|
||||
|
@ -146,6 +151,28 @@ export const userFields = [
|
|||
},
|
||||
},
|
||||
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: [
|
||||
'user',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The ID of the user you want to delete.',
|
||||
}
|
||||
|
||||
] as INodeProperties[];
|
||||
|
|
Loading…
Reference in a new issue