@apideck/unify 0.23.0 → 0.23.1

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 (93) hide show
  1. package/jsr.json +1 -1
  2. package/lib/config.d.ts +3 -3
  3. package/lib/config.js +3 -3
  4. package/models/components/note.d.ts +5 -0
  5. package/models/components/note.d.ts.map +1 -1
  6. package/models/components/note.js +4 -0
  7. package/models/components/note.js.map +1 -1
  8. package/models/components/noteinput.d.ts +5 -0
  9. package/models/components/noteinput.d.ts.map +1 -1
  10. package/models/components/noteinput.js +4 -0
  11. package/models/components/noteinput.js.map +1 -1
  12. package/package.json +5 -1
  13. package/src/__tests__/activities.test.ts +783 -0
  14. package/src/__tests__/agedcreditors.test.ts +279 -0
  15. package/src/__tests__/ageddebtors.test.ts +279 -0
  16. package/src/__tests__/apideckcompanies.test.ts +712 -0
  17. package/src/__tests__/apideckcustomers.test.ts +360 -0
  18. package/src/__tests__/apideckdepartments.test.ts +319 -0
  19. package/src/__tests__/apiresources.test.ts +61 -0
  20. package/src/__tests__/apis.test.ts +214 -0
  21. package/src/__tests__/applicants.test.ts +976 -0
  22. package/src/__tests__/applications.test.ts +329 -0
  23. package/src/__tests__/assertions.ts +13 -0
  24. package/src/__tests__/attachments.test.ts +363 -0
  25. package/src/__tests__/balancesheet.test.ts +451 -0
  26. package/src/__tests__/billpayments.test.ts +666 -0
  27. package/src/__tests__/bills.test.ts +1133 -0
  28. package/src/__tests__/collections.test.ts +115 -0
  29. package/src/__tests__/collectiontags.test.ts +66 -0
  30. package/src/__tests__/collectionticketcomments.test.ts +318 -0
  31. package/src/__tests__/collectiontickets.test.ts +436 -0
  32. package/src/__tests__/collectionusers.test.ts +122 -0
  33. package/src/__tests__/companies.test.ts +1059 -0
  34. package/src/__tests__/companyinfo.test.ts +218 -0
  35. package/src/__tests__/connectioncustommappings.test.ts +67 -0
  36. package/src/__tests__/connections.test.ts +1713 -0
  37. package/src/__tests__/connectionsettings.test.ts +280 -0
  38. package/src/__tests__/connectordocs.test.ts +28 -0
  39. package/src/__tests__/connectors.test.ts +751 -0
  40. package/src/__tests__/consumerrequestcounts.test.ts +41 -0
  41. package/src/__tests__/consumers.test.ts +517 -0
  42. package/src/__tests__/contacts.test.ts +957 -0
  43. package/src/__tests__/createcallback.test.ts +34 -0
  44. package/src/__tests__/creditnotes.test.ts +1362 -0
  45. package/src/__tests__/customers.test.ts +1089 -0
  46. package/src/__tests__/customfields.test.ts +50 -0
  47. package/src/__tests__/custommappings.test.ts +63 -0
  48. package/src/__tests__/departments.test.ts +359 -0
  49. package/src/__tests__/drivegroups.test.ts +318 -0
  50. package/src/__tests__/drives.test.ts +311 -0
  51. package/src/__tests__/employeepayrolls.test.ts +487 -0
  52. package/src/__tests__/employees.test.ts +1682 -0
  53. package/src/__tests__/employeeschedules.test.ts +456 -0
  54. package/src/__tests__/eventlogs.test.ts +157 -0
  55. package/src/__tests__/expenses.test.ts +566 -0
  56. package/src/__tests__/files.test.ts +392 -0
  57. package/src/__tests__/files.ts +56 -0
  58. package/src/__tests__/folders.test.ts +103 -0
  59. package/src/__tests__/invoiceitems.test.ts +586 -0
  60. package/src/__tests__/invoices.test.ts +1561 -0
  61. package/src/__tests__/jobs.test.ts +837 -0
  62. package/src/__tests__/journalentries.test.ts +1053 -0
  63. package/src/__tests__/leads.test.ts +897 -0
  64. package/src/__tests__/ledgeraccounts.test.ts +594 -0
  65. package/src/__tests__/locations.test.ts +561 -0
  66. package/src/__tests__/logs.test.ts +135 -0
  67. package/src/__tests__/messages.test.ts +396 -0
  68. package/src/__tests__/mockserver/README.md +52 -0
  69. package/src/__tests__/notes.test.ts +335 -0
  70. package/src/__tests__/opportunities.test.ts +503 -0
  71. package/src/__tests__/orders.test.ts +849 -0
  72. package/src/__tests__/payments.test.ts +557 -0
  73. package/src/__tests__/payrolls.test.ts +481 -0
  74. package/src/__tests__/pipelines.test.ts +383 -0
  75. package/src/__tests__/products.test.ts +505 -0
  76. package/src/__tests__/profitandloss.test.ts +221 -0
  77. package/src/__tests__/purchaseorders.test.ts +1464 -0
  78. package/src/__tests__/sessions.test.ts +70 -0
  79. package/src/__tests__/sharedlinks.test.ts +331 -0
  80. package/src/__tests__/stores.test.ts +39 -0
  81. package/src/__tests__/subsidiaries.test.ts +316 -0
  82. package/src/__tests__/suppliers.test.ts +1071 -0
  83. package/src/__tests__/taxrates.test.ts +472 -0
  84. package/src/__tests__/testclient.ts +48 -0
  85. package/src/__tests__/timeoffrequests.test.ts +381 -0
  86. package/src/__tests__/trackingcategories.test.ts +329 -0
  87. package/src/__tests__/uploadsessions.test.ts +142 -0
  88. package/src/__tests__/users.test.ts +667 -0
  89. package/src/__tests__/validateconnection.test.ts +32 -0
  90. package/src/__tests__/webhooks.test.ts +248 -0
  91. package/src/lib/config.ts +3 -3
  92. package/src/models/components/note.ts +9 -0
  93. package/src/models/components/noteinput.ts +9 -0
@@ -0,0 +1,329 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { assert, expect, it, test } from "vitest";
6
+ import { Apideck } from "../index.js";
7
+ import { createTestHTTPClient } from "./testclient.js";
8
+
9
+ test("Applications Ats Applications All", async () => {
10
+ const testHttpClient = createTestHTTPClient("ats.applicationsAll");
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.ats.applications.list({
19
+ serviceId: "salesforce",
20
+ passThrough: {
21
+ "search": "San Francisco",
22
+ },
23
+ });
24
+ expect(result.httpMeta.response.status).toBe(200);
25
+ expect(result.getApplicationsResponse).toBeDefined();
26
+ expect(result.getApplicationsResponse).toEqual({
27
+ statusCode: 200,
28
+ status: "OK",
29
+ service: "sap-successfactors",
30
+ resource: "Applications",
31
+ operation: "all",
32
+ data: [
33
+ {
34
+ id: "12345",
35
+ applicantId: "12345",
36
+ jobId: "12345",
37
+ status: "open",
38
+ stage: {
39
+ id: "12345",
40
+ name: "12345",
41
+ },
42
+ updatedBy: "12345",
43
+ createdBy: "12345",
44
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
45
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
46
+ passThrough: [
47
+ {
48
+ serviceId: "<id>",
49
+ extendPaths: [
50
+ {
51
+ path: "$.nested.property",
52
+ value: {
53
+ "TaxClassificationRef": {
54
+ "value": "EUC-99990201-V1-00020000",
55
+ },
56
+ },
57
+ },
58
+ {
59
+ path: "$.nested.property",
60
+ value: {
61
+ "TaxClassificationRef": {
62
+ "value": "EUC-99990201-V1-00020000",
63
+ },
64
+ },
65
+ },
66
+ {
67
+ path: "$.nested.property",
68
+ value: {
69
+ "TaxClassificationRef": {
70
+ "value": "EUC-99990201-V1-00020000",
71
+ },
72
+ },
73
+ },
74
+ ],
75
+ },
76
+ {
77
+ serviceId: "<id>",
78
+ extendPaths: [
79
+ {
80
+ path: "$.nested.property",
81
+ value: {
82
+ "TaxClassificationRef": {
83
+ "value": "EUC-99990201-V1-00020000",
84
+ },
85
+ },
86
+ },
87
+ ],
88
+ },
89
+ ],
90
+ },
91
+ {
92
+ id: "12345",
93
+ applicantId: "12345",
94
+ jobId: "12345",
95
+ status: "open",
96
+ stage: {
97
+ id: "12345",
98
+ name: "12345",
99
+ },
100
+ updatedBy: "12345",
101
+ createdBy: "12345",
102
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
103
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
104
+ passThrough: [
105
+ {
106
+ serviceId: "<id>",
107
+ extendPaths: [
108
+ {
109
+ path: "$.nested.property",
110
+ value: {
111
+ "TaxClassificationRef": {
112
+ "value": "EUC-99990201-V1-00020000",
113
+ },
114
+ },
115
+ },
116
+ ],
117
+ },
118
+ ],
119
+ },
120
+ {
121
+ id: "12345",
122
+ applicantId: "12345",
123
+ jobId: "12345",
124
+ status: "open",
125
+ stage: {
126
+ id: "12345",
127
+ name: "12345",
128
+ },
129
+ updatedBy: "12345",
130
+ createdBy: "12345",
131
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
132
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
133
+ passThrough: [
134
+ {
135
+ serviceId: "<id>",
136
+ extendPaths: [
137
+ {
138
+ path: "$.nested.property",
139
+ value: {
140
+ "TaxClassificationRef": {
141
+ "value": "EUC-99990201-V1-00020000",
142
+ },
143
+ },
144
+ },
145
+ {
146
+ path: "$.nested.property",
147
+ value: {
148
+ "TaxClassificationRef": {
149
+ "value": "EUC-99990201-V1-00020000",
150
+ },
151
+ },
152
+ },
153
+ ],
154
+ },
155
+ {
156
+ serviceId: "<id>",
157
+ extendPaths: [
158
+ {
159
+ path: "$.nested.property",
160
+ value: {
161
+ "TaxClassificationRef": {
162
+ "value": "EUC-99990201-V1-00020000",
163
+ },
164
+ },
165
+ },
166
+ ],
167
+ },
168
+ ],
169
+ },
170
+ ],
171
+ meta: {
172
+ itemsOnPage: 50,
173
+ cursors: {
174
+ previous: "em9oby1jcm06OnBhZ2U6OjE=",
175
+ current: "em9oby1jcm06OnBhZ2U6OjI=",
176
+ next: "em9oby1jcm06OnBhZ2U6OjM=",
177
+ },
178
+ },
179
+ links: {
180
+ previous:
181
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjE%3D",
182
+ current: "https://unify.apideck.com/crm/companies",
183
+ next:
184
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjM",
185
+ },
186
+ });
187
+ });
188
+
189
+ it.skip("Applications Ats Applications Add", async () => {
190
+ assert.fail(
191
+ "incomplete test found please make sure to address the following errors: [`workflow step ats.applicationsAdd.test referencing operation ats.applicationsAdd with expression in requestBody with type not currently supported`, `workflow step ats.applicationsAdd.test referencing operation ats.applicationsAdd with expression in requestBody with type not currently supported`, `workflow step ats.applicationsAdd.test referencing operation ats.applicationsAdd with expression in requestBody with type not currently supported`, `workflow step ats.applicationsAdd.test referencing operation ats.applicationsAdd with expression in requestBody with type not currently supported`]",
192
+ );
193
+ });
194
+
195
+ test("Applications Ats Applications One", async () => {
196
+ const testHttpClient = createTestHTTPClient("ats.applicationsOne");
197
+
198
+ const apideck = new Apideck({
199
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
200
+ httpClient: testHttpClient,
201
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
202
+ });
203
+
204
+ const result = await apideck.ats.applications.get({
205
+ id: "<id>",
206
+ serviceId: "salesforce",
207
+ });
208
+ expect(result.httpMeta.response.status).toBe(200);
209
+ expect(result.getApplicationResponse).toBeDefined();
210
+ expect(result.getApplicationResponse).toEqual({
211
+ statusCode: 200,
212
+ status: "OK",
213
+ service: "sap-successfactors",
214
+ resource: "Applications",
215
+ operation: "one",
216
+ data: {
217
+ id: "12345",
218
+ applicantId: "12345",
219
+ jobId: "12345",
220
+ status: "open",
221
+ stage: {
222
+ id: "12345",
223
+ name: "12345",
224
+ },
225
+ updatedBy: "12345",
226
+ createdBy: "12345",
227
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
228
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
229
+ passThrough: [
230
+ {
231
+ serviceId: "<id>",
232
+ extendPaths: [
233
+ {
234
+ path: "$.nested.property",
235
+ value: {
236
+ "TaxClassificationRef": {
237
+ "value": "EUC-99990201-V1-00020000",
238
+ },
239
+ },
240
+ },
241
+ {
242
+ path: "$.nested.property",
243
+ value: {
244
+ "TaxClassificationRef": {
245
+ "value": "EUC-99990201-V1-00020000",
246
+ },
247
+ },
248
+ },
249
+ ],
250
+ },
251
+ {
252
+ serviceId: "<id>",
253
+ extendPaths: [
254
+ {
255
+ path: "$.nested.property",
256
+ value: {
257
+ "TaxClassificationRef": {
258
+ "value": "EUC-99990201-V1-00020000",
259
+ },
260
+ },
261
+ },
262
+ {
263
+ path: "$.nested.property",
264
+ value: {
265
+ "TaxClassificationRef": {
266
+ "value": "EUC-99990201-V1-00020000",
267
+ },
268
+ },
269
+ },
270
+ ],
271
+ },
272
+ {
273
+ serviceId: "<id>",
274
+ extendPaths: [
275
+ {
276
+ path: "$.nested.property",
277
+ value: {
278
+ "TaxClassificationRef": {
279
+ "value": "EUC-99990201-V1-00020000",
280
+ },
281
+ },
282
+ },
283
+ {
284
+ path: "$.nested.property",
285
+ value: {
286
+ "TaxClassificationRef": {
287
+ "value": "EUC-99990201-V1-00020000",
288
+ },
289
+ },
290
+ },
291
+ ],
292
+ },
293
+ ],
294
+ },
295
+ });
296
+ });
297
+
298
+ it.skip("Applications Ats Applications Update", async () => {
299
+ assert.fail(
300
+ "incomplete test found please make sure to address the following errors: [`workflow step ats.applicationsUpdate.test referencing operation ats.applicationsUpdate with expression in requestBody with type not currently supported`, `workflow step ats.applicationsUpdate.test referencing operation ats.applicationsUpdate with expression in requestBody with type not currently supported`, `workflow step ats.applicationsUpdate.test referencing operation ats.applicationsUpdate with expression in requestBody with type not currently supported`, `workflow step ats.applicationsUpdate.test referencing operation ats.applicationsUpdate with expression in requestBody with type not currently supported`, `workflow step ats.applicationsUpdate.test referencing operation ats.applicationsUpdate with expression in requestBody with type not currently supported`, `workflow step ats.applicationsUpdate.test referencing operation ats.applicationsUpdate with expression in requestBody with type not currently supported`, `workflow step ats.applicationsUpdate.test referencing operation ats.applicationsUpdate with expression in requestBody with type not currently supported`]",
301
+ );
302
+ });
303
+
304
+ test("Applications Ats Applications Delete", async () => {
305
+ const testHttpClient = createTestHTTPClient("ats.applicationsDelete");
306
+
307
+ const apideck = new Apideck({
308
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
309
+ httpClient: testHttpClient,
310
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
311
+ });
312
+
313
+ const result = await apideck.ats.applications.delete({
314
+ id: "<id>",
315
+ serviceId: "salesforce",
316
+ });
317
+ expect(result.httpMeta.response.status).toBe(200);
318
+ expect(result.deleteApplicationResponse).toBeDefined();
319
+ expect(result.deleteApplicationResponse).toEqual({
320
+ statusCode: 200,
321
+ status: "OK",
322
+ service: "sap-successfactors",
323
+ resource: "Applications",
324
+ operation: "delete",
325
+ data: {
326
+ id: "12345",
327
+ },
328
+ });
329
+ });
@@ -0,0 +1,13 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { fail } from "assert";
6
+
7
+ export function assertDefined(value: any): any {
8
+ if (value === undefined) {
9
+ fail("value is undefined");
10
+ }
11
+
12
+ return value;
13
+ }
@@ -0,0 +1,363 @@
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
+ serviceId: "salesforce",
24
+ fields: "id,updated_at",
25
+ });
26
+ expect(result.httpMeta.response.status).toBe(200);
27
+ expect(result.getAttachmentsResponse).toBeDefined();
28
+ expect(result.getAttachmentsResponse).toEqual({
29
+ statusCode: 200,
30
+ status: "OK",
31
+ service: "quickbooks",
32
+ resource: "PurchaseOrders",
33
+ operation: "all",
34
+ data: [
35
+ {
36
+ id: "12345",
37
+ displayId: "sample ID",
38
+ name: "sample.jpg",
39
+ mimeType: "image/jpeg",
40
+ size: 1810673,
41
+ reference: {
42
+ type: "invoice",
43
+ id: "12345",
44
+ },
45
+ description: "A sample image",
46
+ parentFolderId: "123",
47
+ updatedBy: "12345",
48
+ createdBy: "12345",
49
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
50
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
51
+ passThrough: [
52
+ {
53
+ serviceId: "<id>",
54
+ extendPaths: [
55
+ {
56
+ path: "$.nested.property",
57
+ value: {
58
+ "TaxClassificationRef": {
59
+ "value": "EUC-99990201-V1-00020000",
60
+ },
61
+ },
62
+ },
63
+ {
64
+ path: "$.nested.property",
65
+ value: {
66
+ "TaxClassificationRef": {
67
+ "value": "EUC-99990201-V1-00020000",
68
+ },
69
+ },
70
+ },
71
+ {
72
+ path: "$.nested.property",
73
+ value: {
74
+ "TaxClassificationRef": {
75
+ "value": "EUC-99990201-V1-00020000",
76
+ },
77
+ },
78
+ },
79
+ ],
80
+ },
81
+ {
82
+ serviceId: "<id>",
83
+ extendPaths: [
84
+ {
85
+ path: "$.nested.property",
86
+ value: {
87
+ "TaxClassificationRef": {
88
+ "value": "EUC-99990201-V1-00020000",
89
+ },
90
+ },
91
+ },
92
+ ],
93
+ },
94
+ ],
95
+ },
96
+ {
97
+ id: "12345",
98
+ displayId: "sample ID",
99
+ name: "sample.jpg",
100
+ mimeType: "image/jpeg",
101
+ size: 1810673,
102
+ reference: {
103
+ type: "invoice",
104
+ id: "12345",
105
+ },
106
+ description: "A sample image",
107
+ parentFolderId: "123",
108
+ updatedBy: "12345",
109
+ createdBy: "12345",
110
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
111
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
112
+ passThrough: [
113
+ {
114
+ serviceId: "<id>",
115
+ extendPaths: [
116
+ {
117
+ path: "$.nested.property",
118
+ value: {
119
+ "TaxClassificationRef": {
120
+ "value": "EUC-99990201-V1-00020000",
121
+ },
122
+ },
123
+ },
124
+ ],
125
+ },
126
+ ],
127
+ },
128
+ {
129
+ id: "12345",
130
+ displayId: "sample ID",
131
+ name: "sample.jpg",
132
+ mimeType: "image/jpeg",
133
+ size: 1810673,
134
+ reference: {
135
+ type: "invoice",
136
+ id: "12345",
137
+ },
138
+ description: "A sample image",
139
+ parentFolderId: "123",
140
+ updatedBy: "12345",
141
+ createdBy: "12345",
142
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
143
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
144
+ passThrough: [
145
+ {
146
+ serviceId: "<id>",
147
+ extendPaths: [
148
+ {
149
+ path: "$.nested.property",
150
+ value: {
151
+ "TaxClassificationRef": {
152
+ "value": "EUC-99990201-V1-00020000",
153
+ },
154
+ },
155
+ },
156
+ {
157
+ path: "$.nested.property",
158
+ value: {
159
+ "TaxClassificationRef": {
160
+ "value": "EUC-99990201-V1-00020000",
161
+ },
162
+ },
163
+ },
164
+ ],
165
+ },
166
+ {
167
+ serviceId: "<id>",
168
+ extendPaths: [
169
+ {
170
+ path: "$.nested.property",
171
+ value: {
172
+ "TaxClassificationRef": {
173
+ "value": "EUC-99990201-V1-00020000",
174
+ },
175
+ },
176
+ },
177
+ ],
178
+ },
179
+ ],
180
+ },
181
+ ],
182
+ meta: {
183
+ itemsOnPage: 50,
184
+ cursors: {
185
+ previous: "em9oby1jcm06OnBhZ2U6OjE=",
186
+ current: "em9oby1jcm06OnBhZ2U6OjI=",
187
+ next: "em9oby1jcm06OnBhZ2U6OjM=",
188
+ },
189
+ },
190
+ links: {
191
+ previous:
192
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjE%3D",
193
+ current: "https://unify.apideck.com/crm/companies",
194
+ next:
195
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjM",
196
+ },
197
+ });
198
+ });
199
+
200
+ test("Attachments Accounting Attachments One", async () => {
201
+ const testHttpClient = createTestHTTPClient("accounting.attachmentsOne");
202
+
203
+ const apideck = new Apideck({
204
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
205
+ httpClient: testHttpClient,
206
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
207
+ });
208
+
209
+ const result = await apideck.accounting.attachments.get({
210
+ referenceType: "invoice",
211
+ referenceId: "123456",
212
+ id: "<id>",
213
+ serviceId: "salesforce",
214
+ fields: "id,updated_at",
215
+ });
216
+ expect(result.httpMeta.response.status).toBe(200);
217
+ expect(result.getAttachmentResponse).toBeDefined();
218
+ expect(result.getAttachmentResponse).toEqual({
219
+ statusCode: 200,
220
+ status: "OK",
221
+ service: "xero",
222
+ resource: "payments",
223
+ operation: "one",
224
+ data: {
225
+ id: "12345",
226
+ displayId: "sample ID",
227
+ name: "sample.jpg",
228
+ mimeType: "image/jpeg",
229
+ size: 1810673,
230
+ reference: {
231
+ type: "invoice",
232
+ id: "12345",
233
+ },
234
+ description: "A sample image",
235
+ parentFolderId: "123",
236
+ updatedBy: "12345",
237
+ createdBy: "12345",
238
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
239
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
240
+ passThrough: [
241
+ {
242
+ serviceId: "<id>",
243
+ extendPaths: [
244
+ {
245
+ path: "$.nested.property",
246
+ value: {
247
+ "TaxClassificationRef": {
248
+ "value": "EUC-99990201-V1-00020000",
249
+ },
250
+ },
251
+ },
252
+ {
253
+ path: "$.nested.property",
254
+ value: {
255
+ "TaxClassificationRef": {
256
+ "value": "EUC-99990201-V1-00020000",
257
+ },
258
+ },
259
+ },
260
+ ],
261
+ },
262
+ {
263
+ serviceId: "<id>",
264
+ extendPaths: [
265
+ {
266
+ path: "$.nested.property",
267
+ value: {
268
+ "TaxClassificationRef": {
269
+ "value": "EUC-99990201-V1-00020000",
270
+ },
271
+ },
272
+ },
273
+ {
274
+ path: "$.nested.property",
275
+ value: {
276
+ "TaxClassificationRef": {
277
+ "value": "EUC-99990201-V1-00020000",
278
+ },
279
+ },
280
+ },
281
+ ],
282
+ },
283
+ {
284
+ serviceId: "<id>",
285
+ extendPaths: [
286
+ {
287
+ path: "$.nested.property",
288
+ value: {
289
+ "TaxClassificationRef": {
290
+ "value": "EUC-99990201-V1-00020000",
291
+ },
292
+ },
293
+ },
294
+ {
295
+ path: "$.nested.property",
296
+ value: {
297
+ "TaxClassificationRef": {
298
+ "value": "EUC-99990201-V1-00020000",
299
+ },
300
+ },
301
+ },
302
+ ],
303
+ },
304
+ ],
305
+ },
306
+ });
307
+ });
308
+
309
+ test("Attachments Accounting Attachments Delete", async () => {
310
+ const testHttpClient = createTestHTTPClient("accounting.attachmentsDelete");
311
+
312
+ const apideck = new Apideck({
313
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
314
+ httpClient: testHttpClient,
315
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
316
+ });
317
+
318
+ const result = await apideck.accounting.attachments.delete({
319
+ referenceType: "invoice",
320
+ referenceId: "123456",
321
+ id: "<id>",
322
+ serviceId: "salesforce",
323
+ });
324
+ expect(result.httpMeta.response.status).toBe(200);
325
+ expect(result.deleteAttachmentResponse).toBeDefined();
326
+ expect(result.deleteAttachmentResponse).toEqual({
327
+ statusCode: 200,
328
+ status: "OK",
329
+ service: "google-drive",
330
+ resource: "files",
331
+ operation: "delete",
332
+ data: {
333
+ id: "12345",
334
+ },
335
+ });
336
+ });
337
+
338
+ test("Attachments Accounting Attachments Download", async () => {
339
+ const testHttpClient = createTestHTTPClient("accounting.attachmentsDownload");
340
+
341
+ const apideck = new Apideck({
342
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
343
+ httpClient: testHttpClient,
344
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
345
+ });
346
+
347
+ const result = await apideck.accounting.attachments.download({
348
+ referenceType: "invoice",
349
+ referenceId: "123456",
350
+ id: "<id>",
351
+ serviceId: "salesforce",
352
+ fields: "id,updated_at",
353
+ }, {
354
+ acceptHeaderOverride: DownloadAcceptEnum.wildcardRootWildcard,
355
+ });
356
+ expect(result.httpMeta.response.status).toBe(200);
357
+ expect(result.getAttachmentDownloadResponse).toBeDefined();
358
+ expect(
359
+ new Uint8Array(
360
+ await streamToByteArray(result.getAttachmentDownloadResponse),
361
+ ),
362
+ ).toEqual(await filesToByteArray(".speakeasy/testfiles/example.file"));
363
+ });