@limetech/n8n-nodes-lime 2.7.0-dev.1 → 3.1.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.
Files changed (196) hide show
  1. package/.devcontainer/devcontainer.json +44 -0
  2. package/.devcontainer/docker-compose.yml +27 -0
  3. package/.gitattributes +34 -0
  4. package/.nvmrc +1 -0
  5. package/CHANGELOG.md +17 -5
  6. package/README.md +40 -47
  7. package/credentials/index.ts +0 -1
  8. package/dist/credentials/index.d.ts +0 -1
  9. package/dist/credentials/index.js +0 -1
  10. package/dist/credentials/index.js.map +1 -1
  11. package/dist/nodes/index.d.ts +0 -1
  12. package/dist/nodes/index.js +0 -1
  13. package/dist/nodes/index.js.map +1 -1
  14. package/dist/nodes/lime-crm/LimeCrmNode.node.d.ts +1 -4
  15. package/dist/nodes/lime-crm/LimeCrmNode.node.js +0 -3
  16. package/dist/nodes/lime-crm/LimeCrmNode.node.js.map +1 -1
  17. package/dist/nodes/lime-crm/methods/getLimetypeProperties.d.ts +0 -2
  18. package/dist/nodes/lime-crm/methods/getLimetypeProperties.js +0 -43
  19. package/dist/nodes/lime-crm/methods/getLimetypeProperties.js.map +1 -1
  20. package/dist/nodes/lime-crm/methods/index.d.ts +2 -2
  21. package/dist/nodes/lime-crm/methods/index.js +1 -4
  22. package/dist/nodes/lime-crm/methods/index.js.map +1 -1
  23. package/dist/nodes/lime-crm/methods/resourceMapping.d.ts +0 -1
  24. package/dist/nodes/lime-crm/methods/resourceMapping.js +0 -46
  25. package/dist/nodes/lime-crm/methods/resourceMapping.js.map +1 -1
  26. package/dist/nodes/lime-crm/models/limetype.d.ts +0 -1
  27. package/dist/nodes/lime-crm/resources/data/index.d.ts +1 -1
  28. package/dist/nodes/lime-crm/resources/data/index.js +0 -20
  29. package/dist/nodes/lime-crm/resources/data/index.js.map +1 -1
  30. package/dist/nodes/lime-crm/resources/data/operations/index.d.ts +0 -4
  31. package/dist/nodes/lime-crm/resources/data/operations/index.js +1 -5
  32. package/dist/nodes/lime-crm/resources/data/operations/index.js.map +1 -1
  33. package/dist/nodes/lime-crm/transport/index.d.ts +0 -1
  34. package/dist/nodes/lime-crm/transport/index.js +1 -6
  35. package/dist/nodes/lime-crm/transport/index.js.map +1 -1
  36. package/dist/nodes/lime-crm/transport/limetypes.js +4 -15
  37. package/dist/nodes/lime-crm/transport/limetypes.js.map +1 -1
  38. package/dist/nodes/lime-forms/LimeFormsTrigger.node.js +3 -3
  39. package/dist/nodes/lime-forms/LimeFormsTrigger.node.js.map +1 -1
  40. package/dist/nodes/lime-forms/assets/lime-crm.svg +1 -0
  41. package/dist/package.json +5 -12
  42. package/dist/tsconfig.tsbuildinfo +1 -1
  43. package/nodes/index.ts +0 -1
  44. package/nodes/lime-crm/LimeCrmNode.node.ts +0 -6
  45. package/nodes/lime-crm/methods/getLimetypeProperties.ts +0 -84
  46. package/nodes/lime-crm/methods/index.ts +0 -3
  47. package/nodes/lime-crm/methods/resourceMapping.ts +0 -76
  48. package/nodes/lime-crm/models/limetype.ts +0 -1
  49. package/nodes/lime-crm/resources/data/index.ts +1 -34
  50. package/nodes/lime-crm/resources/data/operations/index.ts +0 -17
  51. package/nodes/lime-crm/transport/index.ts +0 -8
  52. package/nodes/lime-crm/transport/limetypes.ts +8 -26
  53. package/nodes/lime-forms/LimeFormsTrigger.node.ts +3 -3
  54. package/nodes/lime-forms/assets/lime-crm.svg +1 -0
  55. package/package.json +6 -13
  56. package/credentials/FortnoxApi.credentials.ts +0 -61
  57. package/dist/credentials/FortnoxApi.credentials.d.ts +0 -9
  58. package/dist/credentials/FortnoxApi.credentials.js +0 -57
  59. package/dist/credentials/FortnoxApi.credentials.js.map +0 -1
  60. package/dist/nodes/fortnox/Fortnox.node.d.ts +0 -5
  61. package/dist/nodes/fortnox/Fortnox.node.js +0 -95
  62. package/dist/nodes/fortnox/Fortnox.node.js.map +0 -1
  63. package/dist/nodes/fortnox/Fortnox.node.json +0 -18
  64. package/dist/nodes/fortnox/FortnoxTrigger.node.d.ts +0 -5
  65. package/dist/nodes/fortnox/FortnoxTrigger.node.js +0 -155
  66. package/dist/nodes/fortnox/FortnoxTrigger.node.js.map +0 -1
  67. package/dist/nodes/fortnox/FortnoxTrigger.node.json +0 -18
  68. package/dist/nodes/fortnox/commons.d.ts +0 -25
  69. package/dist/nodes/fortnox/commons.js +0 -44
  70. package/dist/nodes/fortnox/commons.js.map +0 -1
  71. package/dist/nodes/fortnox/fortnoxLogo.svg +0 -15
  72. package/dist/nodes/fortnox/index.d.ts +0 -6
  73. package/dist/nodes/fortnox/index.js +0 -23
  74. package/dist/nodes/fortnox/index.js.map +0 -1
  75. package/dist/nodes/fortnox/model.d.ts +0 -20
  76. package/dist/nodes/fortnox/model.js +0 -3
  77. package/dist/nodes/fortnox/model.js.map +0 -1
  78. package/dist/nodes/fortnox/resources/customers/filterParameters.d.ts +0 -2
  79. package/dist/nodes/fortnox/resources/customers/filterParameters.js +0 -31
  80. package/dist/nodes/fortnox/resources/customers/filterParameters.js.map +0 -1
  81. package/dist/nodes/fortnox/resources/customers/index.d.ts +0 -7
  82. package/dist/nodes/fortnox/resources/customers/index.js +0 -85
  83. package/dist/nodes/fortnox/resources/customers/index.js.map +0 -1
  84. package/dist/nodes/fortnox/resources/customers/model.d.ts +0 -99
  85. package/dist/nodes/fortnox/resources/customers/model.js +0 -3
  86. package/dist/nodes/fortnox/resources/customers/model.js.map +0 -1
  87. package/dist/nodes/fortnox/resources/customers/operations/create.operation.d.ts +0 -10
  88. package/dist/nodes/fortnox/resources/customers/operations/create.operation.js +0 -281
  89. package/dist/nodes/fortnox/resources/customers/operations/create.operation.js.map +0 -1
  90. package/dist/nodes/fortnox/resources/customers/operations/delete.operation.d.ts +0 -9
  91. package/dist/nodes/fortnox/resources/customers/operations/delete.operation.js +0 -38
  92. package/dist/nodes/fortnox/resources/customers/operations/delete.operation.js.map +0 -1
  93. package/dist/nodes/fortnox/resources/customers/operations/get.operation.d.ts +0 -10
  94. package/dist/nodes/fortnox/resources/customers/operations/get.operation.js +0 -38
  95. package/dist/nodes/fortnox/resources/customers/operations/get.operation.js.map +0 -1
  96. package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.d.ts +0 -10
  97. package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.js +0 -68
  98. package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.js.map +0 -1
  99. package/dist/nodes/fortnox/resources/customers/operations/index.d.ts +0 -5
  100. package/dist/nodes/fortnox/resources/customers/operations/index.js +0 -42
  101. package/dist/nodes/fortnox/resources/customers/operations/index.js.map +0 -1
  102. package/dist/nodes/fortnox/resources/customers/operations/update.operation.d.ts +0 -10
  103. package/dist/nodes/fortnox/resources/customers/operations/update.operation.js +0 -261
  104. package/dist/nodes/fortnox/resources/customers/operations/update.operation.js.map +0 -1
  105. package/dist/nodes/fortnox/resources/customers/sortParameters.d.ts +0 -2
  106. package/dist/nodes/fortnox/resources/customers/sortParameters.js +0 -30
  107. package/dist/nodes/fortnox/resources/customers/sortParameters.js.map +0 -1
  108. package/dist/nodes/fortnox/resources/invoice/filterParameters.d.ts +0 -2
  109. package/dist/nodes/fortnox/resources/invoice/filterParameters.js +0 -72
  110. package/dist/nodes/fortnox/resources/invoice/filterParameters.js.map +0 -1
  111. package/dist/nodes/fortnox/resources/invoice/index.d.ts +0 -7
  112. package/dist/nodes/fortnox/resources/invoice/index.js +0 -81
  113. package/dist/nodes/fortnox/resources/invoice/index.js.map +0 -1
  114. package/dist/nodes/fortnox/resources/invoice/invoiceParameters.d.ts +0 -2
  115. package/dist/nodes/fortnox/resources/invoice/invoiceParameters.js +0 -193
  116. package/dist/nodes/fortnox/resources/invoice/invoiceParameters.js.map +0 -1
  117. package/dist/nodes/fortnox/resources/invoice/model.d.ts +0 -147
  118. package/dist/nodes/fortnox/resources/invoice/model.js +0 -3
  119. package/dist/nodes/fortnox/resources/invoice/model.js.map +0 -1
  120. package/dist/nodes/fortnox/resources/invoice/operations/create.operation.d.ts +0 -10
  121. package/dist/nodes/fortnox/resources/invoice/operations/create.operation.js +0 -64
  122. package/dist/nodes/fortnox/resources/invoice/operations/create.operation.js.map +0 -1
  123. package/dist/nodes/fortnox/resources/invoice/operations/get.operation.d.ts +0 -10
  124. package/dist/nodes/fortnox/resources/invoice/operations/get.operation.js +0 -37
  125. package/dist/nodes/fortnox/resources/invoice/operations/get.operation.js.map +0 -1
  126. package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.d.ts +0 -10
  127. package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.js +0 -92
  128. package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.js.map +0 -1
  129. package/dist/nodes/fortnox/resources/invoice/operations/index.d.ts +0 -4
  130. package/dist/nodes/fortnox/resources/invoice/operations/index.js +0 -41
  131. package/dist/nodes/fortnox/resources/invoice/operations/index.js.map +0 -1
  132. package/dist/nodes/fortnox/resources/invoice/operations/update.operation.d.ts +0 -10
  133. package/dist/nodes/fortnox/resources/invoice/operations/update.operation.js +0 -64
  134. package/dist/nodes/fortnox/resources/invoice/operations/update.operation.js.map +0 -1
  135. package/dist/nodes/fortnox/transport/errorCodes.d.ts +0 -1
  136. package/dist/nodes/fortnox/transport/errorCodes.js +0 -50
  137. package/dist/nodes/fortnox/transport/errorCodes.js.map +0 -1
  138. package/dist/nodes/fortnox/transport/index.d.ts +0 -3
  139. package/dist/nodes/fortnox/transport/index.js +0 -76
  140. package/dist/nodes/fortnox/transport/index.js.map +0 -1
  141. package/dist/nodes/lime-crm/resources/data/operations/bulkImportCommons.d.ts +0 -5
  142. package/dist/nodes/lime-crm/resources/data/operations/bulkImportCommons.js +0 -230
  143. package/dist/nodes/lime-crm/resources/data/operations/bulkImportCommons.js.map +0 -1
  144. package/dist/nodes/lime-crm/resources/data/operations/createManyObjects.operation.d.ts +0 -9
  145. package/dist/nodes/lime-crm/resources/data/operations/createManyObjects.operation.js +0 -16
  146. package/dist/nodes/lime-crm/resources/data/operations/createManyObjects.operation.js.map +0 -1
  147. package/dist/nodes/lime-crm/resources/data/operations/createOrUpdateManyObjects.operation.d.ts +0 -9
  148. package/dist/nodes/lime-crm/resources/data/operations/createOrUpdateManyObjects.operation.js +0 -16
  149. package/dist/nodes/lime-crm/resources/data/operations/createOrUpdateManyObjects.operation.js.map +0 -1
  150. package/dist/nodes/lime-crm/resources/data/operations/deprecated-startBulkImport.operation.d.ts +0 -9
  151. package/dist/nodes/lime-crm/resources/data/operations/deprecated-startBulkImport.operation.js +0 -241
  152. package/dist/nodes/lime-crm/resources/data/operations/deprecated-startBulkImport.operation.js.map +0 -1
  153. package/dist/nodes/lime-crm/resources/data/operations/updateManyObjects.operation.d.ts +0 -9
  154. package/dist/nodes/lime-crm/resources/data/operations/updateManyObjects.operation.js +0 -16
  155. package/dist/nodes/lime-crm/resources/data/operations/updateManyObjects.operation.js.map +0 -1
  156. package/dist/nodes/lime-crm/transport/bulkimport.d.ts +0 -41
  157. package/dist/nodes/lime-crm/transport/bulkimport.js +0 -86
  158. package/dist/nodes/lime-crm/transport/bulkimport.js.map +0 -1
  159. package/dist/nodes/lime-forms/lime-forms.svg +0 -6
  160. package/docker-compose.yml +0 -0
  161. package/nodes/fortnox/Fortnox.node.json +0 -18
  162. package/nodes/fortnox/Fortnox.node.ts +0 -102
  163. package/nodes/fortnox/FortnoxTrigger.node.json +0 -18
  164. package/nodes/fortnox/FortnoxTrigger.node.ts +0 -196
  165. package/nodes/fortnox/commons.ts +0 -94
  166. package/nodes/fortnox/fortnoxLogo.svg +0 -15
  167. package/nodes/fortnox/index.ts +0 -6
  168. package/nodes/fortnox/model.ts +0 -25
  169. package/nodes/fortnox/resources/customers/filterParameters.ts +0 -47
  170. package/nodes/fortnox/resources/customers/index.ts +0 -53
  171. package/nodes/fortnox/resources/customers/model.ts +0 -107
  172. package/nodes/fortnox/resources/customers/operations/create.operation.ts +0 -307
  173. package/nodes/fortnox/resources/customers/operations/delete.operation.ts +0 -49
  174. package/nodes/fortnox/resources/customers/operations/get.operation.ts +0 -50
  175. package/nodes/fortnox/resources/customers/operations/getAll.operation.ts +0 -79
  176. package/nodes/fortnox/resources/customers/operations/index.ts +0 -5
  177. package/nodes/fortnox/resources/customers/operations/update.operation.ts +0 -288
  178. package/nodes/fortnox/resources/customers/sortParameters.ts +0 -32
  179. package/nodes/fortnox/resources/invoice/filterParameters.ts +0 -88
  180. package/nodes/fortnox/resources/invoice/index.ts +0 -49
  181. package/nodes/fortnox/resources/invoice/invoiceParameters.ts +0 -214
  182. package/nodes/fortnox/resources/invoice/model.ts +0 -156
  183. package/nodes/fortnox/resources/invoice/operations/create.operation.ts +0 -71
  184. package/nodes/fortnox/resources/invoice/operations/get.operation.ts +0 -50
  185. package/nodes/fortnox/resources/invoice/operations/getAll.operation.ts +0 -100
  186. package/nodes/fortnox/resources/invoice/operations/index.ts +0 -4
  187. package/nodes/fortnox/resources/invoice/operations/update.operation.ts +0 -79
  188. package/nodes/fortnox/transport/errorCodes.ts +0 -62
  189. package/nodes/fortnox/transport/index.ts +0 -106
  190. package/nodes/lime-crm/resources/data/operations/bulkImportCommons.ts +0 -323
  191. package/nodes/lime-crm/resources/data/operations/createManyObjects.operation.ts +0 -44
  192. package/nodes/lime-crm/resources/data/operations/createOrUpdateManyObjects.operation.ts +0 -44
  193. package/nodes/lime-crm/resources/data/operations/deprecated-startBulkImport.operation.ts +0 -364
  194. package/nodes/lime-crm/resources/data/operations/updateManyObjects.operation.ts +0 -44
  195. package/nodes/lime-crm/transport/bulkimport.ts +0 -271
  196. package/nodes/lime-forms/lime-forms.svg +0 -6
@@ -1,307 +0,0 @@
1
- import {
2
- IExecuteFunctions,
3
- INodeProperties,
4
- IDataObject,
5
- NodeOperationError,
6
- } from 'n8n-workflow';
7
- import { apiRequest } from '../../../transport';
8
- import { code as currencyCode } from 'currency-codes';
9
- import { CustomerResponse } from '../model';
10
-
11
- export const description = {
12
- name: 'Create Customer',
13
- value: 'create',
14
- description: 'Create a new customer',
15
- action: 'Create a customer',
16
- };
17
-
18
- const createProperties: INodeProperties[] = [
19
- {
20
- displayName: 'Address 1',
21
- name: 'Address1',
22
- type: 'string',
23
- default: '',
24
- description: "Customer's primary address",
25
- },
26
- {
27
- displayName: 'Address 2',
28
- name: 'Address2',
29
- type: 'string',
30
- default: '',
31
- description: "Customer's secondary address",
32
- },
33
- {
34
- displayName: 'City',
35
- name: 'City',
36
- type: 'string',
37
- default: '',
38
- description: "Customer's city",
39
- },
40
- {
41
- displayName: 'Comments',
42
- name: 'Comments',
43
- type: 'string',
44
- default: '',
45
- description: 'Comments about the customer',
46
- },
47
- {
48
- displayName: 'Cost Center',
49
- name: 'CostCenter',
50
- type: 'string',
51
- default: '',
52
- description: "Customer's cost center",
53
- },
54
- {
55
- displayName: 'Country',
56
- name: 'Country',
57
- type: 'string',
58
- default: '',
59
- description: "Customer's country",
60
- },
61
- {
62
- displayName: 'Country Code',
63
- name: 'CountryCode',
64
- type: 'string',
65
- default: '',
66
- description: "Customer's country code",
67
- },
68
- {
69
- displayName: 'Email',
70
- name: 'Email',
71
- type: 'string',
72
- default: '',
73
- description: "Customer's email address",
74
- },
75
- {
76
- displayName: 'External Reference',
77
- name: 'ExternalReference',
78
- type: 'string',
79
- default: '',
80
- description: 'External reference for the customer',
81
- },
82
- {
83
- displayName: 'Fax',
84
- name: 'Fax',
85
- type: 'string',
86
- default: '',
87
- description: "Customer's fax number",
88
- },
89
- {
90
- displayName: 'GLN',
91
- name: 'GLN',
92
- type: 'string',
93
- default: '',
94
- description: 'Global Location Number',
95
- },
96
- {
97
- displayName: 'Organisation Number',
98
- name: 'OrganisationNumber',
99
- type: 'string',
100
- default: '',
101
- description: "Customer's organisation number",
102
- },
103
- {
104
- displayName: 'Phone 1',
105
- name: 'Phone1',
106
- type: 'string',
107
- default: '',
108
- description: "Customer's primary phone number",
109
- },
110
- {
111
- displayName: 'Phone 2',
112
- name: 'Phone2',
113
- type: 'string',
114
- default: '',
115
- description: "Customer's secondary phone number",
116
- },
117
- {
118
- displayName: 'VAT Number',
119
- name: 'VATNumber',
120
- type: 'string',
121
- default: '',
122
- description: "Customer's VAT number",
123
- },
124
- {
125
- displayName: 'Website',
126
- name: 'WWW',
127
- type: 'string',
128
- default: '',
129
- description: "Customer's website URL",
130
- },
131
- {
132
- displayName: 'ZIP Code',
133
- name: 'ZipCode',
134
- type: 'string',
135
- default: '',
136
- description: "Customer's ZIP/postal code",
137
- },
138
- ];
139
-
140
- export const properties: INodeProperties[] = [
141
- {
142
- displayName: 'Name',
143
- name: 'Name',
144
- type: 'string',
145
- required: true,
146
- default: '',
147
- description: 'Customer name',
148
- displayOptions: {
149
- show: {
150
- resource: ['customer'],
151
- operation: ['create'],
152
- },
153
- },
154
- },
155
- {
156
- displayName: 'Active',
157
- name: 'Active',
158
- type: 'boolean',
159
- required: true,
160
- default: true,
161
- description: 'Whether the customer is active',
162
- displayOptions: {
163
- show: {
164
- resource: ['customer'],
165
- operation: ['create'],
166
- },
167
- },
168
- },
169
- {
170
- displayName: 'Currency',
171
- name: 'Currency',
172
- type: 'string',
173
- required: true,
174
- default: 'SEK',
175
- description: 'Currency',
176
- displayOptions: {
177
- show: {
178
- resource: ['customer'],
179
- operation: ['create'],
180
- },
181
- },
182
- },
183
- {
184
- displayName: 'Type',
185
- name: 'Type',
186
- type: 'options',
187
- required: true,
188
- options: [
189
- {
190
- name: 'Private',
191
- value: 'PRIVATE',
192
- },
193
- {
194
- name: 'Company',
195
- value: 'COMPANY',
196
- },
197
- ],
198
- default: 'COMPANY',
199
- description: 'Type of customer',
200
- displayOptions: {
201
- show: {
202
- resource: ['customer'],
203
- operation: ['create'],
204
- },
205
- },
206
- },
207
- {
208
- displayName: 'VAT Type',
209
- name: 'VATType',
210
- type: 'options',
211
- required: true,
212
-
213
- options: [
214
- {
215
- name: 'SE VAT',
216
- value: 'SEVAT',
217
- },
218
- {
219
- name: 'SE Reversed VAT',
220
- value: 'SEREVERSEDVAT',
221
- },
222
- {
223
- name: 'EU Reversed VAT',
224
- value: 'EUREVERSEDVAT',
225
- },
226
- {
227
- name: 'EU VAT',
228
- value: 'EUVAT',
229
- },
230
- {
231
- name: 'Export',
232
- value: 'EXPORT',
233
- },
234
- ],
235
- default: 'SEVAT',
236
- description: 'Type of VAT applied',
237
- displayOptions: {
238
- show: {
239
- resource: ['customer'],
240
- operation: ['create'],
241
- },
242
- },
243
- },
244
- // Additional Fields
245
- {
246
- displayName: 'Additional Fields',
247
- name: 'additionalFields',
248
- type: 'collection',
249
- placeholder: 'Add Field',
250
- default: {},
251
- displayOptions: {
252
- show: {
253
- resource: ['customer'],
254
- operation: ['create'],
255
- },
256
- },
257
- options: [...createProperties],
258
- },
259
- ];
260
-
261
- export async function execute(
262
- this: IExecuteFunctions,
263
- i: number
264
- ): Promise<CustomerResponse> {
265
- const name = this.getNodeParameter('Name', i) as string;
266
- let currency = this.getNodeParameter('Currency', i) as string;
267
- currency = currency.toUpperCase();
268
- const active = this.getNodeParameter('Active', i) as boolean;
269
- const type = this.getNodeParameter('Type', i) as 'COMPANY' | 'PRIVATE';
270
- const vatType = this.getNodeParameter('VATType', i) as
271
- | 'SEVAT'
272
- | 'SEREVERSEDVAT'
273
- | 'EUREVERSEDVAT'
274
- | 'EUVAT'
275
- | 'EXPORT';
276
- const additionalFields = this.getNodeParameter(
277
- 'additionalFields',
278
- i,
279
- {}
280
- ) as IDataObject;
281
-
282
- if (currencyCode(currency) === undefined) {
283
- throw new NodeOperationError(
284
- this.getNode(),
285
- `Invalid currency code: ${currency}. Use ISO 4217 currency code.`
286
- );
287
- }
288
-
289
- const body = {
290
- Customer: {
291
- Name: name,
292
- Currency: currency,
293
- Active: active,
294
- Type: type,
295
- VATType: vatType,
296
- ...additionalFields,
297
- },
298
- };
299
-
300
- const endpoint = `/customers`;
301
-
302
- return await apiRequest<CustomerResponse>(this, {
303
- method: 'POST',
304
- endpoint: endpoint,
305
- body: body,
306
- });
307
- }
@@ -1,49 +0,0 @@
1
- import { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
2
- import { apiRequest } from '../../../transport';
3
-
4
- export const description = {
5
- name: 'Delete Customer',
6
- value: 'delete',
7
- description: 'Delete a single company by customer number',
8
- action: 'Delete a customer',
9
- };
10
-
11
- export const properties: INodeProperties[] = [
12
- {
13
- displayName: 'Customer Number',
14
- name: 'customerNumber',
15
- type: 'string',
16
- required: true,
17
- default: '',
18
- description: 'Unique identifier for customer',
19
- displayOptions: {
20
- show: {
21
- resource: ['customer'],
22
- operation: ['delete'],
23
- },
24
- },
25
- },
26
- ];
27
-
28
- export async function execute(
29
- this: IExecuteFunctions,
30
- i: number
31
- ): Promise<null> {
32
- const customerNumber = this.getNodeParameter(
33
- 'customerNumber',
34
- i,
35
- ''
36
- ) as string;
37
-
38
- const endpoint = `/customers/${encodeURIComponent(customerNumber)}`;
39
- return await apiRequest<null>(
40
- this,
41
- {
42
- method: 'DELETE',
43
- endpoint,
44
- },
45
- {
46
- id: customerNumber,
47
- }
48
- );
49
- }
@@ -1,50 +0,0 @@
1
- import { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
2
- import { apiRequest } from '../../../transport';
3
- import { CustomerResponse } from '../model';
4
-
5
- export const description = {
6
- name: 'Get Customer',
7
- value: 'get',
8
- description: 'Get a single company by customer number',
9
- action: 'Get a customer',
10
- };
11
-
12
- export const properties: INodeProperties[] = [
13
- {
14
- displayName: 'Customer Number',
15
- name: 'customerNumber',
16
- type: 'string',
17
- required: true,
18
- default: '',
19
- description: 'Unique identifier for customer',
20
- displayOptions: {
21
- show: {
22
- resource: ['customer'],
23
- operation: ['get'],
24
- },
25
- },
26
- },
27
- ];
28
-
29
- export async function execute(
30
- this: IExecuteFunctions,
31
- i: number
32
- ): Promise<CustomerResponse> {
33
- const customerNumber = this.getNodeParameter(
34
- 'customerNumber',
35
- i,
36
- ''
37
- ) as string;
38
-
39
- const endpoint = `/customers/${encodeURIComponent(customerNumber)}`;
40
- return await apiRequest<CustomerResponse>(
41
- this,
42
- {
43
- method: 'GET',
44
- endpoint,
45
- },
46
- {
47
- id: customerNumber,
48
- }
49
- );
50
- }
@@ -1,79 +0,0 @@
1
- import { IExecuteFunctions, INodeProperties, IDataObject } from 'n8n-workflow';
2
- import { apiRequest } from '../../../transport';
3
- import { filterParameters } from '../filterParameters';
4
- import { sortParameters } from '../sortParameters';
5
- import { CustomersResponse } from '../model';
6
-
7
- export const description = {
8
- name: 'Get All Customers',
9
- value: 'getAll',
10
- description: 'Get all customers',
11
- action: 'Get all customers',
12
- };
13
-
14
- export const properties: INodeProperties[] = [
15
- {
16
- displayName: 'Filter by',
17
- name: 'filterParameters',
18
- type: 'collection',
19
- placeholder: 'Add Parameter',
20
- default: {},
21
- displayOptions: {
22
- show: {
23
- resource: ['customer'],
24
- operation: ['getAll'],
25
- },
26
- },
27
- options: filterParameters,
28
- },
29
- {
30
- displayName: 'Sort by',
31
- name: 'sortParameters',
32
- type: 'collection',
33
- placeholder: 'Add Parameter',
34
- default: {},
35
- displayOptions: {
36
- show: {
37
- resource: ['customer'],
38
- operation: ['getAll'],
39
- },
40
- },
41
- options: sortParameters,
42
- },
43
- ];
44
-
45
- export async function execute(
46
- this: IExecuteFunctions,
47
- i: number
48
- ): Promise<CustomersResponse> {
49
- const filterParameters = this.getNodeParameter('filterParameters', i, {});
50
- const sortParameters = this.getNodeParameter(
51
- 'sortParameters',
52
- i,
53
- {}
54
- ) as IDataObject;
55
-
56
- const qs: IDataObject = {};
57
- if (filterParameters) {
58
- for (const [key, value] of Object.entries(filterParameters)) {
59
- if (value !== '' && value !== undefined && value !== null) {
60
- qs[key] = value;
61
- }
62
- }
63
- }
64
-
65
- if (sortParameters && Object.keys(sortParameters).length > 0) {
66
- qs['sortby'] = Object.entries(sortParameters)
67
- .filter(([, value]) => value)
68
- .map(([, value]) => `${value}`)
69
- .join('');
70
- }
71
-
72
- const endpoint = `/customers`;
73
-
74
- return await apiRequest<CustomersResponse>(this, {
75
- method: 'GET',
76
- endpoint: endpoint,
77
- qs: qs,
78
- });
79
- }
@@ -1,5 +0,0 @@
1
- export * as createSingleCustomer from './create.operation';
2
- export * as deleteSingleCustomer from './delete.operation';
3
- export * as getSingleCustomer from './get.operation';
4
- export * as getManyCustomers from './getAll.operation';
5
- export * as updateSingleCustomer from './update.operation';