@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,718 @@
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("Opportunities Crm Opportunities All", async () => {
10
+ const testHttpClient = createTestHTTPClient("crm.opportunitiesAll");
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.crm.opportunities.list({
19
+ consumerId: "test-consumer",
20
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
21
+ serviceId: "salesforce",
22
+ filter: {
23
+ status: "Completed",
24
+ monetaryAmount: 75000,
25
+ },
26
+ sort: {
27
+ by: "created_at",
28
+ direction: "desc",
29
+ },
30
+ passThrough: {
31
+ "search": "San Francisco",
32
+ },
33
+ fields: "id,updated_at",
34
+ });
35
+ expect(result.httpMeta.response.status).toBe(200);
36
+ expect(result.getOpportunitiesResponse).toBeDefined();
37
+ expect(result.getOpportunitiesResponse).toEqual({
38
+ statusCode: 200,
39
+ status: "OK",
40
+ service: "zoho-crm",
41
+ resource: "opportunities",
42
+ operation: "all",
43
+ data: [
44
+ {
45
+ id: "12345",
46
+ title: "New Rocket",
47
+ primaryContactId: "12345",
48
+ description:
49
+ "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.",
50
+ type: "Existing Customer - Upgrade",
51
+ monetaryAmount: 75000,
52
+ currency: "USD",
53
+ winProbability: 40,
54
+ expectedRevenue: 75000,
55
+ closeDate: new Date("2020-10-30"),
56
+ lossReasonId: "12345",
57
+ lossReason: "No budget",
58
+ wonReasonId: "12345",
59
+ wonReason: "Best pitch",
60
+ pipelineId: "12345",
61
+ pipelineStageId: "12345",
62
+ sourceId: "12345",
63
+ leadId: "12345",
64
+ leadSource: "Website",
65
+ contactId: "12345",
66
+ contactIds: [
67
+ "12345",
68
+ ],
69
+ companyId: "12345",
70
+ companyName: "Copper",
71
+ ownerId: "12345",
72
+ priority: "None",
73
+ status: "Open",
74
+ statusId: "12345",
75
+ tags: [
76
+ "New",
77
+ ],
78
+ interactionCount: 0,
79
+ customFields: [
80
+ {
81
+ id: "2389328923893298",
82
+ name: "employee_level",
83
+ description: "Employee Level",
84
+ value: {},
85
+ },
86
+ {
87
+ id: "2389328923893298",
88
+ name: "employee_level",
89
+ description: "Employee Level",
90
+ value: 10,
91
+ },
92
+ ],
93
+ stageLastChangedAt: new Date("2020-09-30T07:43:32.000Z"),
94
+ lastActivityAt: "2020-09-30T07:43:32.000Z",
95
+ deleted: false,
96
+ dateStageChanged: new Date("2020-09-30T00:00:00.000Z"),
97
+ dateLastContacted: new Date("2020-09-30T00:00:00.000Z"),
98
+ dateLeadCreated: new Date("2020-09-30T00:00:00.000Z"),
99
+ updatedBy: "12345",
100
+ createdBy: "12345",
101
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
102
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
103
+ passThrough: [
104
+ {
105
+ serviceId: "<id>",
106
+ extendPaths: [
107
+ {
108
+ path: "$.nested.property",
109
+ value: {
110
+ "TaxClassificationRef": {
111
+ "value": "EUC-99990201-V1-00020000",
112
+ },
113
+ },
114
+ },
115
+ {
116
+ path: "$.nested.property",
117
+ value: {
118
+ "TaxClassificationRef": {
119
+ "value": "EUC-99990201-V1-00020000",
120
+ },
121
+ },
122
+ },
123
+ ],
124
+ },
125
+ ],
126
+ },
127
+ {
128
+ id: "12345",
129
+ title: "New Rocket",
130
+ primaryContactId: "12345",
131
+ description:
132
+ "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.",
133
+ type: "Existing Customer - Upgrade",
134
+ monetaryAmount: 75000,
135
+ currency: "USD",
136
+ winProbability: 40,
137
+ expectedRevenue: 75000,
138
+ closeDate: new Date("2020-10-30"),
139
+ lossReasonId: "12345",
140
+ lossReason: "No budget",
141
+ wonReasonId: "12345",
142
+ wonReason: "Best pitch",
143
+ pipelineId: "12345",
144
+ pipelineStageId: "12345",
145
+ sourceId: "12345",
146
+ leadId: "12345",
147
+ leadSource: "Website",
148
+ contactId: "12345",
149
+ contactIds: [
150
+ "12345",
151
+ ],
152
+ companyId: "12345",
153
+ companyName: "Copper",
154
+ ownerId: "12345",
155
+ priority: "None",
156
+ status: "Open",
157
+ statusId: "12345",
158
+ tags: [
159
+ "New",
160
+ ],
161
+ interactionCount: 0,
162
+ customFields: [
163
+ {
164
+ id: "2389328923893298",
165
+ name: "employee_level",
166
+ description: "Employee Level",
167
+ value: "Uses Salesforce and Marketo",
168
+ },
169
+ {
170
+ id: "2389328923893298",
171
+ name: "employee_level",
172
+ description: "Employee Level",
173
+ value: {},
174
+ },
175
+ ],
176
+ stageLastChangedAt: new Date("2020-09-30T07:43:32.000Z"),
177
+ lastActivityAt: "2020-09-30T07:43:32.000Z",
178
+ deleted: false,
179
+ dateStageChanged: new Date("2020-09-30T00:00:00.000Z"),
180
+ dateLastContacted: new Date("2020-09-30T00:00:00.000Z"),
181
+ dateLeadCreated: new Date("2020-09-30T00:00:00.000Z"),
182
+ updatedBy: "12345",
183
+ createdBy: "12345",
184
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
185
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
186
+ passThrough: [
187
+ {
188
+ serviceId: "<id>",
189
+ extendPaths: [
190
+ {
191
+ path: "$.nested.property",
192
+ value: {
193
+ "TaxClassificationRef": {
194
+ "value": "EUC-99990201-V1-00020000",
195
+ },
196
+ },
197
+ },
198
+ {
199
+ path: "$.nested.property",
200
+ value: {
201
+ "TaxClassificationRef": {
202
+ "value": "EUC-99990201-V1-00020000",
203
+ },
204
+ },
205
+ },
206
+ {
207
+ path: "$.nested.property",
208
+ value: {
209
+ "TaxClassificationRef": {
210
+ "value": "EUC-99990201-V1-00020000",
211
+ },
212
+ },
213
+ },
214
+ ],
215
+ },
216
+ ],
217
+ },
218
+ {
219
+ id: "12345",
220
+ title: "New Rocket",
221
+ primaryContactId: "12345",
222
+ description:
223
+ "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.",
224
+ type: "Existing Customer - Upgrade",
225
+ monetaryAmount: 75000,
226
+ currency: "USD",
227
+ winProbability: 40,
228
+ expectedRevenue: 75000,
229
+ closeDate: new Date("2020-10-30"),
230
+ lossReasonId: "12345",
231
+ lossReason: "No budget",
232
+ wonReasonId: "12345",
233
+ wonReason: "Best pitch",
234
+ pipelineId: "12345",
235
+ pipelineStageId: "12345",
236
+ sourceId: "12345",
237
+ leadId: "12345",
238
+ leadSource: "Website",
239
+ contactId: "12345",
240
+ contactIds: [
241
+ "12345",
242
+ ],
243
+ companyId: "12345",
244
+ companyName: "Copper",
245
+ ownerId: "12345",
246
+ priority: "None",
247
+ status: "Open",
248
+ statusId: "12345",
249
+ tags: [
250
+ "New",
251
+ ],
252
+ interactionCount: 0,
253
+ customFields: [
254
+ {
255
+ id: "2389328923893298",
256
+ name: "employee_level",
257
+ description: "Employee Level",
258
+ value: {},
259
+ },
260
+ {
261
+ id: "2389328923893298",
262
+ name: "employee_level",
263
+ description: "Employee Level",
264
+ value: "Uses Salesforce and Marketo",
265
+ },
266
+ ],
267
+ stageLastChangedAt: new Date("2020-09-30T07:43:32.000Z"),
268
+ lastActivityAt: "2020-09-30T07:43:32.000Z",
269
+ deleted: false,
270
+ dateStageChanged: new Date("2020-09-30T00:00:00.000Z"),
271
+ dateLastContacted: new Date("2020-09-30T00:00:00.000Z"),
272
+ dateLeadCreated: new Date("2020-09-30T00:00:00.000Z"),
273
+ updatedBy: "12345",
274
+ createdBy: "12345",
275
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
276
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
277
+ passThrough: [
278
+ {
279
+ serviceId: "<id>",
280
+ extendPaths: [
281
+ {
282
+ path: "$.nested.property",
283
+ value: {
284
+ "TaxClassificationRef": {
285
+ "value": "EUC-99990201-V1-00020000",
286
+ },
287
+ },
288
+ },
289
+ {
290
+ path: "$.nested.property",
291
+ value: {
292
+ "TaxClassificationRef": {
293
+ "value": "EUC-99990201-V1-00020000",
294
+ },
295
+ },
296
+ },
297
+ ],
298
+ },
299
+ ],
300
+ },
301
+ ],
302
+ meta: {
303
+ itemsOnPage: 50,
304
+ cursors: {
305
+ previous: "em9oby1jcm06OnBhZ2U6OjE=",
306
+ current: "em9oby1jcm06OnBhZ2U6OjI=",
307
+ next: "em9oby1jcm06OnBhZ2U6OjM=",
308
+ },
309
+ },
310
+ links: {
311
+ previous:
312
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjE%3D",
313
+ current: "https://unify.apideck.com/crm/companies",
314
+ next:
315
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjM",
316
+ },
317
+ });
318
+ });
319
+
320
+ test("Opportunities Crm Opportunities Add", async () => {
321
+ const testHttpClient = createTestHTTPClient("crm.opportunitiesAdd");
322
+
323
+ const apideck = new Apideck({
324
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
325
+ httpClient: testHttpClient,
326
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
327
+ });
328
+
329
+ const result = await apideck.crm.opportunities.create({
330
+ consumerId: "test-consumer",
331
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
332
+ serviceId: "salesforce",
333
+ opportunity: {
334
+ title: "New Rocket",
335
+ primaryContactId: "12345",
336
+ description:
337
+ "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.",
338
+ type: "Existing Customer - Upgrade",
339
+ monetaryAmount: 75000,
340
+ currency: "USD",
341
+ winProbability: 40,
342
+ closeDate: new Date("2020-10-30"),
343
+ lossReasonId: "12345",
344
+ lossReason: "No budget",
345
+ wonReasonId: "12345",
346
+ wonReason: "Best pitch",
347
+ pipelineId: "12345",
348
+ pipelineStageId: "12345",
349
+ sourceId: "12345",
350
+ leadId: "12345",
351
+ leadSource: "Website",
352
+ contactId: "12345",
353
+ contactIds: [
354
+ "12345",
355
+ ],
356
+ companyId: "12345",
357
+ companyName: "Copper",
358
+ ownerId: "12345",
359
+ priority: "None",
360
+ status: "Open",
361
+ statusId: "12345",
362
+ tags: [
363
+ "New",
364
+ ],
365
+ customFields: [
366
+ {
367
+ id: "2389328923893298",
368
+ name: "employee_level",
369
+ description: "Employee Level",
370
+ value: {},
371
+ },
372
+ {
373
+ id: "2389328923893298",
374
+ name: "employee_level",
375
+ description: "Employee Level",
376
+ value: true,
377
+ },
378
+ ],
379
+ stageLastChangedAt: new Date("2020-09-30T07:43:32.000Z"),
380
+ passThrough: [
381
+ {
382
+ serviceId: "<id>",
383
+ extendPaths: [
384
+ {
385
+ path: "$.nested.property",
386
+ value: {
387
+ "TaxClassificationRef": {
388
+ "value": "EUC-99990201-V1-00020000",
389
+ },
390
+ },
391
+ },
392
+ ],
393
+ },
394
+ ],
395
+ },
396
+ });
397
+ expect(result.httpMeta.response.status).toBe(201);
398
+ expect(result.createOpportunityResponse).toBeDefined();
399
+ expect(result.createOpportunityResponse).toEqual({
400
+ statusCode: 200,
401
+ status: "OK",
402
+ service: "zoho-crm",
403
+ resource: "opportunities",
404
+ operation: "add",
405
+ data: {
406
+ id: "12345",
407
+ },
408
+ });
409
+ });
410
+
411
+ test("Opportunities Crm Opportunities One", async () => {
412
+ const testHttpClient = createTestHTTPClient("crm.opportunitiesOne");
413
+
414
+ const apideck = new Apideck({
415
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
416
+ httpClient: testHttpClient,
417
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
418
+ });
419
+
420
+ const result = await apideck.crm.opportunities.get({
421
+ id: "<id>",
422
+ consumerId: "test-consumer",
423
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
424
+ serviceId: "salesforce",
425
+ fields: "id,updated_at",
426
+ });
427
+ expect(result.httpMeta.response.status).toBe(200);
428
+ expect(result.getOpportunityResponse).toBeDefined();
429
+ expect(result.getOpportunityResponse).toEqual({
430
+ statusCode: 200,
431
+ status: "OK",
432
+ service: "zoho-crm",
433
+ resource: "opportunities",
434
+ operation: "one",
435
+ data: {
436
+ id: "12345",
437
+ title: "New Rocket",
438
+ primaryContactId: "12345",
439
+ description:
440
+ "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.",
441
+ type: "Existing Customer - Upgrade",
442
+ monetaryAmount: 75000,
443
+ currency: "USD",
444
+ winProbability: 40,
445
+ expectedRevenue: 75000,
446
+ closeDate: new Date("2020-10-30"),
447
+ lossReasonId: "12345",
448
+ lossReason: "No budget",
449
+ wonReasonId: "12345",
450
+ wonReason: "Best pitch",
451
+ pipelineId: "12345",
452
+ pipelineStageId: "12345",
453
+ sourceId: "12345",
454
+ leadId: "12345",
455
+ leadSource: "Website",
456
+ contactId: "12345",
457
+ contactIds: [
458
+ "12345",
459
+ ],
460
+ companyId: "12345",
461
+ companyName: "Copper",
462
+ ownerId: "12345",
463
+ priority: "None",
464
+ status: "Open",
465
+ statusId: "12345",
466
+ tags: [
467
+ "New",
468
+ ],
469
+ interactionCount: 0,
470
+ customFields: [
471
+ {
472
+ id: "2389328923893298",
473
+ name: "employee_level",
474
+ description: "Employee Level",
475
+ value: {},
476
+ },
477
+ {
478
+ id: "2389328923893298",
479
+ name: "employee_level",
480
+ description: "Employee Level",
481
+ value: {},
482
+ },
483
+ {
484
+ id: "2389328923893298",
485
+ name: "employee_level",
486
+ description: "Employee Level",
487
+ value: {},
488
+ },
489
+ ],
490
+ stageLastChangedAt: new Date("2020-09-30T07:43:32.000Z"),
491
+ lastActivityAt: "2020-09-30T07:43:32.000Z",
492
+ deleted: false,
493
+ dateStageChanged: new Date("2020-09-30T00:00:00.000Z"),
494
+ dateLastContacted: new Date("2020-09-30T00:00:00.000Z"),
495
+ dateLeadCreated: new Date("2020-09-30T00:00:00.000Z"),
496
+ updatedBy: "12345",
497
+ createdBy: "12345",
498
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
499
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
500
+ passThrough: [
501
+ {
502
+ serviceId: "<id>",
503
+ extendPaths: [
504
+ {
505
+ path: "$.nested.property",
506
+ value: {
507
+ "TaxClassificationRef": {
508
+ "value": "EUC-99990201-V1-00020000",
509
+ },
510
+ },
511
+ },
512
+ {
513
+ path: "$.nested.property",
514
+ value: {
515
+ "TaxClassificationRef": {
516
+ "value": "EUC-99990201-V1-00020000",
517
+ },
518
+ },
519
+ },
520
+ ],
521
+ },
522
+ {
523
+ serviceId: "<id>",
524
+ extendPaths: [
525
+ {
526
+ path: "$.nested.property",
527
+ value: {
528
+ "TaxClassificationRef": {
529
+ "value": "EUC-99990201-V1-00020000",
530
+ },
531
+ },
532
+ },
533
+ {
534
+ path: "$.nested.property",
535
+ value: {
536
+ "TaxClassificationRef": {
537
+ "value": "EUC-99990201-V1-00020000",
538
+ },
539
+ },
540
+ },
541
+ ],
542
+ },
543
+ {
544
+ serviceId: "<id>",
545
+ extendPaths: [
546
+ {
547
+ path: "$.nested.property",
548
+ value: {
549
+ "TaxClassificationRef": {
550
+ "value": "EUC-99990201-V1-00020000",
551
+ },
552
+ },
553
+ },
554
+ ],
555
+ },
556
+ ],
557
+ },
558
+ });
559
+ });
560
+
561
+ test("Opportunities Crm Opportunities Update", async () => {
562
+ const testHttpClient = createTestHTTPClient("crm.opportunitiesUpdate");
563
+
564
+ const apideck = new Apideck({
565
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
566
+ httpClient: testHttpClient,
567
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
568
+ });
569
+
570
+ const result = await apideck.crm.opportunities.update({
571
+ id: "<id>",
572
+ consumerId: "test-consumer",
573
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
574
+ serviceId: "salesforce",
575
+ opportunity: {
576
+ title: "New Rocket",
577
+ primaryContactId: "12345",
578
+ description:
579
+ "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.",
580
+ type: "Existing Customer - Upgrade",
581
+ monetaryAmount: 75000,
582
+ currency: "USD",
583
+ winProbability: 40,
584
+ closeDate: new Date("2020-10-30"),
585
+ lossReasonId: "12345",
586
+ lossReason: "No budget",
587
+ wonReasonId: "12345",
588
+ wonReason: "Best pitch",
589
+ pipelineId: "12345",
590
+ pipelineStageId: "12345",
591
+ sourceId: "12345",
592
+ leadId: "12345",
593
+ leadSource: "Website",
594
+ contactId: "12345",
595
+ contactIds: [
596
+ "12345",
597
+ ],
598
+ companyId: "12345",
599
+ companyName: "Copper",
600
+ ownerId: "12345",
601
+ priority: "None",
602
+ status: "Open",
603
+ statusId: "12345",
604
+ tags: [
605
+ "New",
606
+ ],
607
+ customFields: [
608
+ {
609
+ id: "2389328923893298",
610
+ name: "employee_level",
611
+ description: "Employee Level",
612
+ value: {},
613
+ },
614
+ {
615
+ id: "2389328923893298",
616
+ name: "employee_level",
617
+ description: "Employee Level",
618
+ value: true,
619
+ },
620
+ {
621
+ id: "2389328923893298",
622
+ name: "employee_level",
623
+ description: "Employee Level",
624
+ value: {
625
+ "0": {},
626
+ "1": {},
627
+ },
628
+ },
629
+ ],
630
+ stageLastChangedAt: new Date("2020-09-30T07:43:32.000Z"),
631
+ passThrough: [
632
+ {
633
+ serviceId: "<id>",
634
+ extendPaths: [
635
+ {
636
+ path: "$.nested.property",
637
+ value: {
638
+ "TaxClassificationRef": {
639
+ "value": "EUC-99990201-V1-00020000",
640
+ },
641
+ },
642
+ },
643
+ {
644
+ path: "$.nested.property",
645
+ value: {
646
+ "TaxClassificationRef": {
647
+ "value": "EUC-99990201-V1-00020000",
648
+ },
649
+ },
650
+ },
651
+ {
652
+ path: "$.nested.property",
653
+ value: {
654
+ "TaxClassificationRef": {
655
+ "value": "EUC-99990201-V1-00020000",
656
+ },
657
+ },
658
+ },
659
+ ],
660
+ },
661
+ {
662
+ serviceId: "<id>",
663
+ extendPaths: [
664
+ {
665
+ path: "$.nested.property",
666
+ value: {
667
+ "TaxClassificationRef": {
668
+ "value": "EUC-99990201-V1-00020000",
669
+ },
670
+ },
671
+ },
672
+ ],
673
+ },
674
+ ],
675
+ },
676
+ });
677
+ expect(result.httpMeta.response.status).toBe(200);
678
+ expect(result.updateOpportunityResponse).toBeDefined();
679
+ expect(result.updateOpportunityResponse).toEqual({
680
+ statusCode: 200,
681
+ status: "OK",
682
+ service: "zoho-crm",
683
+ resource: "companies",
684
+ operation: "update",
685
+ data: {
686
+ id: "12345",
687
+ },
688
+ });
689
+ });
690
+
691
+ test("Opportunities Crm Opportunities Delete", async () => {
692
+ const testHttpClient = createTestHTTPClient("crm.opportunitiesDelete");
693
+
694
+ const apideck = new Apideck({
695
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
696
+ httpClient: testHttpClient,
697
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
698
+ });
699
+
700
+ const result = await apideck.crm.opportunities.delete({
701
+ id: "<id>",
702
+ consumerId: "test-consumer",
703
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
704
+ serviceId: "salesforce",
705
+ });
706
+ expect(result.httpMeta.response.status).toBe(200);
707
+ expect(result.deleteOpportunityResponse).toBeDefined();
708
+ expect(result.deleteOpportunityResponse).toEqual({
709
+ statusCode: 200,
710
+ status: "OK",
711
+ service: "zoho-crm",
712
+ resource: "companies",
713
+ operation: "delete",
714
+ data: {
715
+ id: "12345",
716
+ },
717
+ });
718
+ });