@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,503 @@
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 { RFCDate } from "../types/index.js";
8
+ import { createTestHTTPClient } from "./testclient.js";
9
+
10
+ test("Opportunities Crm Opportunities All", async () => {
11
+ const testHttpClient = createTestHTTPClient("crm.opportunitiesAll");
12
+
13
+ const apideck = new Apideck({
14
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
15
+ httpClient: testHttpClient,
16
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
17
+ });
18
+
19
+ const result = await apideck.crm.opportunities.list({
20
+ serviceId: "salesforce",
21
+ filter: {
22
+ status: "Completed",
23
+ monetaryAmount: 75000,
24
+ },
25
+ sort: {
26
+ by: "created_at",
27
+ },
28
+ passThrough: {
29
+ "search": "San Francisco",
30
+ },
31
+ fields: "id,updated_at",
32
+ });
33
+ expect(result.httpMeta.response.status).toBe(200);
34
+ expect(result.getOpportunitiesResponse).toBeDefined();
35
+ expect(result.getOpportunitiesResponse).toEqual({
36
+ statusCode: 200,
37
+ status: "OK",
38
+ service: "zoho-crm",
39
+ resource: "opportunities",
40
+ operation: "all",
41
+ data: [
42
+ {
43
+ id: "12345",
44
+ title: "New Rocket",
45
+ primaryContactId: "12345",
46
+ description:
47
+ "Opportunities are created for People and Companies that are interested in buying your products or services. Create Opportunities for People and Companies to move them through one of your Pipelines.",
48
+ type: "Existing Customer - Upgrade",
49
+ monetaryAmount: 75000,
50
+ currency: "USD",
51
+ winProbability: 40,
52
+ expectedRevenue: 75000,
53
+ closeDate: new RFCDate("2020-10-30"),
54
+ lossReasonId: "12345",
55
+ lossReason: "No budget",
56
+ wonReasonId: "12345",
57
+ wonReason: "Best pitch",
58
+ pipelineId: "12345",
59
+ pipelineStageId: "12345",
60
+ sourceId: "12345",
61
+ leadId: "12345",
62
+ leadSource: "Website",
63
+ contactId: "12345",
64
+ contactIds: [
65
+ "12345",
66
+ ],
67
+ companyId: "12345",
68
+ companyName: "Copper",
69
+ ownerId: "12345",
70
+ priority: "None",
71
+ status: "Open",
72
+ statusId: "12345",
73
+ tags: [
74
+ "New",
75
+ ],
76
+ interactionCount: 0,
77
+ customFields: [
78
+ {
79
+ id: "2389328923893298",
80
+ name: "employee_level",
81
+ description: "Employee Level",
82
+ value: {},
83
+ },
84
+ {
85
+ id: "2389328923893298",
86
+ name: "employee_level",
87
+ description: "Employee Level",
88
+ value: 10,
89
+ },
90
+ ],
91
+ stageLastChangedAt: new Date("2020-09-30T07:43:32.000Z"),
92
+ lastActivityAt: "2020-09-30T07:43:32.000Z",
93
+ deleted: false,
94
+ dateStageChanged: new Date("2020-09-30T00:00:00.000Z"),
95
+ dateLastContacted: new Date("2020-09-30T00:00:00.000Z"),
96
+ dateLeadCreated: new Date("2020-09-30T00:00:00.000Z"),
97
+ updatedBy: "12345",
98
+ createdBy: "12345",
99
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
100
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
101
+ passThrough: [
102
+ {
103
+ serviceId: "<id>",
104
+ extendPaths: [
105
+ {
106
+ path: "$.nested.property",
107
+ value: {
108
+ "TaxClassificationRef": {
109
+ "value": "EUC-99990201-V1-00020000",
110
+ },
111
+ },
112
+ },
113
+ {
114
+ path: "$.nested.property",
115
+ value: {
116
+ "TaxClassificationRef": {
117
+ "value": "EUC-99990201-V1-00020000",
118
+ },
119
+ },
120
+ },
121
+ ],
122
+ },
123
+ ],
124
+ },
125
+ {
126
+ id: "12345",
127
+ title: "New Rocket",
128
+ primaryContactId: "12345",
129
+ description:
130
+ "Opportunities are created for People and Companies that are interested in buying your products or services. Create Opportunities for People and Companies to move them through one of your Pipelines.",
131
+ type: "Existing Customer - Upgrade",
132
+ monetaryAmount: 75000,
133
+ currency: "USD",
134
+ winProbability: 40,
135
+ expectedRevenue: 75000,
136
+ closeDate: new RFCDate("2020-10-30"),
137
+ lossReasonId: "12345",
138
+ lossReason: "No budget",
139
+ wonReasonId: "12345",
140
+ wonReason: "Best pitch",
141
+ pipelineId: "12345",
142
+ pipelineStageId: "12345",
143
+ sourceId: "12345",
144
+ leadId: "12345",
145
+ leadSource: "Website",
146
+ contactId: "12345",
147
+ contactIds: [
148
+ "12345",
149
+ ],
150
+ companyId: "12345",
151
+ companyName: "Copper",
152
+ ownerId: "12345",
153
+ priority: "None",
154
+ status: "Open",
155
+ statusId: "12345",
156
+ tags: [
157
+ "New",
158
+ ],
159
+ interactionCount: 0,
160
+ customFields: [
161
+ {
162
+ id: "2389328923893298",
163
+ name: "employee_level",
164
+ description: "Employee Level",
165
+ value: "Uses Salesforce and Marketo",
166
+ },
167
+ {
168
+ id: "2389328923893298",
169
+ name: "employee_level",
170
+ description: "Employee Level",
171
+ value: {},
172
+ },
173
+ ],
174
+ stageLastChangedAt: new Date("2020-09-30T07:43:32.000Z"),
175
+ lastActivityAt: "2020-09-30T07:43:32.000Z",
176
+ deleted: false,
177
+ dateStageChanged: new Date("2020-09-30T00:00:00.000Z"),
178
+ dateLastContacted: new Date("2020-09-30T00:00:00.000Z"),
179
+ dateLeadCreated: new Date("2020-09-30T00:00:00.000Z"),
180
+ updatedBy: "12345",
181
+ createdBy: "12345",
182
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
183
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
184
+ passThrough: [
185
+ {
186
+ serviceId: "<id>",
187
+ extendPaths: [
188
+ {
189
+ path: "$.nested.property",
190
+ value: {
191
+ "TaxClassificationRef": {
192
+ "value": "EUC-99990201-V1-00020000",
193
+ },
194
+ },
195
+ },
196
+ {
197
+ path: "$.nested.property",
198
+ value: {
199
+ "TaxClassificationRef": {
200
+ "value": "EUC-99990201-V1-00020000",
201
+ },
202
+ },
203
+ },
204
+ {
205
+ path: "$.nested.property",
206
+ value: {
207
+ "TaxClassificationRef": {
208
+ "value": "EUC-99990201-V1-00020000",
209
+ },
210
+ },
211
+ },
212
+ ],
213
+ },
214
+ ],
215
+ },
216
+ {
217
+ id: "12345",
218
+ title: "New Rocket",
219
+ primaryContactId: "12345",
220
+ description:
221
+ "Opportunities are created for People and Companies that are interested in buying your products or services. Create Opportunities for People and Companies to move them through one of your Pipelines.",
222
+ type: "Existing Customer - Upgrade",
223
+ monetaryAmount: 75000,
224
+ currency: "USD",
225
+ winProbability: 40,
226
+ expectedRevenue: 75000,
227
+ closeDate: new RFCDate("2020-10-30"),
228
+ lossReasonId: "12345",
229
+ lossReason: "No budget",
230
+ wonReasonId: "12345",
231
+ wonReason: "Best pitch",
232
+ pipelineId: "12345",
233
+ pipelineStageId: "12345",
234
+ sourceId: "12345",
235
+ leadId: "12345",
236
+ leadSource: "Website",
237
+ contactId: "12345",
238
+ contactIds: [
239
+ "12345",
240
+ ],
241
+ companyId: "12345",
242
+ companyName: "Copper",
243
+ ownerId: "12345",
244
+ priority: "None",
245
+ status: "Open",
246
+ statusId: "12345",
247
+ tags: [
248
+ "New",
249
+ ],
250
+ interactionCount: 0,
251
+ customFields: [
252
+ {
253
+ id: "2389328923893298",
254
+ name: "employee_level",
255
+ description: "Employee Level",
256
+ value: {},
257
+ },
258
+ {
259
+ id: "2389328923893298",
260
+ name: "employee_level",
261
+ description: "Employee Level",
262
+ value: "Uses Salesforce and Marketo",
263
+ },
264
+ ],
265
+ stageLastChangedAt: new Date("2020-09-30T07:43:32.000Z"),
266
+ lastActivityAt: "2020-09-30T07:43:32.000Z",
267
+ deleted: false,
268
+ dateStageChanged: new Date("2020-09-30T00:00:00.000Z"),
269
+ dateLastContacted: new Date("2020-09-30T00:00:00.000Z"),
270
+ dateLeadCreated: new Date("2020-09-30T00:00:00.000Z"),
271
+ updatedBy: "12345",
272
+ createdBy: "12345",
273
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
274
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
275
+ passThrough: [
276
+ {
277
+ serviceId: "<id>",
278
+ extendPaths: [
279
+ {
280
+ path: "$.nested.property",
281
+ value: {
282
+ "TaxClassificationRef": {
283
+ "value": "EUC-99990201-V1-00020000",
284
+ },
285
+ },
286
+ },
287
+ {
288
+ path: "$.nested.property",
289
+ value: {
290
+ "TaxClassificationRef": {
291
+ "value": "EUC-99990201-V1-00020000",
292
+ },
293
+ },
294
+ },
295
+ ],
296
+ },
297
+ ],
298
+ },
299
+ ],
300
+ meta: {
301
+ itemsOnPage: 50,
302
+ cursors: {
303
+ previous: "em9oby1jcm06OnBhZ2U6OjE=",
304
+ current: "em9oby1jcm06OnBhZ2U6OjI=",
305
+ next: "em9oby1jcm06OnBhZ2U6OjM=",
306
+ },
307
+ },
308
+ links: {
309
+ previous:
310
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjE%3D",
311
+ current: "https://unify.apideck.com/crm/companies",
312
+ next:
313
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjM",
314
+ },
315
+ });
316
+ });
317
+
318
+ it.skip("Opportunities Crm Opportunities Add", async () => {
319
+ assert.fail(
320
+ "incomplete test found please make sure to address the following errors: [`workflow step crm.opportunitiesAdd.test referencing operation crm.opportunitiesAdd with expression in requestBody with type not currently supported`]",
321
+ );
322
+ });
323
+
324
+ test("Opportunities Crm Opportunities One", async () => {
325
+ const testHttpClient = createTestHTTPClient("crm.opportunitiesOne");
326
+
327
+ const apideck = new Apideck({
328
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
329
+ httpClient: testHttpClient,
330
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
331
+ });
332
+
333
+ const result = await apideck.crm.opportunities.get({
334
+ id: "<id>",
335
+ serviceId: "salesforce",
336
+ fields: "id,updated_at",
337
+ });
338
+ expect(result.httpMeta.response.status).toBe(200);
339
+ expect(result.getOpportunityResponse).toBeDefined();
340
+ expect(result.getOpportunityResponse).toEqual({
341
+ statusCode: 200,
342
+ status: "OK",
343
+ service: "zoho-crm",
344
+ resource: "opportunities",
345
+ operation: "one",
346
+ data: {
347
+ id: "12345",
348
+ title: "New Rocket",
349
+ primaryContactId: "12345",
350
+ description:
351
+ "Opportunities are created for People and Companies that are interested in buying your products or services. Create Opportunities for People and Companies to move them through one of your Pipelines.",
352
+ type: "Existing Customer - Upgrade",
353
+ monetaryAmount: 75000,
354
+ currency: "USD",
355
+ winProbability: 40,
356
+ expectedRevenue: 75000,
357
+ closeDate: new RFCDate("2020-10-30"),
358
+ lossReasonId: "12345",
359
+ lossReason: "No budget",
360
+ wonReasonId: "12345",
361
+ wonReason: "Best pitch",
362
+ pipelineId: "12345",
363
+ pipelineStageId: "12345",
364
+ sourceId: "12345",
365
+ leadId: "12345",
366
+ leadSource: "Website",
367
+ contactId: "12345",
368
+ contactIds: [
369
+ "12345",
370
+ ],
371
+ companyId: "12345",
372
+ companyName: "Copper",
373
+ ownerId: "12345",
374
+ priority: "None",
375
+ status: "Open",
376
+ statusId: "12345",
377
+ tags: [
378
+ "New",
379
+ ],
380
+ interactionCount: 0,
381
+ customFields: [
382
+ {
383
+ id: "2389328923893298",
384
+ name: "employee_level",
385
+ description: "Employee Level",
386
+ value: {},
387
+ },
388
+ {
389
+ id: "2389328923893298",
390
+ name: "employee_level",
391
+ description: "Employee Level",
392
+ value: {},
393
+ },
394
+ {
395
+ id: "2389328923893298",
396
+ name: "employee_level",
397
+ description: "Employee Level",
398
+ value: {},
399
+ },
400
+ ],
401
+ stageLastChangedAt: new Date("2020-09-30T07:43:32.000Z"),
402
+ lastActivityAt: "2020-09-30T07:43:32.000Z",
403
+ deleted: false,
404
+ dateStageChanged: new Date("2020-09-30T00:00:00.000Z"),
405
+ dateLastContacted: new Date("2020-09-30T00:00:00.000Z"),
406
+ dateLeadCreated: new Date("2020-09-30T00:00:00.000Z"),
407
+ updatedBy: "12345",
408
+ createdBy: "12345",
409
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
410
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
411
+ passThrough: [
412
+ {
413
+ serviceId: "<id>",
414
+ extendPaths: [
415
+ {
416
+ path: "$.nested.property",
417
+ value: {
418
+ "TaxClassificationRef": {
419
+ "value": "EUC-99990201-V1-00020000",
420
+ },
421
+ },
422
+ },
423
+ {
424
+ path: "$.nested.property",
425
+ value: {
426
+ "TaxClassificationRef": {
427
+ "value": "EUC-99990201-V1-00020000",
428
+ },
429
+ },
430
+ },
431
+ ],
432
+ },
433
+ {
434
+ serviceId: "<id>",
435
+ extendPaths: [
436
+ {
437
+ path: "$.nested.property",
438
+ value: {
439
+ "TaxClassificationRef": {
440
+ "value": "EUC-99990201-V1-00020000",
441
+ },
442
+ },
443
+ },
444
+ {
445
+ path: "$.nested.property",
446
+ value: {
447
+ "TaxClassificationRef": {
448
+ "value": "EUC-99990201-V1-00020000",
449
+ },
450
+ },
451
+ },
452
+ ],
453
+ },
454
+ {
455
+ serviceId: "<id>",
456
+ extendPaths: [
457
+ {
458
+ path: "$.nested.property",
459
+ value: {
460
+ "TaxClassificationRef": {
461
+ "value": "EUC-99990201-V1-00020000",
462
+ },
463
+ },
464
+ },
465
+ ],
466
+ },
467
+ ],
468
+ },
469
+ });
470
+ });
471
+
472
+ it.skip("Opportunities Crm Opportunities Update", async () => {
473
+ assert.fail(
474
+ "incomplete test found please make sure to address the following errors: [`workflow step crm.opportunitiesUpdate.test referencing operation crm.opportunitiesUpdate with expression in requestBody with type not currently supported`, `workflow step crm.opportunitiesUpdate.test referencing operation crm.opportunitiesUpdate with expression in requestBody with type not currently supported`, `workflow step crm.opportunitiesUpdate.test referencing operation crm.opportunitiesUpdate with expression in requestBody with type not currently supported`, `workflow step crm.opportunitiesUpdate.test referencing operation crm.opportunitiesUpdate with expression in requestBody with type not currently supported`]",
475
+ );
476
+ });
477
+
478
+ test("Opportunities Crm Opportunities Delete", async () => {
479
+ const testHttpClient = createTestHTTPClient("crm.opportunitiesDelete");
480
+
481
+ const apideck = new Apideck({
482
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
483
+ httpClient: testHttpClient,
484
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
485
+ });
486
+
487
+ const result = await apideck.crm.opportunities.delete({
488
+ id: "<id>",
489
+ serviceId: "salesforce",
490
+ });
491
+ expect(result.httpMeta.response.status).toBe(200);
492
+ expect(result.deleteOpportunityResponse).toBeDefined();
493
+ expect(result.deleteOpportunityResponse).toEqual({
494
+ statusCode: 200,
495
+ status: "OK",
496
+ service: "zoho-crm",
497
+ resource: "companies",
498
+ operation: "delete",
499
+ data: {
500
+ id: "12345",
501
+ },
502
+ });
503
+ });