@posty5/n8n-nodes-posty5 4.2.0 → 5.0.0
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.
- package/README.md +351 -15
- package/dist/credentials/Posty5Api.credentials.d.ts +4 -0
- package/dist/credentials/Posty5Api.credentials.d.ts.map +1 -1
- package/dist/credentials/Posty5Api.credentials.js +30 -4
- package/dist/credentials/Posty5Api.credentials.js.map +1 -1
- package/dist/nodes/Posty5FormSubmission/Posty5FormSubmission.node.d.ts.map +1 -1
- package/dist/nodes/Posty5FormSubmission/Posty5FormSubmission.node.js +6 -2
- package/dist/nodes/Posty5FormSubmission/Posty5FormSubmission.node.js.map +1 -1
- package/dist/nodes/Posty5HtmlHosting/Posty5HtmlHosting.node.d.ts.map +1 -1
- package/dist/nodes/Posty5HtmlHosting/Posty5HtmlHosting.node.js +14 -3
- package/dist/nodes/Posty5HtmlHosting/Posty5HtmlHosting.node.js.map +1 -1
- package/dist/nodes/Posty5QrCode/Posty5QrCode.node.d.ts +6 -0
- package/dist/nodes/Posty5QrCode/Posty5QrCode.node.d.ts.map +1 -1
- package/dist/nodes/Posty5QrCode/Posty5QrCode.node.js +850 -189
- package/dist/nodes/Posty5QrCode/Posty5QrCode.node.js.map +1 -1
- package/dist/nodes/Posty5QrCode/helpers.d.ts +12 -0
- package/dist/nodes/Posty5QrCode/helpers.d.ts.map +1 -0
- package/dist/nodes/Posty5QrCode/helpers.js +56 -0
- package/dist/nodes/Posty5QrCode/helpers.js.map +1 -0
- package/dist/nodes/Posty5ShortLink/Posty5ShortLink.node.d.ts +8 -0
- package/dist/nodes/Posty5ShortLink/Posty5ShortLink.node.d.ts.map +1 -1
- package/dist/nodes/Posty5ShortLink/Posty5ShortLink.node.js +389 -78
- package/dist/nodes/Posty5ShortLink/Posty5ShortLink.node.js.map +1 -1
- package/dist/nodes/Posty5ShortLink/helpers.d.ts +12 -0
- package/dist/nodes/Posty5ShortLink/helpers.d.ts.map +1 -0
- package/dist/nodes/Posty5ShortLink/helpers.js +46 -0
- package/dist/nodes/Posty5ShortLink/helpers.js.map +1 -0
- package/dist/nodes/Posty5SocialPublisherPost/Posty5SocialPublisherPost.node.d.ts.map +1 -1
- package/dist/nodes/Posty5SocialPublisherPost/Posty5SocialPublisherPost.node.js +143 -52
- package/dist/nodes/Posty5SocialPublisherPost/Posty5SocialPublisherPost.node.js.map +1 -1
- package/dist/nodes/Posty5Store/Posty5Store.node.d.ts +17 -0
- package/dist/nodes/Posty5Store/Posty5Store.node.d.ts.map +1 -0
- package/dist/nodes/Posty5Store/Posty5Store.node.js +230 -0
- package/dist/nodes/Posty5Store/Posty5Store.node.js.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/fulfilment-group.description.d.ts +4 -0
- package/dist/nodes/Posty5Store/descriptions/fulfilment-group.description.d.ts.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/fulfilment-group.description.js +55 -0
- package/dist/nodes/Posty5Store/descriptions/fulfilment-group.description.js.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/order.description.d.ts +4 -0
- package/dist/nodes/Posty5Store/descriptions/order.description.d.ts.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/order.description.js +91 -0
- package/dist/nodes/Posty5Store/descriptions/order.description.js.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/product-link.description.d.ts +4 -0
- package/dist/nodes/Posty5Store/descriptions/product-link.description.d.ts.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/product-link.description.js +48 -0
- package/dist/nodes/Posty5Store/descriptions/product-link.description.js.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/supplier-order.description.d.ts +4 -0
- package/dist/nodes/Posty5Store/descriptions/supplier-order.description.d.ts.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/supplier-order.description.js +118 -0
- package/dist/nodes/Posty5Store/descriptions/supplier-order.description.js.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/supplier-product.description.d.ts +4 -0
- package/dist/nodes/Posty5Store/descriptions/supplier-product.description.d.ts.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/supplier-product.description.js +167 -0
- package/dist/nodes/Posty5Store/descriptions/supplier-product.description.js.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/supplier.description.d.ts +4 -0
- package/dist/nodes/Posty5Store/descriptions/supplier.description.d.ts.map +1 -0
- package/dist/nodes/Posty5Store/descriptions/supplier.description.js +50 -0
- package/dist/nodes/Posty5Store/descriptions/supplier.description.js.map +1 -0
- package/dist/nodes/Posty5Trigger/Posty5Trigger.node.d.ts +13 -0
- package/dist/nodes/Posty5Trigger/Posty5Trigger.node.d.ts.map +1 -0
- package/dist/nodes/Posty5Trigger/Posty5Trigger.node.js +171 -0
- package/dist/nodes/Posty5Trigger/Posty5Trigger.node.js.map +1 -0
- package/dist/nodes/Posty5Trigger/config.d.ts +51 -0
- package/dist/nodes/Posty5Trigger/config.d.ts.map +1 -0
- package/dist/nodes/Posty5Trigger/config.js +76 -0
- package/dist/nodes/Posty5Trigger/config.js.map +1 -0
- package/dist/nodes/Posty5Trigger/descriptions.d.ts +4 -0
- package/dist/nodes/Posty5Trigger/descriptions.d.ts.map +1 -0
- package/dist/nodes/Posty5Trigger/descriptions.js +99 -0
- package/dist/nodes/Posty5Trigger/descriptions.js.map +1 -0
- package/dist/nodes/Posty5Trigger/helpers.d.ts +34 -0
- package/dist/nodes/Posty5Trigger/helpers.d.ts.map +1 -0
- package/dist/nodes/Posty5Trigger/helpers.js +139 -0
- package/dist/nodes/Posty5Trigger/helpers.js.map +1 -0
- package/dist/package.json +78 -0
- package/dist/types/common.d.ts +62 -0
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/link-analytics.types.d.ts +147 -0
- package/dist/types/link-analytics.types.d.ts.map +1 -0
- package/dist/types/link-analytics.types.js +10 -0
- package/dist/types/link-analytics.types.js.map +1 -0
- package/dist/types/link-bulk.types.d.ts +68 -0
- package/dist/types/link-bulk.types.d.ts.map +1 -0
- package/dist/types/link-bulk.types.js +8 -0
- package/dist/types/link-bulk.types.js.map +1 -0
- package/dist/types/qr-code.types.d.ts +189 -56
- package/dist/types/qr-code.types.d.ts.map +1 -1
- package/dist/types/short-link-controls.types.d.ts +82 -0
- package/dist/types/short-link-controls.types.d.ts.map +1 -0
- package/dist/types/short-link-controls.types.js +7 -0
- package/dist/types/short-link-controls.types.js.map +1 -0
- package/dist/types/short-link.types.d.ts +63 -15
- package/dist/types/short-link.types.d.ts.map +1 -1
- package/dist/types/store.types.d.ts +71 -0
- package/dist/types/store.types.d.ts.map +1 -0
- package/dist/types/store.types.js +7 -0
- package/dist/types/store.types.js.map +1 -0
- package/dist/types/webhook.types.d.ts +66 -0
- package/dist/types/webhook.types.d.ts.map +1 -0
- package/dist/types/webhook.types.js +7 -0
- package/dist/types/webhook.types.js.map +1 -0
- package/dist/utils/analytics.helpers.d.ts +68 -0
- package/dist/utils/analytics.helpers.d.ts.map +1 -0
- package/dist/utils/analytics.helpers.js +202 -0
- package/dist/utils/analytics.helpers.js.map +1 -0
- package/dist/utils/analytics.properties.d.ts +10 -0
- package/dist/utils/analytics.properties.d.ts.map +1 -0
- package/dist/utils/analytics.properties.js +172 -0
- package/dist/utils/analytics.properties.js.map +1 -0
- package/dist/utils/api.helpers.d.ts +36 -3
- package/dist/utils/api.helpers.d.ts.map +1 -1
- package/dist/utils/api.helpers.js +77 -7
- package/dist/utils/api.helpers.js.map +1 -1
- package/dist/utils/constants.d.ts +198 -0
- package/dist/utils/constants.d.ts.map +1 -1
- package/dist/utils/constants.js +215 -1
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/date.helpers.d.ts +25 -0
- package/dist/utils/date.helpers.d.ts.map +1 -0
- package/dist/utils/date.helpers.js +65 -0
- package/dist/utils/date.helpers.js.map +1 -0
- package/dist/utils/link-bulk.helpers.d.ts +26 -0
- package/dist/utils/link-bulk.helpers.d.ts.map +1 -0
- package/dist/utils/link-bulk.helpers.js +135 -0
- package/dist/utils/link-bulk.helpers.js.map +1 -0
- package/dist/utils/link-bulk.properties.d.ts +9 -0
- package/dist/utils/link-bulk.properties.d.ts.map +1 -0
- package/dist/utils/link-bulk.properties.js +113 -0
- package/dist/utils/link-bulk.properties.js.map +1 -0
- package/dist/utils/link-tool.helpers.d.ts +43 -0
- package/dist/utils/link-tool.helpers.d.ts.map +1 -0
- package/dist/utils/link-tool.helpers.js +121 -0
- package/dist/utils/link-tool.helpers.js.map +1 -0
- package/dist/utils/post-comments.d.ts +43 -0
- package/dist/utils/post-comments.d.ts.map +1 -0
- package/dist/utils/post-comments.js +53 -0
- package/dist/utils/post-comments.js.map +1 -0
- package/dist/utils/qr-content.config.d.ts +66 -0
- package/dist/utils/qr-content.config.d.ts.map +1 -0
- package/dist/utils/qr-content.config.js +139 -0
- package/dist/utils/qr-content.config.js.map +1 -0
- package/dist/utils/qr-file.helpers.d.ts +22 -0
- package/dist/utils/qr-file.helpers.d.ts.map +1 -0
- package/dist/utils/qr-file.helpers.js +63 -0
- package/dist/utils/qr-file.helpers.js.map +1 -0
- package/dist/utils/qr-target.helpers.d.ts +35 -0
- package/dist/utils/qr-target.helpers.d.ts.map +1 -0
- package/dist/utils/qr-target.helpers.js +260 -0
- package/dist/utils/qr-target.helpers.js.map +1 -0
- package/dist/utils/qr-templates.helpers.d.ts +26 -0
- package/dist/utils/qr-templates.helpers.d.ts.map +1 -0
- package/dist/utils/qr-templates.helpers.js +70 -0
- package/dist/utils/qr-templates.helpers.js.map +1 -0
- package/dist/utils/short-link-controls.helpers.d.ts +31 -0
- package/dist/utils/short-link-controls.helpers.d.ts.map +1 -0
- package/dist/utils/short-link-controls.helpers.js +185 -0
- package/dist/utils/short-link-controls.helpers.js.map +1 -0
- package/dist/utils/short-link-controls.properties.d.ts +17 -0
- package/dist/utils/short-link-controls.properties.d.ts.map +1 -0
- package/dist/utils/short-link-controls.properties.js +315 -0
- package/dist/utils/short-link-controls.properties.js.map +1 -0
- package/dist/utils/store.helpers.d.ts +43 -0
- package/dist/utils/store.helpers.d.ts.map +1 -0
- package/dist/utils/store.helpers.js +87 -0
- package/dist/utils/store.helpers.js.map +1 -0
- package/dist/utils/versioned-write.helpers.d.ts +31 -0
- package/dist/utils/versioned-write.helpers.d.ts.map +1 -0
- package/dist/utils/versioned-write.helpers.js +120 -0
- package/dist/utils/versioned-write.helpers.js.map +1 -0
- package/package.json +7 -3
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Posty5ShortLink = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
4
5
|
const api_helpers_1 = require("../../utils/api.helpers");
|
|
6
|
+
const versioned_write_helpers_1 = require("../../utils/versioned-write.helpers");
|
|
7
|
+
const analytics_helpers_1 = require("../../utils/analytics.helpers");
|
|
8
|
+
const analytics_properties_1 = require("../../utils/analytics.properties");
|
|
5
9
|
const constants_1 = require("../../utils/constants");
|
|
10
|
+
const link_bulk_helpers_1 = require("../../utils/link-bulk.helpers");
|
|
11
|
+
const link_bulk_properties_1 = require("../../utils/link-bulk.properties");
|
|
12
|
+
const helpers_1 = require("./helpers");
|
|
13
|
+
const link_tool_helpers_1 = require("../../utils/link-tool.helpers");
|
|
14
|
+
const qr_templates_helpers_1 = require("../../utils/qr-templates.helpers");
|
|
15
|
+
const constants_2 = require("../../utils/constants");
|
|
16
|
+
const short_link_controls_helpers_1 = require("../../utils/short-link-controls.helpers");
|
|
17
|
+
const short_link_controls_properties_1 = require("../../utils/short-link-controls.properties");
|
|
6
18
|
class Posty5ShortLink {
|
|
7
19
|
constructor() {
|
|
8
20
|
this.description = {
|
|
@@ -10,9 +22,10 @@ class Posty5ShortLink {
|
|
|
10
22
|
name: 'posty5ShortLink',
|
|
11
23
|
icon: 'file:posty5.svg',
|
|
12
24
|
group: ['transform'],
|
|
13
|
-
version: 1,
|
|
25
|
+
version: [1, 2],
|
|
26
|
+
defaultVersion: 2,
|
|
14
27
|
subtitle: '={{$parameter["operation"]}}',
|
|
15
|
-
description: 'Create and manage short links with Posty5',
|
|
28
|
+
description: 'Create and manage short links with Posty5. v1 is legacy: update and delete overwrite (last write wins)',
|
|
16
29
|
defaults: {
|
|
17
30
|
name: 'Posty5 Short Link',
|
|
18
31
|
},
|
|
@@ -31,36 +44,102 @@ class Posty5ShortLink {
|
|
|
31
44
|
type: 'options',
|
|
32
45
|
noDataExpression: true,
|
|
33
46
|
options: [
|
|
47
|
+
{
|
|
48
|
+
name: 'Check Health',
|
|
49
|
+
value: 'checkHealth',
|
|
50
|
+
description: 'Queue one destination health check of a short link (once per 10 minutes)',
|
|
51
|
+
action: 'Check the health of a short link',
|
|
52
|
+
},
|
|
34
53
|
{
|
|
35
54
|
name: 'Create',
|
|
36
55
|
value: 'create',
|
|
37
56
|
description: 'Create a new short link',
|
|
38
57
|
action: 'Create a short link',
|
|
39
58
|
},
|
|
59
|
+
{
|
|
60
|
+
name: 'Create Campaign',
|
|
61
|
+
value: 'createCampaign',
|
|
62
|
+
description: 'Create a link campaign',
|
|
63
|
+
action: 'Create a campaign',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'Create Many',
|
|
67
|
+
value: 'createMany',
|
|
68
|
+
description: 'Create one short link per input item in batched API calls',
|
|
69
|
+
action: 'Create many short links',
|
|
70
|
+
},
|
|
40
71
|
{
|
|
41
72
|
name: 'Delete',
|
|
42
73
|
value: 'delete',
|
|
43
74
|
description: 'Delete a short link',
|
|
44
75
|
action: 'Delete a short link',
|
|
45
76
|
},
|
|
77
|
+
{
|
|
78
|
+
name: 'Delete Campaign',
|
|
79
|
+
value: 'deleteCampaign',
|
|
80
|
+
description: 'Delete a link campaign',
|
|
81
|
+
action: 'Delete a campaign',
|
|
82
|
+
},
|
|
46
83
|
{
|
|
47
84
|
name: 'Get',
|
|
48
85
|
value: 'get',
|
|
49
86
|
description: 'Get a short link by ID',
|
|
50
87
|
action: 'Get a short link',
|
|
51
88
|
},
|
|
89
|
+
{
|
|
90
|
+
name: 'Get Analytics',
|
|
91
|
+
value: 'getAnalytics',
|
|
92
|
+
description: 'Get visits, unique visitors, a series and breakdowns of a short link',
|
|
93
|
+
action: 'Get analytics for a short link',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'Get Campaign',
|
|
97
|
+
value: 'getCampaign',
|
|
98
|
+
description: 'Get a link campaign with its link count and total visits',
|
|
99
|
+
action: 'Get a campaign',
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: 'Get Statistics',
|
|
103
|
+
value: 'getStatistics',
|
|
104
|
+
description: 'Get counts over all your short links: totals, visits per day and the top 10 by visits',
|
|
105
|
+
action: 'Get statistics for short links',
|
|
106
|
+
},
|
|
52
107
|
{
|
|
53
108
|
name: 'List',
|
|
54
109
|
value: 'list',
|
|
55
110
|
description: 'List all short links',
|
|
56
111
|
action: 'List short links',
|
|
57
112
|
},
|
|
113
|
+
{
|
|
114
|
+
name: 'List Campaigns',
|
|
115
|
+
value: 'listCampaigns',
|
|
116
|
+
description: 'List your link campaigns',
|
|
117
|
+
action: 'List campaigns',
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: 'List Tags',
|
|
121
|
+
value: 'listTags',
|
|
122
|
+
description: 'List the distinct tags of your short links',
|
|
123
|
+
action: 'List tags',
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: 'Set Rules',
|
|
127
|
+
value: 'setRules',
|
|
128
|
+
description: 'Change the access, routing, variants, UTM or pixels of a short link',
|
|
129
|
+
action: 'Set the rules of a short link',
|
|
130
|
+
},
|
|
58
131
|
{
|
|
59
132
|
name: 'Update',
|
|
60
133
|
value: 'update',
|
|
61
134
|
description: 'Update a short link',
|
|
62
135
|
action: 'Update a short link',
|
|
63
136
|
},
|
|
137
|
+
{
|
|
138
|
+
name: 'Update Campaign',
|
|
139
|
+
value: 'updateCampaign',
|
|
140
|
+
description: 'Update a link campaign',
|
|
141
|
+
action: 'Update a campaign',
|
|
142
|
+
},
|
|
64
143
|
],
|
|
65
144
|
default: 'create',
|
|
66
145
|
},
|
|
@@ -70,13 +149,45 @@ class Posty5ShortLink {
|
|
|
70
149
|
name: 'url',
|
|
71
150
|
type: 'string',
|
|
72
151
|
required: true,
|
|
152
|
+
displayOptions: {
|
|
153
|
+
show: {
|
|
154
|
+
operation: ['create', 'createMany'],
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
default: '',
|
|
158
|
+
placeholder: 'https://example.com',
|
|
159
|
+
description: 'The destination URL to shorten. It must start with http:// or https://.',
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
displayName: 'Template Name or ID',
|
|
163
|
+
name: 'templateId',
|
|
164
|
+
type: 'options',
|
|
165
|
+
required: true,
|
|
166
|
+
typeOptions: {
|
|
167
|
+
loadOptionsMethod: 'getQrTemplates',
|
|
168
|
+
},
|
|
73
169
|
displayOptions: {
|
|
74
170
|
show: {
|
|
75
171
|
operation: ['create'],
|
|
76
172
|
},
|
|
77
173
|
},
|
|
78
174
|
default: '',
|
|
79
|
-
description: 'The
|
|
175
|
+
description: 'The QR code design of the link. Required by the Posty5 API for API-key calls. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
displayName: 'Template Name or ID',
|
|
179
|
+
name: 'templateId',
|
|
180
|
+
type: 'options',
|
|
181
|
+
typeOptions: {
|
|
182
|
+
loadOptionsMethod: 'getQrTemplates',
|
|
183
|
+
},
|
|
184
|
+
displayOptions: {
|
|
185
|
+
show: {
|
|
186
|
+
operation: ['update'],
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
default: '',
|
|
190
|
+
description: 'The QR code design of the link. Leave empty to keep the current one. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
|
80
191
|
},
|
|
81
192
|
{
|
|
82
193
|
displayName: 'Name',
|
|
@@ -84,11 +195,11 @@ class Posty5ShortLink {
|
|
|
84
195
|
type: 'string',
|
|
85
196
|
displayOptions: {
|
|
86
197
|
show: {
|
|
87
|
-
operation: ['create', 'update'],
|
|
198
|
+
operation: ['create', 'createMany', 'update'],
|
|
88
199
|
},
|
|
89
200
|
},
|
|
90
201
|
default: '',
|
|
91
|
-
description: 'A friendly name for the short link',
|
|
202
|
+
description: 'A friendly name for the short link. On Update, leave it empty to keep the current name.',
|
|
92
203
|
},
|
|
93
204
|
{
|
|
94
205
|
displayName: 'Custom Slug',
|
|
@@ -96,11 +207,11 @@ class Posty5ShortLink {
|
|
|
96
207
|
type: 'string',
|
|
97
208
|
displayOptions: {
|
|
98
209
|
show: {
|
|
99
|
-
operation: ['create', '
|
|
210
|
+
operation: ['create', 'createMany'],
|
|
100
211
|
},
|
|
101
212
|
},
|
|
102
213
|
default: '',
|
|
103
|
-
description: 'Custom slug for branded short links (e.g., "my-link")',
|
|
214
|
+
description: 'Custom slug for branded short links (e.g., "my-link"). Lowercase letters, digits and hyphens. It cannot be changed after the link is created.',
|
|
104
215
|
},
|
|
105
216
|
{
|
|
106
217
|
displayName: 'Additional Fields',
|
|
@@ -115,47 +226,87 @@ class Posty5ShortLink {
|
|
|
115
226
|
},
|
|
116
227
|
options: [
|
|
117
228
|
{
|
|
118
|
-
displayName: '
|
|
119
|
-
name: '
|
|
229
|
+
displayName: 'Android URL',
|
|
230
|
+
name: 'androidUrl',
|
|
120
231
|
type: 'string',
|
|
121
232
|
default: '',
|
|
122
|
-
|
|
233
|
+
placeholder: 'myapp://item/1',
|
|
234
|
+
description: 'Where Android visitors go: an https:// link or an app link. Left out, the link uses the deep link the destination page declares. On Update, an empty value clears it.',
|
|
123
235
|
},
|
|
124
236
|
{
|
|
125
|
-
displayName: '
|
|
126
|
-
name: '
|
|
237
|
+
displayName: 'Destination URL',
|
|
238
|
+
name: 'baseUrl',
|
|
127
239
|
type: 'string',
|
|
240
|
+
displayOptions: {
|
|
241
|
+
show: {
|
|
242
|
+
'/operation': ['update'],
|
|
243
|
+
},
|
|
244
|
+
},
|
|
128
245
|
default: '',
|
|
129
|
-
|
|
246
|
+
placeholder: 'https://example.com',
|
|
247
|
+
description: 'A new destination URL. Left out, the current one is kept.',
|
|
130
248
|
},
|
|
131
249
|
{
|
|
132
|
-
displayName: '
|
|
133
|
-
name: '
|
|
250
|
+
displayName: 'iOS URL',
|
|
251
|
+
name: 'iosUrl',
|
|
134
252
|
type: 'string',
|
|
135
253
|
default: '',
|
|
136
|
-
|
|
254
|
+
placeholder: 'myapp://item/1',
|
|
255
|
+
description: 'Where iPhone and iPad visitors go: an https:// link or an app link. Left out, the link uses the deep link the destination page declares. On Update, an empty value clears it.',
|
|
137
256
|
},
|
|
138
257
|
{
|
|
139
|
-
displayName: '
|
|
140
|
-
name: '
|
|
258
|
+
displayName: 'Landing Page',
|
|
259
|
+
name: 'isEnableLandingPage',
|
|
141
260
|
type: 'boolean',
|
|
142
261
|
default: false,
|
|
143
|
-
description: 'Whether
|
|
262
|
+
description: 'Whether visitors see a Posty5 page with the title and description below before they continue, instead of a direct redirect',
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
displayName: 'Page Description',
|
|
266
|
+
name: 'pageDescription',
|
|
267
|
+
type: 'string',
|
|
268
|
+
displayOptions: {
|
|
269
|
+
show: {
|
|
270
|
+
isEnableLandingPage: [true],
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
default: '',
|
|
274
|
+
description: 'Landing page description. Required when Landing Page is on.',
|
|
144
275
|
},
|
|
145
276
|
{
|
|
146
277
|
displayName: 'Page Title',
|
|
147
278
|
name: 'pageTitle',
|
|
148
279
|
type: 'string',
|
|
280
|
+
displayOptions: {
|
|
281
|
+
show: {
|
|
282
|
+
isEnableLandingPage: [true],
|
|
283
|
+
},
|
|
284
|
+
},
|
|
149
285
|
default: '',
|
|
150
|
-
description: 'Landing page title',
|
|
286
|
+
description: 'Landing page title. Required when Landing Page is on.',
|
|
151
287
|
},
|
|
152
288
|
{
|
|
153
|
-
displayName: '
|
|
154
|
-
name: '
|
|
289
|
+
displayName: 'Reference ID',
|
|
290
|
+
name: 'refId',
|
|
291
|
+
type: 'string',
|
|
292
|
+
default: '',
|
|
293
|
+
description: 'External reference ID. On Update, an empty value clears it.',
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
displayName: 'Tag (Deprecated — Use Tags)',
|
|
297
|
+
name: 'tag',
|
|
298
|
+
type: 'string',
|
|
299
|
+
default: '',
|
|
300
|
+
description: 'The primary tag. Kept for saved workflows: use Tags. On Update, an empty value clears it.',
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
displayName: 'Template ID (Deprecated)',
|
|
304
|
+
name: 'templateId',
|
|
155
305
|
type: 'string',
|
|
156
306
|
default: '',
|
|
157
|
-
description: '
|
|
307
|
+
description: 'Use the Template field instead. Read only when Template is empty, so workflows saved before version 4.6.0 keep their template.',
|
|
158
308
|
},
|
|
309
|
+
...short_link_controls_properties_1.SHORT_LINK_CONTROL_ADDITIONAL_FIELDS,
|
|
159
310
|
],
|
|
160
311
|
},
|
|
161
312
|
// Get, Update, Delete operation fields
|
|
@@ -166,7 +317,7 @@ class Posty5ShortLink {
|
|
|
166
317
|
required: true,
|
|
167
318
|
displayOptions: {
|
|
168
319
|
show: {
|
|
169
|
-
operation: ['get', 'update', 'delete'],
|
|
320
|
+
operation: ['get', 'getAnalytics', 'update', 'delete', 'setRules', 'checkHealth'],
|
|
170
321
|
},
|
|
171
322
|
},
|
|
172
323
|
default: '',
|
|
@@ -179,7 +330,7 @@ class Posty5ShortLink {
|
|
|
179
330
|
type: 'boolean',
|
|
180
331
|
displayOptions: {
|
|
181
332
|
show: {
|
|
182
|
-
operation: ['list'],
|
|
333
|
+
operation: ['list', 'listCampaigns'],
|
|
183
334
|
},
|
|
184
335
|
},
|
|
185
336
|
default: false,
|
|
@@ -191,7 +342,7 @@ class Posty5ShortLink {
|
|
|
191
342
|
type: 'number',
|
|
192
343
|
displayOptions: {
|
|
193
344
|
show: {
|
|
194
|
-
operation: ['list'],
|
|
345
|
+
operation: ['list', 'listCampaigns'],
|
|
195
346
|
returnAll: [false],
|
|
196
347
|
},
|
|
197
348
|
},
|
|
@@ -215,11 +366,18 @@ class Posty5ShortLink {
|
|
|
215
366
|
},
|
|
216
367
|
options: [
|
|
217
368
|
{
|
|
218
|
-
displayName: '
|
|
219
|
-
name: '
|
|
369
|
+
displayName: 'Destination URL Contains',
|
|
370
|
+
name: 'baseUrl',
|
|
220
371
|
type: 'string',
|
|
221
372
|
default: '',
|
|
222
|
-
description: '
|
|
373
|
+
description: 'Only links whose destination URL contains this text',
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
displayName: 'Landing Page Enabled',
|
|
377
|
+
name: 'isEnableLandingPage',
|
|
378
|
+
type: 'boolean',
|
|
379
|
+
default: true,
|
|
380
|
+
description: 'Whether to return only links with the landing page on (true) or only links without it (false)',
|
|
223
381
|
},
|
|
224
382
|
{
|
|
225
383
|
displayName: 'Reference ID',
|
|
@@ -233,12 +391,37 @@ class Posty5ShortLink {
|
|
|
233
391
|
name: 'search',
|
|
234
392
|
type: 'string',
|
|
235
393
|
default: '',
|
|
236
|
-
description: '
|
|
394
|
+
description: 'Only links whose name contains this text',
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
displayName: 'Tag (Deprecated — Use Tags)',
|
|
398
|
+
name: 'tag',
|
|
399
|
+
type: 'string',
|
|
400
|
+
default: '',
|
|
401
|
+
description: 'Filter by one tag. Kept for saved workflows: use Tags.',
|
|
237
402
|
},
|
|
403
|
+
...short_link_controls_properties_1.SHORT_LINK_CONTROL_LIST_FILTERS,
|
|
238
404
|
],
|
|
239
405
|
},
|
|
406
|
+
// Get Analytics operation fields (shared with the other link-tool node)
|
|
407
|
+
...analytics_properties_1.LINK_ANALYTICS_PROPERTIES,
|
|
408
|
+
// Get Statistics operation fields (shared with the other link-tool node)
|
|
409
|
+
...analytics_properties_1.LINK_STATISTICS_PROPERTIES,
|
|
410
|
+
// Create Many operation fields (shared with the other link-tool node)
|
|
411
|
+
...(0, link_bulk_properties_1.buildLinkBulkProperties)(true),
|
|
412
|
+
// Short link controls: Set Rules, List Tags, campaigns
|
|
413
|
+
...short_link_controls_properties_1.SHORT_LINK_SET_RULES_PROPERTIES,
|
|
414
|
+
...short_link_controls_properties_1.SHORT_LINK_LIST_TAGS_PROPERTIES,
|
|
415
|
+
...short_link_controls_properties_1.LINK_CAMPAIGN_PROPERTIES,
|
|
416
|
+
...(0, versioned_write_helpers_1.buildVersionedWriteProperties)(['update', 'delete', 'setRules', 'updateCampaign', 'deleteCampaign']),
|
|
240
417
|
],
|
|
241
418
|
};
|
|
419
|
+
this.methods = {
|
|
420
|
+
loadOptions: {
|
|
421
|
+
getQrTemplates: qr_templates_helpers_1.getQrTemplates,
|
|
422
|
+
getCampaigns: short_link_controls_helpers_1.getCampaigns,
|
|
423
|
+
},
|
|
424
|
+
};
|
|
242
425
|
}
|
|
243
426
|
async execute() {
|
|
244
427
|
const items = this.getInputData();
|
|
@@ -246,36 +429,33 @@ class Posty5ShortLink {
|
|
|
246
429
|
const operation = this.getNodeParameter('operation', 0);
|
|
247
430
|
const credentials = await this.getCredentials('posty5Api');
|
|
248
431
|
const apiKey = credentials.apiKey;
|
|
432
|
+
// Create Many reads every item once and answers one item per input item.
|
|
433
|
+
if (operation === 'createMany') {
|
|
434
|
+
if (!items.length)
|
|
435
|
+
return [[]];
|
|
436
|
+
const defaults = (0, link_bulk_helpers_1.readBulkDefaults)(this.getNodeParameter('bulkDefaults', 0, {}));
|
|
437
|
+
const options = this.getNodeParameter('bulkOptions', 0, {});
|
|
438
|
+
const prepared = (0, link_bulk_helpers_1.prepareBulkRows)(items.length, (i) => (0, helpers_1.buildShortLinkBulkRow)(this, i, defaults));
|
|
439
|
+
return [await (0, link_bulk_helpers_1.executeBulkCreate)(this, apiKey, (0, helpers_1.shortLinkBulkRoute)(options.fetchMetadata !== false), prepared, defaults, options)];
|
|
440
|
+
}
|
|
249
441
|
for (let i = 0; i < items.length; i++) {
|
|
250
442
|
try {
|
|
251
443
|
let responseData = {};
|
|
252
444
|
if (operation === 'create') {
|
|
253
|
-
const url = this.getNodeParameter('url', i);
|
|
254
|
-
const name = this.getNodeParameter('name', i, '');
|
|
255
|
-
const customLandingId = this.getNodeParameter('customLandingId', i, '');
|
|
256
445
|
const additionalFields = this.getNodeParameter('additionalFields', i, {});
|
|
446
|
+
const name = (0, link_tool_helpers_1.firstText)(this.getNodeParameter('name', i, ''));
|
|
447
|
+
const customLandingId = (0, link_tool_helpers_1.firstText)(this.getNodeParameter('customLandingId', i, ''));
|
|
257
448
|
const body = {
|
|
258
|
-
baseUrl: url,
|
|
449
|
+
baseUrl: (0, link_tool_helpers_1.toText)(this.getNodeParameter('url', i, '')).trim(),
|
|
450
|
+
templateId: (0, qr_templates_helpers_1.requireTemplateId)(this.getNodeParameter('templateId', i, ''), additionalFields),
|
|
451
|
+
...(0, link_tool_helpers_1.buildCommonCreateFields)(additionalFields),
|
|
452
|
+
...(0, link_tool_helpers_1.buildDeepLinkFields)(additionalFields, 'create'),
|
|
453
|
+
...(0, short_link_controls_helpers_1.buildControlFields)(this.getNode(), additionalFields, 'create', i),
|
|
259
454
|
};
|
|
260
455
|
if (name)
|
|
261
456
|
body.name = name;
|
|
262
457
|
if (customLandingId)
|
|
263
458
|
body.customLandingId = customLandingId;
|
|
264
|
-
if (additionalFields.tag)
|
|
265
|
-
body.tag = additionalFields.tag;
|
|
266
|
-
if (additionalFields.refId)
|
|
267
|
-
body.refId = additionalFields.refId;
|
|
268
|
-
if (additionalFields.templateId)
|
|
269
|
-
body.templateId = additionalFields.templateId;
|
|
270
|
-
if (additionalFields.isEnableMonetization !== undefined) {
|
|
271
|
-
body.isEnableMonetization = additionalFields.isEnableMonetization;
|
|
272
|
-
}
|
|
273
|
-
if (additionalFields.pageTitle || additionalFields.pageDescription) {
|
|
274
|
-
body.pageInfo = {
|
|
275
|
-
title: additionalFields.pageTitle || '',
|
|
276
|
-
description: additionalFields.pageDescription || '',
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
459
|
responseData = await api_helpers_1.makeApiRequest.call(this, apiKey, {
|
|
280
460
|
method: 'POST',
|
|
281
461
|
endpoint: constants_1.API_ENDPOINTS.SHORT_LINK,
|
|
@@ -289,55 +469,186 @@ class Posty5ShortLink {
|
|
|
289
469
|
endpoint: `${constants_1.API_ENDPOINTS.SHORT_LINK}/${shortLinkId}`,
|
|
290
470
|
});
|
|
291
471
|
}
|
|
472
|
+
else if (operation === 'getAnalytics') {
|
|
473
|
+
responseData = await (0, analytics_helpers_1.executeGetAnalytics)(this, apiKey, constants_1.API_ENDPOINTS.SHORT_LINK, this.getNodeParameter('shortLinkId', i), i);
|
|
474
|
+
}
|
|
475
|
+
else if (operation === 'getStatistics') {
|
|
476
|
+
responseData = await (0, analytics_helpers_1.executeGetStatistics)(this, apiKey, constants_1.API_ENDPOINTS.SHORT_LINK, i);
|
|
477
|
+
}
|
|
292
478
|
else if (operation === 'update') {
|
|
293
479
|
const shortLinkId = this.getNodeParameter('shortLinkId', i);
|
|
294
|
-
const name = this.getNodeParameter('name', i, '');
|
|
295
|
-
const customLandingId = this.getNodeParameter('customLandingId', i, '');
|
|
296
480
|
const additionalFields = this.getNodeParameter('additionalFields', i, {});
|
|
297
|
-
const
|
|
481
|
+
const endpoint = `${constants_1.API_ENDPOINTS.SHORT_LINK}/${shortLinkId}`;
|
|
482
|
+
// Fetch-then-put: the PUT replaces the record and requires `baseUrl`,
|
|
483
|
+
// so the stored link is the base and the user's fields go on top.
|
|
484
|
+
const stored = (await api_helpers_1.makeApiRequest.call(this, apiKey, {
|
|
485
|
+
method: 'GET',
|
|
486
|
+
endpoint,
|
|
487
|
+
}));
|
|
488
|
+
const body = {
|
|
489
|
+
...(0, link_tool_helpers_1.buildCommonUpdateFields)(additionalFields, stored),
|
|
490
|
+
...(0, link_tool_helpers_1.buildDeepLinkFields)(additionalFields, 'update'),
|
|
491
|
+
...(0, short_link_controls_helpers_1.buildControlFields)(this.getNode(), additionalFields, 'update', i),
|
|
492
|
+
baseUrl: (0, link_tool_helpers_1.firstText)(additionalFields.baseUrl, stored.baseUrl) || '',
|
|
493
|
+
templateId: (0, qr_templates_helpers_1.requireTemplateId)(this.getNodeParameter('templateId', i, ''), additionalFields, stored),
|
|
494
|
+
};
|
|
495
|
+
const name = (0, link_tool_helpers_1.firstText)(this.getNodeParameter('name', i, ''), stored.name);
|
|
298
496
|
if (name)
|
|
299
497
|
body.name = name;
|
|
300
|
-
if (
|
|
301
|
-
body.
|
|
302
|
-
if (additionalFields.tag)
|
|
303
|
-
body.tag = additionalFields.tag;
|
|
304
|
-
if (additionalFields.refId)
|
|
305
|
-
body.refId = additionalFields.refId;
|
|
306
|
-
if (additionalFields.templateId)
|
|
307
|
-
body.templateId = additionalFields.templateId;
|
|
308
|
-
if (additionalFields.isEnableMonetization !== undefined) {
|
|
309
|
-
body.isEnableMonetization = additionalFields.isEnableMonetization;
|
|
310
|
-
}
|
|
311
|
-
if (additionalFields.pageTitle || additionalFields.pageDescription) {
|
|
312
|
-
body.pageInfo = {
|
|
313
|
-
title: additionalFields.pageTitle || '',
|
|
314
|
-
description: additionalFields.pageDescription || '',
|
|
315
|
-
};
|
|
316
|
-
}
|
|
498
|
+
if (typeof stored.subCategory === 'number')
|
|
499
|
+
body.subCategory = stored.subCategory;
|
|
317
500
|
responseData = await api_helpers_1.makeApiRequest.call(this, apiKey, {
|
|
318
501
|
method: 'PUT',
|
|
319
|
-
endpoint
|
|
502
|
+
endpoint,
|
|
320
503
|
body,
|
|
504
|
+
version: await (0, versioned_write_helpers_1.resolveWriteVersion)(this, apiKey, i, endpoint, stored),
|
|
321
505
|
});
|
|
322
506
|
}
|
|
323
507
|
else if (operation === 'delete') {
|
|
324
508
|
const shortLinkId = this.getNodeParameter('shortLinkId', i);
|
|
509
|
+
const endpoint = `${constants_1.API_ENDPOINTS.SHORT_LINK}/${shortLinkId}`;
|
|
325
510
|
responseData = await api_helpers_1.makeApiRequest.call(this, apiKey, {
|
|
326
511
|
method: 'DELETE',
|
|
327
|
-
endpoint
|
|
512
|
+
endpoint,
|
|
513
|
+
version: await (0, versioned_write_helpers_1.resolveWriteVersion)(this, apiKey, i, endpoint),
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
else if (operation === 'setRules') {
|
|
517
|
+
// The update requires baseUrl and templateId, so the link is read first;
|
|
518
|
+
// only the rule sections the user added are sent (absent ones are kept).
|
|
519
|
+
const endpoint = `${constants_1.API_ENDPOINTS.SHORT_LINK}/${this.getNodeParameter('shortLinkId', i)}`;
|
|
520
|
+
const stored = (await api_helpers_1.makeApiRequest.call(this, apiKey, {
|
|
521
|
+
method: 'GET',
|
|
522
|
+
endpoint,
|
|
523
|
+
}));
|
|
524
|
+
const rules = this.getNodeParameter('rules', i, {});
|
|
525
|
+
const body = {
|
|
526
|
+
...(0, short_link_controls_helpers_1.buildControlFields)(this.getNode(), rules, 'update', i),
|
|
527
|
+
baseUrl: stored.baseUrl || '',
|
|
528
|
+
templateId: stored.templateId || stored.template?._id || '',
|
|
529
|
+
};
|
|
530
|
+
responseData = await api_helpers_1.makeApiRequest.call(this, apiKey, {
|
|
531
|
+
method: 'PUT',
|
|
532
|
+
endpoint,
|
|
533
|
+
body,
|
|
534
|
+
version: await (0, versioned_write_helpers_1.resolveWriteVersion)(this, apiKey, i, endpoint, stored),
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
else if (operation === 'listTags') {
|
|
538
|
+
const term = (0, link_tool_helpers_1.firstText)(this.getNodeParameter('term', i, ''));
|
|
539
|
+
const tags = (await api_helpers_1.makeApiRequest.call(this, apiKey, {
|
|
540
|
+
method: 'GET',
|
|
541
|
+
endpoint: `${constants_1.API_ENDPOINTS.SHORT_LINK}${constants_2.SHORT_LINK_CONTROLS.TAGS_PATH}`,
|
|
542
|
+
qs: term ? { term } : undefined,
|
|
543
|
+
}));
|
|
544
|
+
responseData = (tags || []).map((value) => ({ tag: value }));
|
|
545
|
+
}
|
|
546
|
+
else if (operation === 'checkHealth') {
|
|
547
|
+
const shortLinkId = this.getNodeParameter('shortLinkId', i);
|
|
548
|
+
await api_helpers_1.makeApiRequest.call(this, apiKey, {
|
|
549
|
+
method: 'POST',
|
|
550
|
+
endpoint: `${constants_1.API_ENDPOINTS.SHORT_LINK}/${shortLinkId}${constants_2.SHORT_LINK_CONTROLS.HEALTH_CHECK_PATH}`,
|
|
551
|
+
body: {},
|
|
552
|
+
stampCreatedFrom: false,
|
|
553
|
+
});
|
|
554
|
+
responseData = { shortLinkId, ...constants_2.SHORT_LINK_CONTROLS.HEALTH_CHECK_QUEUED };
|
|
555
|
+
}
|
|
556
|
+
else if (operation === 'createCampaign') {
|
|
557
|
+
const name = (0, link_tool_helpers_1.firstText)(this.getNodeParameter('campaignName', i, ''));
|
|
558
|
+
if (!name) {
|
|
559
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), constants_2.SHORT_LINK_CONTROLS_MESSAGES.CAMPAIGN_NAME_REQUIRED, {
|
|
560
|
+
itemIndex: i,
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
const fields = this.getNodeParameter('campaignFields', i, {});
|
|
564
|
+
responseData = await api_helpers_1.makeApiRequest.call(this, apiKey, {
|
|
565
|
+
method: 'POST',
|
|
566
|
+
endpoint: constants_1.API_ENDPOINTS.LINK_CAMPAIGN,
|
|
567
|
+
body: (0, short_link_controls_helpers_1.buildCampaignBody)(name, fields, 'create'),
|
|
328
568
|
});
|
|
329
569
|
}
|
|
570
|
+
else if (operation === 'getCampaign' ||
|
|
571
|
+
operation === 'updateCampaign' ||
|
|
572
|
+
operation === 'deleteCampaign') {
|
|
573
|
+
const campaignId = (0, link_tool_helpers_1.firstText)(this.getNodeParameter('campaignId', i, ''));
|
|
574
|
+
if (!campaignId) {
|
|
575
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), constants_2.SHORT_LINK_CONTROLS_MESSAGES.ID_REQUIRED('Campaign ID'), {
|
|
576
|
+
itemIndex: i,
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
const endpoint = `${constants_1.API_ENDPOINTS.LINK_CAMPAIGN}/${campaignId}`;
|
|
580
|
+
if (operation === 'getCampaign') {
|
|
581
|
+
responseData = await api_helpers_1.makeApiRequest.call(this, apiKey, { method: 'GET', endpoint });
|
|
582
|
+
}
|
|
583
|
+
else if (operation === 'updateCampaign') {
|
|
584
|
+
const fields = this.getNodeParameter('campaignFields', i, {});
|
|
585
|
+
const body = (0, short_link_controls_helpers_1.buildCampaignBody)((0, link_tool_helpers_1.firstText)(fields.name) || '', fields, 'update');
|
|
586
|
+
responseData = await api_helpers_1.makeApiRequest.call(this, apiKey, {
|
|
587
|
+
method: 'PUT',
|
|
588
|
+
endpoint,
|
|
589
|
+
body,
|
|
590
|
+
version: await (0, versioned_write_helpers_1.resolveWriteVersion)(this, apiKey, i, endpoint),
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
else {
|
|
594
|
+
const detach = this.getNodeParameter('detach', i, false);
|
|
595
|
+
const deleted = await api_helpers_1.makeApiRequest.call(this, apiKey, {
|
|
596
|
+
method: 'DELETE',
|
|
597
|
+
endpoint,
|
|
598
|
+
qs: detach ? { detach: true } : undefined,
|
|
599
|
+
version: await (0, versioned_write_helpers_1.resolveWriteVersion)(this, apiKey, i, endpoint),
|
|
600
|
+
});
|
|
601
|
+
responseData = deleted || { campaignId, deleted: true };
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
else if (operation === 'listCampaigns') {
|
|
605
|
+
const returnAll = this.getNodeParameter('returnAll', i, false);
|
|
606
|
+
const filters = this.getNodeParameter('campaignFilters', i, {});
|
|
607
|
+
const qs = {};
|
|
608
|
+
const term = (0, link_tool_helpers_1.firstText)(filters.term);
|
|
609
|
+
if (term)
|
|
610
|
+
qs.term = term;
|
|
611
|
+
if (typeof filters.archived === 'boolean')
|
|
612
|
+
qs.archived = filters.archived;
|
|
613
|
+
if (returnAll) {
|
|
614
|
+
responseData = await api_helpers_1.makePaginatedRequest.call(this, apiKey, constants_1.API_ENDPOINTS.LINK_CAMPAIGN, qs);
|
|
615
|
+
}
|
|
616
|
+
else {
|
|
617
|
+
const limit = this.getNodeParameter('limit', i, 50);
|
|
618
|
+
const result = await api_helpers_1.makeApiRequest.call(this, apiKey, {
|
|
619
|
+
method: 'GET',
|
|
620
|
+
endpoint: constants_1.API_ENDPOINTS.LINK_CAMPAIGN,
|
|
621
|
+
qs: { ...qs, page: 1, pageSize: limit },
|
|
622
|
+
});
|
|
623
|
+
responseData = result?.items || [];
|
|
624
|
+
}
|
|
625
|
+
}
|
|
330
626
|
else if (operation === 'list') {
|
|
331
627
|
const returnAll = this.getNodeParameter('returnAll', i, false);
|
|
332
628
|
const filters = this.getNodeParameter('filters', i, {});
|
|
629
|
+
// Each filter narrows the list (the API ANDs them), so Search matches
|
|
630
|
+
// the name only and the destination URL has a filter of its own.
|
|
333
631
|
const qs = {};
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
632
|
+
const tag = (0, link_tool_helpers_1.firstText)(filters.tag);
|
|
633
|
+
const refId = (0, link_tool_helpers_1.firstText)(filters.refId);
|
|
634
|
+
const name = (0, link_tool_helpers_1.firstText)(filters.search);
|
|
635
|
+
const baseUrl = (0, link_tool_helpers_1.firstText)(filters.baseUrl);
|
|
636
|
+
const tags = (0, short_link_controls_helpers_1.splitList)(filters.tags);
|
|
637
|
+
const campaignId = (0, link_tool_helpers_1.firstText)(filters.campaignId);
|
|
638
|
+
if (tag)
|
|
639
|
+
qs.tag = tag;
|
|
640
|
+
if (tags.length)
|
|
641
|
+
qs.tags = tags.join(constants_2.SHORT_LINK_CONTROLS.TAGS_SEPARATOR);
|
|
642
|
+
if (campaignId)
|
|
643
|
+
qs.campaignId = campaignId;
|
|
644
|
+
if (refId)
|
|
645
|
+
qs.refId = refId;
|
|
646
|
+
if (name)
|
|
647
|
+
qs.name = name;
|
|
648
|
+
if (baseUrl)
|
|
649
|
+
qs.baseUrl = baseUrl;
|
|
650
|
+
if (typeof filters.isEnableLandingPage === 'boolean') {
|
|
651
|
+
qs.isEnableLandingPage = filters.isEnableLandingPage;
|
|
341
652
|
}
|
|
342
653
|
if (returnAll) {
|
|
343
654
|
responseData = await api_helpers_1.makePaginatedRequest.call(this, apiKey, constants_1.API_ENDPOINTS.SHORT_LINK, qs);
|