@seranking/n8n-nodes-seranking 1.4.0 → 1.5.7

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.
Files changed (60) hide show
  1. package/README.md +198 -5
  2. package/dist/nodes/SeRanking/SeRanking.node.js +200 -1
  3. package/dist/nodes/SeRanking/projectApi/descriptions/AccountSystemDescription.d.ts +3 -0
  4. package/dist/nodes/SeRanking/projectApi/descriptions/AccountSystemDescription.js +38 -0
  5. package/dist/nodes/SeRanking/projectApi/descriptions/AiResultTrackerDescription.d.ts +3 -0
  6. package/dist/nodes/SeRanking/projectApi/descriptions/AiResultTrackerDescription.js +389 -0
  7. package/dist/nodes/SeRanking/projectApi/descriptions/AnalyticsTrafficDescription.d.ts +3 -0
  8. package/dist/nodes/SeRanking/projectApi/descriptions/AnalyticsTrafficDescription.js +84 -0
  9. package/dist/nodes/SeRanking/projectApi/descriptions/BacklinkCheckerDescription.d.ts +3 -0
  10. package/dist/nodes/SeRanking/projectApi/descriptions/BacklinkCheckerDescription.js +541 -0
  11. package/dist/nodes/SeRanking/projectApi/descriptions/CompetitorsDescription.d.ts +3 -0
  12. package/dist/nodes/SeRanking/projectApi/descriptions/CompetitorsDescription.js +283 -0
  13. package/dist/nodes/SeRanking/projectApi/descriptions/GeneralDataDescription.d.ts +3 -0
  14. package/dist/nodes/SeRanking/projectApi/descriptions/GeneralDataDescription.js +74 -0
  15. package/dist/nodes/SeRanking/projectApi/descriptions/KeywordGroupsDescription.d.ts +3 -0
  16. package/dist/nodes/SeRanking/projectApi/descriptions/KeywordGroupsDescription.js +124 -0
  17. package/dist/nodes/SeRanking/projectApi/descriptions/MarketingPlanDescription.d.ts +3 -0
  18. package/dist/nodes/SeRanking/projectApi/descriptions/MarketingPlanDescription.js +186 -0
  19. package/dist/nodes/SeRanking/projectApi/descriptions/ProjectGroupsDescription.d.ts +3 -0
  20. package/dist/nodes/SeRanking/projectApi/descriptions/ProjectGroupsDescription.js +110 -0
  21. package/dist/nodes/SeRanking/projectApi/descriptions/ProjectManagementDescription.d.ts +3 -0
  22. package/dist/nodes/SeRanking/projectApi/descriptions/ProjectManagementDescription.js +810 -0
  23. package/dist/nodes/SeRanking/projectApi/descriptions/SearchVolumeDescription.d.ts +3 -0
  24. package/dist/nodes/SeRanking/projectApi/descriptions/SearchVolumeDescription.js +74 -0
  25. package/dist/nodes/SeRanking/projectApi/descriptions/SubAccountDescription.d.ts +3 -0
  26. package/dist/nodes/SeRanking/projectApi/descriptions/SubAccountDescription.js +329 -0
  27. package/dist/nodes/SeRanking/projectApi/descriptions/UrlTagsDescription.d.ts +3 -0
  28. package/dist/nodes/SeRanking/projectApi/descriptions/UrlTagsDescription.js +164 -0
  29. package/dist/nodes/SeRanking/projectApi/descriptions/WebsiteAuditDescription.d.ts +3 -0
  30. package/dist/nodes/SeRanking/projectApi/descriptions/WebsiteAuditDescription.js +379 -0
  31. package/dist/nodes/SeRanking/projectApi/operations/AccountSystemOperations.d.ts +2 -0
  32. package/dist/nodes/SeRanking/projectApi/operations/AccountSystemOperations.js +20 -0
  33. package/dist/nodes/SeRanking/projectApi/operations/AiResultTrackerOperations.d.ts +2 -0
  34. package/dist/nodes/SeRanking/projectApi/operations/AiResultTrackerOperations.js +114 -0
  35. package/dist/nodes/SeRanking/projectApi/operations/AnalyticsTrafficOperations.d.ts +2 -0
  36. package/dist/nodes/SeRanking/projectApi/operations/AnalyticsTrafficOperations.js +26 -0
  37. package/dist/nodes/SeRanking/projectApi/operations/BacklinkCheckerOperations.d.ts +2 -0
  38. package/dist/nodes/SeRanking/projectApi/operations/BacklinkCheckerOperations.js +134 -0
  39. package/dist/nodes/SeRanking/projectApi/operations/CompetitorsOperations.d.ts +2 -0
  40. package/dist/nodes/SeRanking/projectApi/operations/CompetitorsOperations.js +94 -0
  41. package/dist/nodes/SeRanking/projectApi/operations/GeneralDataOperations.d.ts +2 -0
  42. package/dist/nodes/SeRanking/projectApi/operations/GeneralDataOperations.js +27 -0
  43. package/dist/nodes/SeRanking/projectApi/operations/KeywordGroupsOperations.d.ts +2 -0
  44. package/dist/nodes/SeRanking/projectApi/operations/KeywordGroupsOperations.js +51 -0
  45. package/dist/nodes/SeRanking/projectApi/operations/MarketingPlanOperations.d.ts +2 -0
  46. package/dist/nodes/SeRanking/projectApi/operations/MarketingPlanOperations.js +49 -0
  47. package/dist/nodes/SeRanking/projectApi/operations/ProjectGroupsOperations.d.ts +2 -0
  48. package/dist/nodes/SeRanking/projectApi/operations/ProjectGroupsOperations.js +44 -0
  49. package/dist/nodes/SeRanking/projectApi/operations/ProjectManagementOperations.d.ts +2 -0
  50. package/dist/nodes/SeRanking/projectApi/operations/ProjectManagementOperations.js +228 -0
  51. package/dist/nodes/SeRanking/projectApi/operations/SearchVolumeOperations.d.ts +2 -0
  52. package/dist/nodes/SeRanking/projectApi/operations/SearchVolumeOperations.js +28 -0
  53. package/dist/nodes/SeRanking/projectApi/operations/SubAccountOperations.d.ts +2 -0
  54. package/dist/nodes/SeRanking/projectApi/operations/SubAccountOperations.js +98 -0
  55. package/dist/nodes/SeRanking/projectApi/operations/UrlTagsOperations.d.ts +2 -0
  56. package/dist/nodes/SeRanking/projectApi/operations/UrlTagsOperations.js +49 -0
  57. package/dist/nodes/SeRanking/projectApi/operations/WebsiteAuditOperations.d.ts +2 -0
  58. package/dist/nodes/SeRanking/projectApi/operations/WebsiteAuditOperations.js +127 -0
  59. package/dist/nodes/SeRanking/utils/apiRequest.js +14 -2
  60. package/package.json +18 -3
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BacklinkCheckerOperations = BacklinkCheckerOperations;
4
+ const apiRequest_1 = require("../../utils/apiRequest");
5
+ async function BacklinkCheckerOperations(index) {
6
+ const operation = this.getNodeParameter('operation', index);
7
+ const siteId = this.getNodeParameter('siteId', index);
8
+ switch (operation) {
9
+ case 'listBacklinks': {
10
+ const additionalFields = this.getNodeParameter('additionalFields', index, {});
11
+ const query = {};
12
+ if (additionalFields.limit !== undefined)
13
+ query.limit = additionalFields.limit;
14
+ if (additionalFields.offset !== undefined)
15
+ query.offset = additionalFields.offset;
16
+ return await apiRequest_1.apiRequest.call(this, 'GET', `/backlinks/${siteId}`, {}, query, index);
17
+ }
18
+ case 'addBacklink': {
19
+ const url = this.getNodeParameter('backlinkUrl', index);
20
+ const additionalFields = this.getNodeParameter('additionalFields', index, {});
21
+ const body = { url };
22
+ if (additionalFields.price !== undefined)
23
+ body.price = additionalFields.price;
24
+ if (additionalFields.currency)
25
+ body.currency = additionalFields.currency;
26
+ if (additionalFields.chargePeriod)
27
+ body.charge_period = additionalFields.chargePeriod;
28
+ if (additionalFields.chargeStart)
29
+ body.charge_start = additionalFields.chargeStart;
30
+ return await apiRequest_1.apiRequest.call(this, 'POST', `/backlinks/${siteId}`, body, {}, index);
31
+ }
32
+ case 'importList': {
33
+ const urlsStr = this.getNodeParameter('backlinkUrls', index);
34
+ const list = urlsStr.split(',').map((u) => u.trim()).filter((u) => u.length > 0);
35
+ const additionalFields = this.getNodeParameter('additionalFields', index, {});
36
+ const body = { list };
37
+ if (additionalFields.price !== undefined)
38
+ body.price = additionalFields.price;
39
+ if (additionalFields.currency)
40
+ body.currency = additionalFields.currency;
41
+ if (additionalFields.chargePeriod)
42
+ body.charge_period = additionalFields.chargePeriod;
43
+ if (additionalFields.chargeStart)
44
+ body.charge_start = additionalFields.chargeStart;
45
+ if (additionalFields.groupId)
46
+ body.group_id = additionalFields.groupId;
47
+ if (additionalFields.manager)
48
+ body.manager = additionalFields.manager;
49
+ return await apiRequest_1.apiRequest.call(this, 'POST', `/backlinks/${siteId}/list`, body, {}, index);
50
+ }
51
+ case 'updateImportSettings': {
52
+ const gscAutoimport = this.getNodeParameter('gscAutoimport', index);
53
+ await apiRequest_1.apiRequest.call(this, 'PUT', `/backlinks/${siteId}/settings`, { gsc_autoimport: gscAutoimport }, {}, index);
54
+ return { success: true, gsc_autoimport: gscAutoimport };
55
+ }
56
+ case 'startGscImport': {
57
+ return await apiRequest_1.apiRequest.call(this, 'POST', `/backlinks/${siteId}/import-gsc`, {}, {}, index);
58
+ }
59
+ case 'getGscImportStatus': {
60
+ const token = this.getNodeParameter('importToken', index);
61
+ return await apiRequest_1.apiRequest.call(this, 'GET', `/backlinks/${siteId}/import-gsc/${token}`, {}, {}, index);
62
+ }
63
+ case 'deleteBacklinks': {
64
+ const idsStr = this.getNodeParameter('backlinkIds', index);
65
+ const backlinkIds = idsStr.split(',').map((id) => parseInt(id.trim(), 10));
66
+ await apiRequest_1.apiRequest.call(this, 'POST', `/backlinks/${siteId}/delete`, { backlink_ids: backlinkIds }, {}, index);
67
+ return { success: true, deleted: true, backlink_ids: backlinkIds };
68
+ }
69
+ case 'recheckBacklinks': {
70
+ const idsStr = this.getNodeParameter('backlinkIds', index);
71
+ const backlinkIds = idsStr.split(',').map((id) => parseInt(id.trim(), 10));
72
+ const additionalFields = this.getNodeParameter('additionalFields', index, {});
73
+ const body = { backlink_ids: backlinkIds };
74
+ if (additionalFields.recheckType)
75
+ body.recheck_type = additionalFields.recheckType;
76
+ return await apiRequest_1.apiRequest.call(this, 'POST', `/backlinks/${siteId}/recheck`, body, {}, index);
77
+ }
78
+ case 'getStats': {
79
+ return await apiRequest_1.apiRequest.call(this, 'GET', `/backlinks/${siteId}/stat`, {}, {}, index);
80
+ }
81
+ case 'listDisavowed': {
82
+ const additionalFields = this.getNodeParameter('additionalFields', index, {});
83
+ const query = {};
84
+ if (additionalFields.limit !== undefined)
85
+ query.limit = additionalFields.limit;
86
+ if (additionalFields.offset !== undefined)
87
+ query.offset = additionalFields.offset;
88
+ return await apiRequest_1.apiRequest.call(this, 'GET', `/backlink-disavow/${siteId}`, {}, query, index);
89
+ }
90
+ case 'addDisavowed': {
91
+ const urlsStr = this.getNodeParameter('disavowUrls', index);
92
+ const list = urlsStr.split(',').map((u) => u.trim()).filter((u) => u.length > 0);
93
+ return await apiRequest_1.apiRequest.call(this, 'POST', `/backlink-disavow/${siteId}`, { list }, {}, index);
94
+ }
95
+ case 'deleteDisavowed': {
96
+ const disavowId = this.getNodeParameter('disavowId', index);
97
+ await apiRequest_1.apiRequest.call(this, 'DELETE', `/backlink-disavow/${siteId}`, {}, { id: disavowId }, index);
98
+ return { success: true, deleted: true, id: disavowId };
99
+ }
100
+ case 'listGroups': {
101
+ return await apiRequest_1.apiRequest.call(this, 'GET', `/backlink-groups/${siteId}`, {}, {}, index);
102
+ }
103
+ case 'createGroup': {
104
+ const name = this.getNodeParameter('groupName', index);
105
+ return await apiRequest_1.apiRequest.call(this, 'POST', `/backlink-groups/${siteId}`, { name }, {}, index);
106
+ }
107
+ case 'deleteGroup': {
108
+ const groupId = this.getNodeParameter('groupId', index);
109
+ await apiRequest_1.apiRequest.call(this, 'DELETE', `/backlink-groups/${siteId}`, {}, { id: groupId }, index);
110
+ return { success: true, deleted: true, group_id: groupId };
111
+ }
112
+ case 'renameGroup': {
113
+ const groupId = this.getNodeParameter('groupId', index);
114
+ const name = this.getNodeParameter('newGroupName', index);
115
+ await apiRequest_1.apiRequest.call(this, 'PUT', `/backlink-groups/${siteId}`, { id: groupId, name }, {}, index);
116
+ return { success: true, group_id: groupId };
117
+ }
118
+ case 'moveToGroup': {
119
+ const targetGroupId = this.getNodeParameter('targetGroupId', index);
120
+ const body = { id: targetGroupId };
121
+ const backlinkIdsStr = this.getNodeParameter('backlinkIds', index, '');
122
+ const groupIdsStr = this.getNodeParameter('groupIds', index, '');
123
+ if (backlinkIdsStr) {
124
+ body.backlink_ids = backlinkIdsStr.split(',').map((id) => parseInt(id.trim(), 10));
125
+ }
126
+ if (groupIdsStr) {
127
+ body.group_ids = groupIdsStr.split(',').map((id) => parseInt(id.trim(), 10));
128
+ }
129
+ return await apiRequest_1.apiRequest.call(this, 'POST', `/backlink-groups/${siteId}/move`, body, {}, index);
130
+ }
131
+ default:
132
+ throw new Error(`Unknown Backlink Checker operation: ${operation}`);
133
+ }
134
+ }
@@ -0,0 +1,2 @@
1
+ import { IExecuteFunctions } from 'n8n-workflow';
2
+ export declare function CompetitorsOperations(this: IExecuteFunctions, index: number): Promise<any>;
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CompetitorsOperations = CompetitorsOperations;
4
+ const apiRequest_1 = require("../../utils/apiRequest");
5
+ async function CompetitorsOperations(index) {
6
+ const operation = this.getNodeParameter('operation', index);
7
+ switch (operation) {
8
+ case 'addCompetitor': {
9
+ const siteId = this.getNodeParameter('siteId', index);
10
+ const url = this.getNodeParameter('competitorUrl', index);
11
+ const additionalFields = this.getNodeParameter('additionalFields', index, {});
12
+ const body = {
13
+ site_id: siteId,
14
+ url,
15
+ };
16
+ if (additionalFields.name)
17
+ body.name = additionalFields.name;
18
+ if (additionalFields.subdomainMatch !== undefined)
19
+ body.subdomain_match = additionalFields.subdomainMatch;
20
+ return await apiRequest_1.apiRequest.call(this, 'POST', '/competitors', body, {}, index);
21
+ }
22
+ case 'listCompetitors': {
23
+ const siteId = this.getNodeParameter('siteId', index);
24
+ return await apiRequest_1.apiRequest.call(this, 'GET', `/competitors/site/${siteId}`, {}, {}, index);
25
+ }
26
+ case 'getPositions': {
27
+ const competitorId = this.getNodeParameter('competitorId', index);
28
+ const additionalFields = this.getNodeParameter('additionalFields', index, {});
29
+ const query = {};
30
+ if (additionalFields.dateFrom)
31
+ query.date_from = additionalFields.dateFrom;
32
+ if (additionalFields.dateTo)
33
+ query.date_to = additionalFields.dateTo;
34
+ if (additionalFields.siteEngineId)
35
+ query.site_engine_id = additionalFields.siteEngineId;
36
+ if (additionalFields.withSerpFeatures !== undefined)
37
+ query.with_serp_features = additionalFields.withSerpFeatures;
38
+ return await apiRequest_1.apiRequest.call(this, 'GET', `/competitors/${competitorId}/positions`, {}, query, index);
39
+ }
40
+ case 'deleteCompetitor': {
41
+ const competitorId = this.getNodeParameter('competitorId', index);
42
+ await apiRequest_1.apiRequest.call(this, 'DELETE', `/competitors/${competitorId}`, {}, {}, index);
43
+ return { success: true, deleted: true, competitor_id: competitorId };
44
+ }
45
+ case 'getTop10': {
46
+ const siteId = this.getNodeParameter('siteId', index);
47
+ const date = this.getNodeParameter('date', index);
48
+ const siteEngineId = this.getNodeParameter('siteEngineId', index);
49
+ const keywordId = this.getNodeParameter('keywordId', index);
50
+ const query = {
51
+ date,
52
+ site_engine_id: siteEngineId,
53
+ keyword_id: keywordId,
54
+ };
55
+ return await apiRequest_1.apiRequest.call(this, 'GET', `/competitors/top10/${siteId}`, {}, query, index);
56
+ }
57
+ case 'getTop100': {
58
+ const siteId = this.getNodeParameter('siteId', index);
59
+ const date = this.getNodeParameter('date', index);
60
+ const siteEngineId = this.getNodeParameter('siteEngineId', index);
61
+ const keywordId = this.getNodeParameter('keywordId', index);
62
+ const additionalFields = this.getNodeParameter('additionalFields', index, {});
63
+ const query = {
64
+ date,
65
+ site_engine_id: siteEngineId,
66
+ keyword_id: keywordId,
67
+ };
68
+ if (additionalFields.top !== undefined)
69
+ query.top = additionalFields.top;
70
+ return await apiRequest_1.apiRequest.call(this, 'GET', `/competitors/top100/${siteId}`, {}, query, index);
71
+ }
72
+ case 'getAllCompetitors': {
73
+ const siteId = this.getNodeParameter('siteId', index);
74
+ const date = this.getNodeParameter('date', index);
75
+ const siteEngineId = this.getNodeParameter('siteEngineId', index);
76
+ const additionalFields = this.getNodeParameter('additionalFields', index, {});
77
+ const query = {
78
+ date,
79
+ site_engine_id: siteEngineId,
80
+ };
81
+ if (additionalFields.groupId)
82
+ query.group_id = additionalFields.groupId;
83
+ if (additionalFields.tags) {
84
+ const tagIds = additionalFields.tags.split(',').map((id) => parseInt(id.trim(), 10));
85
+ tagIds.forEach((id, i) => {
86
+ query[`tags[${i}]`] = id;
87
+ });
88
+ }
89
+ return await apiRequest_1.apiRequest.call(this, 'GET', `/competitors/all/${siteId}`, {}, query, index);
90
+ }
91
+ default:
92
+ throw new Error(`Unknown Competitors operation: ${operation}`);
93
+ }
94
+ }
@@ -0,0 +1,2 @@
1
+ import { IExecuteFunctions } from 'n8n-workflow';
2
+ export declare function GeneralDataOperations(this: IExecuteFunctions, index: number): Promise<any>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GeneralDataOperations = GeneralDataOperations;
4
+ const apiRequest_1 = require("../../utils/apiRequest");
5
+ async function GeneralDataOperations(index) {
6
+ const operation = this.getNodeParameter('operation', index);
7
+ switch (operation) {
8
+ case 'listSearchEngines': {
9
+ return await apiRequest_1.apiRequest.call(this, 'GET', '/system/search-engines', {}, {}, index);
10
+ }
11
+ case 'listGoogleLangs': {
12
+ return await apiRequest_1.apiRequest.call(this, 'GET', '/system/google-langs', {}, {}, index);
13
+ }
14
+ case 'listVolumeRegions': {
15
+ return await apiRequest_1.apiRequest.call(this, 'GET', '/system/volume-regions', {}, {}, index);
16
+ }
17
+ case 'getKeywordVolume': {
18
+ const regionId = this.getNodeParameter('regionId', index);
19
+ const keywordsStr = this.getNodeParameter('keywords', index);
20
+ const keywords = keywordsStr.split(',').map((k) => k.trim()).filter((k) => k.length > 0);
21
+ const query = { region_id: regionId, _keywordArray: keywords };
22
+ return await apiRequest_1.apiRequest.call(this, 'GET', '/system/volume', {}, query, index);
23
+ }
24
+ default:
25
+ throw new Error(`Unknown General Data operation: ${operation}`);
26
+ }
27
+ }
@@ -0,0 +1,2 @@
1
+ import { IExecuteFunctions } from 'n8n-workflow';
2
+ export declare function KeywordGroupsOperations(this: IExecuteFunctions, index: number): Promise<any>;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KeywordGroupsOperations = KeywordGroupsOperations;
4
+ const apiRequest_1 = require("../../utils/apiRequest");
5
+ async function KeywordGroupsOperations(index) {
6
+ const operation = this.getNodeParameter('operation', index);
7
+ switch (operation) {
8
+ case 'listGroups': {
9
+ const siteId = this.getNodeParameter('siteId', index);
10
+ return await apiRequest_1.apiRequest.call(this, 'GET', `/keyword-groups/${siteId}`, {}, {}, index);
11
+ }
12
+ case 'addGroup': {
13
+ const siteId = this.getNodeParameter('siteId', index);
14
+ const name = this.getNodeParameter('groupName', index);
15
+ if (!name || name.trim() === '') {
16
+ throw new Error('Group name cannot be empty');
17
+ }
18
+ return await apiRequest_1.apiRequest.call(this, 'POST', '/keyword-groups', {
19
+ name: name.trim(),
20
+ site_id: siteId,
21
+ }, {}, index);
22
+ }
23
+ case 'moveKeywords': {
24
+ const groupId = this.getNodeParameter('groupId', index);
25
+ const keywordIdsStr = this.getNodeParameter('keywordIds', index);
26
+ const keywordIds = keywordIdsStr.split(',').map((id) => parseInt(id.trim(), 10));
27
+ await apiRequest_1.apiRequest.call(this, 'POST', `/keyword-groups/${groupId}/keywords`, {
28
+ keyword_ids: keywordIds,
29
+ }, {}, index);
30
+ return { success: true, group_id: groupId, moved_keywords: keywordIds };
31
+ }
32
+ case 'renameGroup': {
33
+ const groupId = this.getNodeParameter('groupId', index);
34
+ const name = this.getNodeParameter('groupName', index);
35
+ if (!name || name.trim() === '') {
36
+ throw new Error('Group name cannot be empty');
37
+ }
38
+ await apiRequest_1.apiRequest.call(this, 'PUT', `/keyword-groups/${groupId}`, {
39
+ name: name.trim(),
40
+ }, {}, index);
41
+ return { success: true, group_id: groupId, name: name.trim() };
42
+ }
43
+ case 'deleteGroup': {
44
+ const groupId = this.getNodeParameter('groupId', index);
45
+ await apiRequest_1.apiRequest.call(this, 'DELETE', `/keyword-groups/${groupId}`, {}, {}, index);
46
+ return { success: true, deleted: true, group_id: groupId };
47
+ }
48
+ default:
49
+ throw new Error(`Unknown Keyword Groups operation: ${operation}`);
50
+ }
51
+ }
@@ -0,0 +1,2 @@
1
+ import { IExecuteFunctions } from 'n8n-workflow';
2
+ export declare function MarketingPlanOperations(this: IExecuteFunctions, index: number): Promise<any>;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MarketingPlanOperations = MarketingPlanOperations;
4
+ const apiRequest_1 = require("../../utils/apiRequest");
5
+ async function MarketingPlanOperations(index) {
6
+ const operation = this.getNodeParameter('operation', index);
7
+ const siteId = this.getNodeParameter('siteId', index);
8
+ switch (operation) {
9
+ case 'listPlanItems': {
10
+ return await apiRequest_1.apiRequest.call(this, 'GET', `/checklist/${siteId}`, {}, {}, index);
11
+ }
12
+ case 'addTask': {
13
+ const title = this.getNodeParameter('taskTitle', index);
14
+ const text = this.getNodeParameter('taskText', index);
15
+ const additionalFields = this.getNodeParameter('additionalFields', index, {});
16
+ const body = { title, text };
17
+ if (additionalFields.forAll !== undefined)
18
+ body.for_all = additionalFields.forAll;
19
+ return await apiRequest_1.apiRequest.call(this, 'POST', `/checklist/${siteId}/task`, body, {}, index);
20
+ }
21
+ case 'updateTask': {
22
+ const taskId = this.getNodeParameter('taskId', index);
23
+ const title = this.getNodeParameter('taskTitle', index);
24
+ const text = this.getNodeParameter('taskText', index);
25
+ await apiRequest_1.apiRequest.call(this, 'PUT', `/checklist/${siteId}/task`, {
26
+ task_id: taskId,
27
+ title,
28
+ text,
29
+ }, {}, index);
30
+ return { success: true, task_id: taskId };
31
+ }
32
+ case 'setTaskStatus': {
33
+ const taskId = this.getNodeParameter('taskId', index);
34
+ const checked = this.getNodeParameter('checked', index);
35
+ await apiRequest_1.apiRequest.call(this, 'PUT', `/checklist/${siteId}/task`, {
36
+ task_id: taskId,
37
+ checked,
38
+ }, {}, index);
39
+ return { success: true, task_id: taskId, checked };
40
+ }
41
+ case 'deleteTask': {
42
+ const taskId = this.getNodeParameter('deleteTaskId', index);
43
+ await apiRequest_1.apiRequest.call(this, 'DELETE', `/checklist/${siteId}/task/${taskId}`, {}, {}, index);
44
+ return { success: true, deleted: true, task_id: taskId };
45
+ }
46
+ default:
47
+ throw new Error(`Unknown Marketing Plan operation: ${operation}`);
48
+ }
49
+ }
@@ -0,0 +1,2 @@
1
+ import { IExecuteFunctions } from 'n8n-workflow';
2
+ export declare function ProjectGroupsOperations(this: IExecuteFunctions, index: number): Promise<any>;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProjectGroupsOperations = ProjectGroupsOperations;
4
+ const apiRequest_1 = require("../../utils/apiRequest");
5
+ async function ProjectGroupsOperations(index) {
6
+ const operation = this.getNodeParameter('operation', index);
7
+ switch (operation) {
8
+ case 'addGroup': {
9
+ const name = this.getNodeParameter('groupName', index);
10
+ if (!name || name.trim() === '') {
11
+ throw new Error('Group name cannot be empty');
12
+ }
13
+ return await apiRequest_1.apiRequest.call(this, 'POST', '/site-groups', { name: name.trim() }, {}, index);
14
+ }
15
+ case 'renameGroup': {
16
+ const groupId = this.getNodeParameter('groupId', index);
17
+ const name = this.getNodeParameter('groupName', index);
18
+ if (!name || name.trim() === '') {
19
+ throw new Error('Group name cannot be empty');
20
+ }
21
+ await apiRequest_1.apiRequest.call(this, 'PUT', `/site-groups/${groupId}`, { name: name.trim() }, {}, index);
22
+ return { success: true, group_id: groupId, name: name.trim() };
23
+ }
24
+ case 'deleteGroup': {
25
+ const groupId = this.getNodeParameter('groupId', index);
26
+ await apiRequest_1.apiRequest.call(this, 'DELETE', `/site-groups/${groupId}`, {}, {}, index);
27
+ return { success: true, deleted: true, group_id: groupId };
28
+ }
29
+ case 'listGroups': {
30
+ return await apiRequest_1.apiRequest.call(this, 'GET', '/site-groups', {}, {}, index);
31
+ }
32
+ case 'moveProjects': {
33
+ const groupId = this.getNodeParameter('groupId', index);
34
+ const siteIdsStr = this.getNodeParameter('siteIds', index);
35
+ const siteIds = siteIdsStr.split(',').map((id) => parseInt(id.trim(), 10));
36
+ await apiRequest_1.apiRequest.call(this, 'POST', `/site-groups/${groupId}/sites`, {
37
+ site_ids: siteIds,
38
+ }, {}, index);
39
+ return { success: true, group_id: groupId, moved_sites: siteIds };
40
+ }
41
+ default:
42
+ throw new Error(`Unknown Project Groups operation: ${operation}`);
43
+ }
44
+ }
@@ -0,0 +1,2 @@
1
+ import { IExecuteFunctions } from 'n8n-workflow';
2
+ export declare function ProjectManagementOperations(this: IExecuteFunctions, index: number): Promise<any>;