@apideck/unify 0.40.0 → 0.41.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 (96) hide show
  1. package/jsr.json +1 -1
  2. package/lib/config.d.ts +4 -4
  3. package/lib/config.js +4 -4
  4. package/package.json +6 -2
  5. package/src/__tests__/activities.test.ts +1141 -0
  6. package/src/__tests__/agedcreditors.test.ts +280 -0
  7. package/src/__tests__/ageddebtors.test.ts +280 -0
  8. package/src/__tests__/apideckcompanies.test.ts +1082 -0
  9. package/src/__tests__/apideckcustomers.test.ts +364 -0
  10. package/src/__tests__/apideckdepartments.test.ts +497 -0
  11. package/src/__tests__/apiresources.test.ts +62 -0
  12. package/src/__tests__/apis.test.ts +216 -0
  13. package/src/__tests__/applicants.test.ts +1445 -0
  14. package/src/__tests__/applications.test.ts +515 -0
  15. package/src/__tests__/assertions.ts +13 -0
  16. package/src/__tests__/attachments.test.ts +371 -0
  17. package/src/__tests__/balancesheet.test.ts +453 -0
  18. package/src/__tests__/bankaccounts.test.ts +324 -0
  19. package/src/__tests__/bankfeedaccounts.test.ts +343 -0
  20. package/src/__tests__/bankfeedstatements.test.ts +408 -0
  21. package/src/__tests__/billpayments.test.ts +1031 -0
  22. package/src/__tests__/bills.test.ts +1630 -0
  23. package/src/__tests__/categories.test.ts +127 -0
  24. package/src/__tests__/collections.test.ts +120 -0
  25. package/src/__tests__/collectiontags.test.ts +68 -0
  26. package/src/__tests__/collectionticketcomments.test.ts +501 -0
  27. package/src/__tests__/collectiontickets.test.ts +627 -0
  28. package/src/__tests__/collectionusers.test.ts +126 -0
  29. package/src/__tests__/companies.test.ts +1642 -0
  30. package/src/__tests__/companyinfo.test.ts +219 -0
  31. package/src/__tests__/connectionconsent.test.ts +89 -0
  32. package/src/__tests__/connectionconsents.test.ts +31 -0
  33. package/src/__tests__/connectioncustommappings.test.ts +69 -0
  34. package/src/__tests__/connections.test.ts +2127 -0
  35. package/src/__tests__/connectionsettings.test.ts +687 -0
  36. package/src/__tests__/connectordocs.test.ts +29 -0
  37. package/src/__tests__/connectors.test.ts +753 -0
  38. package/src/__tests__/consumerrequestcounts.test.ts +42 -0
  39. package/src/__tests__/consumers.test.ts +523 -0
  40. package/src/__tests__/contacts.test.ts +1421 -0
  41. package/src/__tests__/createcallback.test.ts +36 -0
  42. package/src/__tests__/creditnotes.test.ts +2040 -0
  43. package/src/__tests__/customers.test.ts +1600 -0
  44. package/src/__tests__/customfields.test.ts +52 -0
  45. package/src/__tests__/custommappings.test.ts +65 -0
  46. package/src/__tests__/customobjects.test.ts +408 -0
  47. package/src/__tests__/customobjectschemas.test.ts +734 -0
  48. package/src/__tests__/departments.test.ts +529 -0
  49. package/src/__tests__/drivegroups.test.ts +496 -0
  50. package/src/__tests__/drives.test.ts +487 -0
  51. package/src/__tests__/employeepayrolls.test.ts +491 -0
  52. package/src/__tests__/employees.test.ts +2968 -0
  53. package/src/__tests__/employeeschedules.test.ts +457 -0
  54. package/src/__tests__/eventlogs.test.ts +158 -0
  55. package/src/__tests__/expensecategories.test.ts +324 -0
  56. package/src/__tests__/expensereports.test.ts +634 -0
  57. package/src/__tests__/expenses.test.ts +867 -0
  58. package/src/__tests__/files.test.ts +506 -0
  59. package/src/__tests__/files.ts +56 -0
  60. package/src/__tests__/folders.test.ts +390 -0
  61. package/src/__tests__/invoiceitems.test.ts +855 -0
  62. package/src/__tests__/invoices.test.ts +2173 -0
  63. package/src/__tests__/jobs.test.ts +1150 -0
  64. package/src/__tests__/journalentries.test.ts +1542 -0
  65. package/src/__tests__/leads.test.ts +1341 -0
  66. package/src/__tests__/ledgeraccounts.test.ts +829 -0
  67. package/src/__tests__/locations.test.ts +856 -0
  68. package/src/__tests__/logs.test.ts +137 -0
  69. package/src/__tests__/messages.test.ts +588 -0
  70. package/src/__tests__/notes.test.ts +523 -0
  71. package/src/__tests__/opportunities.test.ts +718 -0
  72. package/src/__tests__/orders.test.ts +854 -0
  73. package/src/__tests__/payments.test.ts +867 -0
  74. package/src/__tests__/payrolls.test.ts +485 -0
  75. package/src/__tests__/pipelines.test.ts +574 -0
  76. package/src/__tests__/products.test.ts +509 -0
  77. package/src/__tests__/profitandloss.test.ts +223 -0
  78. package/src/__tests__/projects.test.ts +480 -0
  79. package/src/__tests__/proxy.test.ts +41 -0
  80. package/src/__tests__/purchaseorders.test.ts +2139 -0
  81. package/src/__tests__/quotes.test.ts +678 -0
  82. package/src/__tests__/refunds.test.ts +812 -0
  83. package/src/__tests__/sessions.test.ts +72 -0
  84. package/src/__tests__/sharedlinks.test.ts +511 -0
  85. package/src/__tests__/stores.test.ts +41 -0
  86. package/src/__tests__/subsidiaries.test.ts +496 -0
  87. package/src/__tests__/suppliers.test.ts +1574 -0
  88. package/src/__tests__/taxrates.test.ts +701 -0
  89. package/src/__tests__/testclient.ts +48 -0
  90. package/src/__tests__/timeoffrequests.test.ts +588 -0
  91. package/src/__tests__/trackingcategories.test.ts +515 -0
  92. package/src/__tests__/uploadsessions.test.ts +221 -0
  93. package/src/__tests__/users.test.ts +1020 -0
  94. package/src/__tests__/validateconnection.test.ts +34 -0
  95. package/src/__tests__/webhooks.test.ts +254 -0
  96. package/src/lib/config.ts +4 -4
@@ -0,0 +1,509 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { expect, test } from "vitest";
6
+ import { Apideck } from "../index.js";
7
+ import { createTestHTTPClient } from "./testclient.js";
8
+
9
+ test("Products Ecommerce Products All", async () => {
10
+ const testHttpClient = createTestHTTPClient("ecommerce.productsAll");
11
+
12
+ const apideck = new Apideck({
13
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
14
+ httpClient: testHttpClient,
15
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
16
+ });
17
+
18
+ const result = await apideck.ecommerce.products.list({
19
+ consumerId: "test-consumer",
20
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
21
+ serviceId: "salesforce",
22
+ passThrough: {
23
+ "search": "San Francisco",
24
+ },
25
+ fields: "id,updated_at",
26
+ });
27
+ expect(result.httpMeta.response.status).toBe(200);
28
+ expect(result.getProductsResponse).toBeDefined();
29
+ expect(result.getProductsResponse).toEqual({
30
+ statusCode: 200,
31
+ status: "OK",
32
+ service: "shopify",
33
+ resource: "products",
34
+ operation: "all",
35
+ data: [
36
+ {
37
+ id: "12345",
38
+ name: "MacBook Pro",
39
+ description:
40
+ "Powerful and portable, the MacBook Pro is perfect for professionals and creatives.",
41
+ status: "active",
42
+ price: "1999.99",
43
+ sku: "MBP123",
44
+ inventoryQuantity: "10",
45
+ images: [
46
+ {
47
+ id: "12345",
48
+ url: "https://example.com/macbook-pro.jpg",
49
+ },
50
+ {
51
+ id: "12345",
52
+ url: "https://example.com/macbook-pro.jpg",
53
+ },
54
+ ],
55
+ weight: "1.25",
56
+ weightUnit: "lb",
57
+ options: [
58
+ {
59
+ id: "1",
60
+ name: "Color",
61
+ values: [
62
+ "Red",
63
+ ],
64
+ },
65
+ {
66
+ id: "1",
67
+ name: "Color",
68
+ values: [
69
+ "Red",
70
+ ],
71
+ },
72
+ {
73
+ id: "1",
74
+ name: "Color",
75
+ values: [
76
+ "Red",
77
+ ],
78
+ },
79
+ ],
80
+ variants: [
81
+ {
82
+ id: "1",
83
+ name: "Midnight 16inch MacBook Pro",
84
+ price: "1999.99",
85
+ sku: "MBP123-16GB-SILVER-13",
86
+ inventoryQuantity: "5",
87
+ weight: "1.25",
88
+ weightUnit: "lb",
89
+ options: [
90
+ {
91
+ id: "1",
92
+ name: "Color",
93
+ value: "Silver",
94
+ },
95
+ ],
96
+ images: [
97
+ {
98
+ id: "12345",
99
+ url: "https://example.com/macbook-pro.jpg",
100
+ },
101
+ ],
102
+ },
103
+ ],
104
+ tags: [
105
+ "Apple",
106
+ ],
107
+ categories: [
108
+ {
109
+ id: "12345",
110
+ name: "Laptops",
111
+ },
112
+ {
113
+ id: "12345",
114
+ name: "Laptops",
115
+ },
116
+ ],
117
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
118
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
119
+ },
120
+ {
121
+ id: "12345",
122
+ name: "MacBook Pro",
123
+ description:
124
+ "Powerful and portable, the MacBook Pro is perfect for professionals and creatives.",
125
+ status: "active",
126
+ price: "1999.99",
127
+ sku: "MBP123",
128
+ inventoryQuantity: "10",
129
+ images: [
130
+ {
131
+ id: "12345",
132
+ url: "https://example.com/macbook-pro.jpg",
133
+ },
134
+ {
135
+ id: "12345",
136
+ url: "https://example.com/macbook-pro.jpg",
137
+ },
138
+ ],
139
+ weight: "1.25",
140
+ weightUnit: "lb",
141
+ options: [
142
+ {
143
+ id: "1",
144
+ name: "Color",
145
+ values: [
146
+ "Red",
147
+ ],
148
+ },
149
+ ],
150
+ variants: [
151
+ {
152
+ id: "1",
153
+ name: "Midnight 16inch MacBook Pro",
154
+ price: "1999.99",
155
+ sku: "MBP123-16GB-SILVER-13",
156
+ inventoryQuantity: "5",
157
+ weight: "1.25",
158
+ weightUnit: "lb",
159
+ options: [
160
+ {
161
+ id: "1",
162
+ name: "Color",
163
+ value: "Silver",
164
+ },
165
+ ],
166
+ images: [
167
+ {
168
+ id: "12345",
169
+ url: "https://example.com/macbook-pro.jpg",
170
+ },
171
+ ],
172
+ },
173
+ {
174
+ id: "1",
175
+ name: "Midnight 16inch MacBook Pro",
176
+ price: "1999.99",
177
+ sku: "MBP123-16GB-SILVER-13",
178
+ inventoryQuantity: "5",
179
+ weight: "1.25",
180
+ weightUnit: "lb",
181
+ options: [
182
+ {
183
+ id: "1",
184
+ name: "Color",
185
+ value: "Silver",
186
+ },
187
+ {
188
+ id: "1",
189
+ name: "Color",
190
+ value: "Silver",
191
+ },
192
+ {
193
+ id: "1",
194
+ name: "Color",
195
+ value: "Silver",
196
+ },
197
+ ],
198
+ images: [
199
+ {
200
+ id: "12345",
201
+ url: "https://example.com/macbook-pro.jpg",
202
+ },
203
+ {
204
+ id: "12345",
205
+ url: "https://example.com/macbook-pro.jpg",
206
+ },
207
+ ],
208
+ },
209
+ {
210
+ id: "1",
211
+ name: "Midnight 16inch MacBook Pro",
212
+ price: "1999.99",
213
+ sku: "MBP123-16GB-SILVER-13",
214
+ inventoryQuantity: "5",
215
+ weight: "1.25",
216
+ weightUnit: "lb",
217
+ options: [
218
+ {
219
+ id: "1",
220
+ name: "Color",
221
+ value: "Silver",
222
+ },
223
+ {
224
+ id: "1",
225
+ name: "Color",
226
+ value: "Silver",
227
+ },
228
+ ],
229
+ images: [
230
+ {
231
+ id: "12345",
232
+ url: "https://example.com/macbook-pro.jpg",
233
+ },
234
+ ],
235
+ },
236
+ ],
237
+ tags: [
238
+ "Apple",
239
+ ],
240
+ categories: [
241
+ {
242
+ id: "12345",
243
+ name: "Laptops",
244
+ },
245
+ ],
246
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
247
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
248
+ },
249
+ {
250
+ id: "12345",
251
+ name: "MacBook Pro",
252
+ description:
253
+ "Powerful and portable, the MacBook Pro is perfect for professionals and creatives.",
254
+ status: "active",
255
+ price: "1999.99",
256
+ sku: "MBP123",
257
+ inventoryQuantity: "10",
258
+ images: [
259
+ {
260
+ id: "12345",
261
+ url: "https://example.com/macbook-pro.jpg",
262
+ },
263
+ {
264
+ id: "12345",
265
+ url: "https://example.com/macbook-pro.jpg",
266
+ },
267
+ ],
268
+ weight: "1.25",
269
+ weightUnit: "lb",
270
+ options: [
271
+ {
272
+ id: "1",
273
+ name: "Color",
274
+ values: [
275
+ "Red",
276
+ ],
277
+ },
278
+ {
279
+ id: "1",
280
+ name: "Color",
281
+ values: [
282
+ "Red",
283
+ ],
284
+ },
285
+ ],
286
+ variants: [
287
+ {
288
+ id: "1",
289
+ name: "Midnight 16inch MacBook Pro",
290
+ price: "1999.99",
291
+ sku: "MBP123-16GB-SILVER-13",
292
+ inventoryQuantity: "5",
293
+ weight: "1.25",
294
+ weightUnit: "lb",
295
+ options: [
296
+ {
297
+ id: "1",
298
+ name: "Color",
299
+ value: "Silver",
300
+ },
301
+ {
302
+ id: "1",
303
+ name: "Color",
304
+ value: "Silver",
305
+ },
306
+ {
307
+ id: "1",
308
+ name: "Color",
309
+ value: "Silver",
310
+ },
311
+ ],
312
+ images: [
313
+ {
314
+ id: "12345",
315
+ url: "https://example.com/macbook-pro.jpg",
316
+ },
317
+ {
318
+ id: "12345",
319
+ url: "https://example.com/macbook-pro.jpg",
320
+ },
321
+ ],
322
+ },
323
+ ],
324
+ tags: [
325
+ "Apple",
326
+ ],
327
+ categories: [
328
+ {
329
+ id: "12345",
330
+ name: "Laptops",
331
+ },
332
+ {
333
+ id: "12345",
334
+ name: "Laptops",
335
+ },
336
+ {
337
+ id: "12345",
338
+ name: "Laptops",
339
+ },
340
+ ],
341
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
342
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
343
+ },
344
+ ],
345
+ meta: {
346
+ itemsOnPage: 50,
347
+ cursors: {
348
+ previous: "em9oby1jcm06OnBhZ2U6OjE=",
349
+ current: "em9oby1jcm06OnBhZ2U6OjI=",
350
+ next: "em9oby1jcm06OnBhZ2U6OjM=",
351
+ },
352
+ },
353
+ links: {
354
+ previous:
355
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjE%3D",
356
+ current: "https://unify.apideck.com/crm/companies",
357
+ next:
358
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjM",
359
+ },
360
+ });
361
+ });
362
+
363
+ test("Products Ecommerce Products One", async () => {
364
+ const testHttpClient = createTestHTTPClient("ecommerce.productsOne");
365
+
366
+ const apideck = new Apideck({
367
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
368
+ httpClient: testHttpClient,
369
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
370
+ });
371
+
372
+ const result = await apideck.ecommerce.products.get({
373
+ id: "<id>",
374
+ consumerId: "test-consumer",
375
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
376
+ serviceId: "salesforce",
377
+ fields: "id,updated_at",
378
+ });
379
+ expect(result.httpMeta.response.status).toBe(200);
380
+ expect(result.getProductResponse).toBeDefined();
381
+ expect(result.getProductResponse).toEqual({
382
+ statusCode: 200,
383
+ status: "OK",
384
+ service: "shopify",
385
+ resource: "products",
386
+ operation: "one",
387
+ data: {
388
+ id: "12345",
389
+ name: "MacBook Pro",
390
+ description:
391
+ "Powerful and portable, the MacBook Pro is perfect for professionals and creatives.",
392
+ status: "active",
393
+ price: "1999.99",
394
+ sku: "MBP123",
395
+ inventoryQuantity: "10",
396
+ images: [
397
+ {
398
+ id: "12345",
399
+ url: "https://example.com/macbook-pro.jpg",
400
+ },
401
+ {
402
+ id: "12345",
403
+ url: "https://example.com/macbook-pro.jpg",
404
+ },
405
+ {
406
+ id: "12345",
407
+ url: "https://example.com/macbook-pro.jpg",
408
+ },
409
+ ],
410
+ weight: "1.25",
411
+ weightUnit: "lb",
412
+ options: [
413
+ {
414
+ id: "1",
415
+ name: "Color",
416
+ values: [
417
+ "Red",
418
+ ],
419
+ },
420
+ {
421
+ id: "1",
422
+ name: "Color",
423
+ values: [
424
+ "Red",
425
+ ],
426
+ },
427
+ ],
428
+ variants: [
429
+ {
430
+ id: "1",
431
+ name: "Midnight 16inch MacBook Pro",
432
+ price: "1999.99",
433
+ sku: "MBP123-16GB-SILVER-13",
434
+ inventoryQuantity: "5",
435
+ weight: "1.25",
436
+ weightUnit: "lb",
437
+ options: [
438
+ {
439
+ id: "1",
440
+ name: "Color",
441
+ value: "Silver",
442
+ },
443
+ {
444
+ id: "1",
445
+ name: "Color",
446
+ value: "Silver",
447
+ },
448
+ ],
449
+ images: [
450
+ {
451
+ id: "12345",
452
+ url: "https://example.com/macbook-pro.jpg",
453
+ },
454
+ {
455
+ id: "12345",
456
+ url: "https://example.com/macbook-pro.jpg",
457
+ },
458
+ {
459
+ id: "12345",
460
+ url: "https://example.com/macbook-pro.jpg",
461
+ },
462
+ ],
463
+ },
464
+ {
465
+ id: "1",
466
+ name: "Midnight 16inch MacBook Pro",
467
+ price: "1999.99",
468
+ sku: "MBP123-16GB-SILVER-13",
469
+ inventoryQuantity: "5",
470
+ weight: "1.25",
471
+ weightUnit: "lb",
472
+ options: [
473
+ {
474
+ id: "1",
475
+ name: "Color",
476
+ value: "Silver",
477
+ },
478
+ {
479
+ id: "1",
480
+ name: "Color",
481
+ value: "Silver",
482
+ },
483
+ ],
484
+ images: [
485
+ {
486
+ id: "12345",
487
+ url: "https://example.com/macbook-pro.jpg",
488
+ },
489
+ {
490
+ id: "12345",
491
+ url: "https://example.com/macbook-pro.jpg",
492
+ },
493
+ ],
494
+ },
495
+ ],
496
+ tags: [
497
+ "Apple",
498
+ ],
499
+ categories: [
500
+ {
501
+ id: "12345",
502
+ name: "Laptops",
503
+ },
504
+ ],
505
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
506
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
507
+ },
508
+ });
509
+ });