@trg-admin/n8n-nodes-zoho-desk 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -76,7 +76,7 @@ class ZohoCRMDeskOAuth2Api {
|
|
|
76
76
|
displayName: 'Scope',
|
|
77
77
|
name: 'scope',
|
|
78
78
|
type: 'string',
|
|
79
|
-
default: 'ZohoCRM.modules.ALL Desk.tickets.ALL Desk.contacts.ALL Desk.search.READ',
|
|
79
|
+
default: 'ZohoCRM.modules.ALL Desk.tickets.ALL Desk.contacts.ALL Desk.search.READ Desk.tasks.ALL Desk.basic.READ',
|
|
80
80
|
required: true,
|
|
81
81
|
description: 'Space-separated OAuth scopes. Default includes both CRM and Desk permissions. Add or remove scopes as needed (e.g., Desk.settings.ALL, Desk.tasks.ALL).',
|
|
82
82
|
},
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
1
|
+
import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription, ILoadOptionsFunctions } from 'n8n-workflow';
|
|
2
2
|
export declare class ZohoDesk implements INodeType {
|
|
3
3
|
description: INodeTypeDescription;
|
|
4
|
+
methods: {
|
|
5
|
+
loadOptions: {
|
|
6
|
+
getDepartments(this: ILoadOptionsFunctions): Promise<{
|
|
7
|
+
name: string;
|
|
8
|
+
value: string;
|
|
9
|
+
}[]>;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
4
12
|
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
13
|
}
|
|
@@ -12,7 +12,7 @@ class ZohoDesk {
|
|
|
12
12
|
group: ['transform'],
|
|
13
13
|
version: 1,
|
|
14
14
|
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
15
|
-
description: 'Zoho Desk
|
|
15
|
+
description: 'Zoho Desk node using a custom Zoho CRM & Desk OAuth2 credential for automatic refresh-token handling',
|
|
16
16
|
defaults: {
|
|
17
17
|
name: 'Zoho Desk',
|
|
18
18
|
},
|
|
@@ -120,11 +120,14 @@ class ZohoDesk {
|
|
|
120
120
|
{
|
|
121
121
|
displayName: 'Department ID',
|
|
122
122
|
name: 'departmentId',
|
|
123
|
-
type: '
|
|
123
|
+
type: 'options',
|
|
124
|
+
typeOptions: {
|
|
125
|
+
loadOptionsMethod: 'getDepartments',
|
|
126
|
+
},
|
|
124
127
|
default: '',
|
|
125
128
|
required: true,
|
|
126
|
-
displayOptions: { show: { resource: ['ticket'], operation: ['create'] } },
|
|
127
|
-
description: '
|
|
129
|
+
displayOptions: { show: { resource: ['ticket'], operation: ['create', 'getAll'] } },
|
|
130
|
+
description: 'Department to assign or filter tickets by',
|
|
128
131
|
},
|
|
129
132
|
{
|
|
130
133
|
displayName: 'Description',
|
|
@@ -352,6 +355,23 @@ class ZohoDesk {
|
|
|
352
355
|
},
|
|
353
356
|
],
|
|
354
357
|
};
|
|
358
|
+
this.methods = {
|
|
359
|
+
loadOptions: {
|
|
360
|
+
async getDepartments() {
|
|
361
|
+
const responseData = await GenericFunctions_1.zohoDeskApiRequestAllItems.call(this, 'GET', '/departments', {}, {}, 0);
|
|
362
|
+
return responseData.map((department) => {
|
|
363
|
+
const name = department.name ||
|
|
364
|
+
department.departmentName ||
|
|
365
|
+
department.displayName ||
|
|
366
|
+
String(department.id);
|
|
367
|
+
return {
|
|
368
|
+
name,
|
|
369
|
+
value: department.id,
|
|
370
|
+
};
|
|
371
|
+
});
|
|
372
|
+
},
|
|
373
|
+
},
|
|
374
|
+
};
|
|
355
375
|
}
|
|
356
376
|
async execute() {
|
|
357
377
|
const items = this.getInputData();
|
|
@@ -369,15 +389,16 @@ class ZohoDesk {
|
|
|
369
389
|
}
|
|
370
390
|
if (operation === 'getAll') {
|
|
371
391
|
const returnAll = this.getNodeParameter('returnAll', i, false);
|
|
392
|
+
const departmentId = this.getNodeParameter('departmentId', i);
|
|
372
393
|
if (returnAll) {
|
|
373
|
-
const responseData = await GenericFunctions_1.zohoDeskApiRequestAllItems.call(this, 'GET', '/tickets', {}, {}, i);
|
|
394
|
+
const responseData = await GenericFunctions_1.zohoDeskApiRequestAllItems.call(this, 'GET', '/tickets', {}, { departmentId }, i);
|
|
374
395
|
for (const row of responseData) {
|
|
375
396
|
returnData.push({ json: row });
|
|
376
397
|
}
|
|
377
398
|
}
|
|
378
399
|
else {
|
|
379
400
|
const limit = this.getNodeParameter('limit', i);
|
|
380
|
-
const responseData = await GenericFunctions_1.zohoDeskApiRequest.call(this, 'GET', '/tickets', {}, { limit }, i);
|
|
401
|
+
const responseData = await GenericFunctions_1.zohoDeskApiRequest.call(this, 'GET', '/tickets', {}, { limit, departmentId }, i);
|
|
381
402
|
const data = Array.isArray(responseData.data)
|
|
382
403
|
? responseData.data
|
|
383
404
|
: [responseData];
|