@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,371 @@
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 { DownloadAcceptEnum } from "../sdk/attachments.js";
8
+ import { filesToByteArray, streamToByteArray } from "./files.js";
9
+ import { createTestHTTPClient } from "./testclient.js";
10
+
11
+ test("Attachments Accounting Attachments All", async () => {
12
+ const testHttpClient = createTestHTTPClient("accounting.attachmentsAll");
13
+
14
+ const apideck = new Apideck({
15
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
16
+ httpClient: testHttpClient,
17
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
18
+ });
19
+
20
+ const result = await apideck.accounting.attachments.list({
21
+ referenceType: "invoice",
22
+ referenceId: "123456",
23
+ consumerId: "test-consumer",
24
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
25
+ serviceId: "salesforce",
26
+ fields: "id,updated_at",
27
+ });
28
+ expect(result.httpMeta.response.status).toBe(200);
29
+ expect(result.getAttachmentsResponse).toBeDefined();
30
+ expect(result.getAttachmentsResponse).toEqual({
31
+ statusCode: 200,
32
+ status: "OK",
33
+ service: "quickbooks",
34
+ resource: "PurchaseOrders",
35
+ operation: "all",
36
+ data: [
37
+ {
38
+ id: "12345",
39
+ displayId: "sample ID",
40
+ name: "sample.jpg",
41
+ mimeType: "image/jpeg",
42
+ size: 1810673,
43
+ reference: {
44
+ type: "invoice",
45
+ id: "12345",
46
+ },
47
+ description: "A sample image",
48
+ parentFolderId: "123",
49
+ updatedBy: "12345",
50
+ createdBy: "12345",
51
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
52
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
53
+ passThrough: [
54
+ {
55
+ serviceId: "<id>",
56
+ extendPaths: [
57
+ {
58
+ path: "$.nested.property",
59
+ value: {
60
+ "TaxClassificationRef": {
61
+ "value": "EUC-99990201-V1-00020000",
62
+ },
63
+ },
64
+ },
65
+ {
66
+ path: "$.nested.property",
67
+ value: {
68
+ "TaxClassificationRef": {
69
+ "value": "EUC-99990201-V1-00020000",
70
+ },
71
+ },
72
+ },
73
+ {
74
+ path: "$.nested.property",
75
+ value: {
76
+ "TaxClassificationRef": {
77
+ "value": "EUC-99990201-V1-00020000",
78
+ },
79
+ },
80
+ },
81
+ ],
82
+ },
83
+ {
84
+ serviceId: "<id>",
85
+ extendPaths: [
86
+ {
87
+ path: "$.nested.property",
88
+ value: {
89
+ "TaxClassificationRef": {
90
+ "value": "EUC-99990201-V1-00020000",
91
+ },
92
+ },
93
+ },
94
+ ],
95
+ },
96
+ ],
97
+ },
98
+ {
99
+ id: "12345",
100
+ displayId: "sample ID",
101
+ name: "sample.jpg",
102
+ mimeType: "image/jpeg",
103
+ size: 1810673,
104
+ reference: {
105
+ type: "invoice",
106
+ id: "12345",
107
+ },
108
+ description: "A sample image",
109
+ parentFolderId: "123",
110
+ updatedBy: "12345",
111
+ createdBy: "12345",
112
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
113
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
114
+ passThrough: [
115
+ {
116
+ serviceId: "<id>",
117
+ extendPaths: [
118
+ {
119
+ path: "$.nested.property",
120
+ value: {
121
+ "TaxClassificationRef": {
122
+ "value": "EUC-99990201-V1-00020000",
123
+ },
124
+ },
125
+ },
126
+ ],
127
+ },
128
+ ],
129
+ },
130
+ {
131
+ id: "12345",
132
+ displayId: "sample ID",
133
+ name: "sample.jpg",
134
+ mimeType: "image/jpeg",
135
+ size: 1810673,
136
+ reference: {
137
+ type: "invoice",
138
+ id: "12345",
139
+ },
140
+ description: "A sample image",
141
+ parentFolderId: "123",
142
+ updatedBy: "12345",
143
+ createdBy: "12345",
144
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
145
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
146
+ passThrough: [
147
+ {
148
+ serviceId: "<id>",
149
+ extendPaths: [
150
+ {
151
+ path: "$.nested.property",
152
+ value: {
153
+ "TaxClassificationRef": {
154
+ "value": "EUC-99990201-V1-00020000",
155
+ },
156
+ },
157
+ },
158
+ {
159
+ path: "$.nested.property",
160
+ value: {
161
+ "TaxClassificationRef": {
162
+ "value": "EUC-99990201-V1-00020000",
163
+ },
164
+ },
165
+ },
166
+ ],
167
+ },
168
+ {
169
+ serviceId: "<id>",
170
+ extendPaths: [
171
+ {
172
+ path: "$.nested.property",
173
+ value: {
174
+ "TaxClassificationRef": {
175
+ "value": "EUC-99990201-V1-00020000",
176
+ },
177
+ },
178
+ },
179
+ ],
180
+ },
181
+ ],
182
+ },
183
+ ],
184
+ meta: {
185
+ itemsOnPage: 50,
186
+ cursors: {
187
+ previous: "em9oby1jcm06OnBhZ2U6OjE=",
188
+ current: "em9oby1jcm06OnBhZ2U6OjI=",
189
+ next: "em9oby1jcm06OnBhZ2U6OjM=",
190
+ },
191
+ },
192
+ links: {
193
+ previous:
194
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjE%3D",
195
+ current: "https://unify.apideck.com/crm/companies",
196
+ next:
197
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjM",
198
+ },
199
+ });
200
+ });
201
+
202
+ test("Attachments Accounting Attachments One", async () => {
203
+ const testHttpClient = createTestHTTPClient("accounting.attachmentsOne");
204
+
205
+ const apideck = new Apideck({
206
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
207
+ httpClient: testHttpClient,
208
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
209
+ });
210
+
211
+ const result = await apideck.accounting.attachments.get({
212
+ referenceType: "invoice",
213
+ referenceId: "123456",
214
+ id: "<id>",
215
+ consumerId: "test-consumer",
216
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
217
+ serviceId: "salesforce",
218
+ fields: "id,updated_at",
219
+ });
220
+ expect(result.httpMeta.response.status).toBe(200);
221
+ expect(result.getAttachmentResponse).toBeDefined();
222
+ expect(result.getAttachmentResponse).toEqual({
223
+ statusCode: 200,
224
+ status: "OK",
225
+ service: "xero",
226
+ resource: "payments",
227
+ operation: "one",
228
+ data: {
229
+ id: "12345",
230
+ displayId: "sample ID",
231
+ name: "sample.jpg",
232
+ mimeType: "image/jpeg",
233
+ size: 1810673,
234
+ reference: {
235
+ type: "invoice",
236
+ id: "12345",
237
+ },
238
+ description: "A sample image",
239
+ parentFolderId: "123",
240
+ updatedBy: "12345",
241
+ createdBy: "12345",
242
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
243
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
244
+ passThrough: [
245
+ {
246
+ serviceId: "<id>",
247
+ extendPaths: [
248
+ {
249
+ path: "$.nested.property",
250
+ value: {
251
+ "TaxClassificationRef": {
252
+ "value": "EUC-99990201-V1-00020000",
253
+ },
254
+ },
255
+ },
256
+ {
257
+ path: "$.nested.property",
258
+ value: {
259
+ "TaxClassificationRef": {
260
+ "value": "EUC-99990201-V1-00020000",
261
+ },
262
+ },
263
+ },
264
+ ],
265
+ },
266
+ {
267
+ serviceId: "<id>",
268
+ extendPaths: [
269
+ {
270
+ path: "$.nested.property",
271
+ value: {
272
+ "TaxClassificationRef": {
273
+ "value": "EUC-99990201-V1-00020000",
274
+ },
275
+ },
276
+ },
277
+ {
278
+ path: "$.nested.property",
279
+ value: {
280
+ "TaxClassificationRef": {
281
+ "value": "EUC-99990201-V1-00020000",
282
+ },
283
+ },
284
+ },
285
+ ],
286
+ },
287
+ {
288
+ serviceId: "<id>",
289
+ extendPaths: [
290
+ {
291
+ path: "$.nested.property",
292
+ value: {
293
+ "TaxClassificationRef": {
294
+ "value": "EUC-99990201-V1-00020000",
295
+ },
296
+ },
297
+ },
298
+ {
299
+ path: "$.nested.property",
300
+ value: {
301
+ "TaxClassificationRef": {
302
+ "value": "EUC-99990201-V1-00020000",
303
+ },
304
+ },
305
+ },
306
+ ],
307
+ },
308
+ ],
309
+ },
310
+ });
311
+ });
312
+
313
+ test("Attachments Accounting Attachments Delete", async () => {
314
+ const testHttpClient = createTestHTTPClient("accounting.attachmentsDelete");
315
+
316
+ const apideck = new Apideck({
317
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
318
+ httpClient: testHttpClient,
319
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
320
+ });
321
+
322
+ const result = await apideck.accounting.attachments.delete({
323
+ referenceType: "invoice",
324
+ referenceId: "123456",
325
+ id: "<id>",
326
+ consumerId: "test-consumer",
327
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
328
+ serviceId: "salesforce",
329
+ });
330
+ expect(result.httpMeta.response.status).toBe(200);
331
+ expect(result.deleteAttachmentResponse).toBeDefined();
332
+ expect(result.deleteAttachmentResponse).toEqual({
333
+ statusCode: 200,
334
+ status: "OK",
335
+ service: "google-drive",
336
+ resource: "files",
337
+ operation: "delete",
338
+ data: {
339
+ id: "12345",
340
+ },
341
+ });
342
+ });
343
+
344
+ test("Attachments Accounting Attachments Download", async () => {
345
+ const testHttpClient = createTestHTTPClient("accounting.attachmentsDownload");
346
+
347
+ const apideck = new Apideck({
348
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
349
+ httpClient: testHttpClient,
350
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
351
+ });
352
+
353
+ const result = await apideck.accounting.attachments.download({
354
+ referenceType: "invoice",
355
+ referenceId: "123456",
356
+ id: "<id>",
357
+ consumerId: "test-consumer",
358
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
359
+ serviceId: "salesforce",
360
+ fields: "id,updated_at",
361
+ }, {
362
+ acceptHeaderOverride: DownloadAcceptEnum.wildcardRootWildcard,
363
+ });
364
+ expect(result.httpMeta.response.status).toBe(200);
365
+ expect(result.getAttachmentDownloadResponse).toBeDefined();
366
+ expect(
367
+ new Uint8Array(
368
+ await streamToByteArray(result.getAttachmentDownloadResponse),
369
+ ),
370
+ ).toEqual(await filesToByteArray(".speakeasy/testfiles/example.file"));
371
+ });