@apideck/unify 0.39.6 → 0.40.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 (102) 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/lib/config.js.map +1 -1
  5. package/lib/encodings.d.ts +1 -0
  6. package/lib/encodings.d.ts.map +1 -1
  7. package/lib/encodings.js +7 -0
  8. package/lib/encodings.js.map +1 -1
  9. package/package.json +2 -6
  10. package/src/lib/config.ts +4 -4
  11. package/src/lib/encodings.ts +9 -0
  12. package/src/__tests__/activities.test.ts +0 -1141
  13. package/src/__tests__/agedcreditors.test.ts +0 -280
  14. package/src/__tests__/ageddebtors.test.ts +0 -280
  15. package/src/__tests__/apideckcompanies.test.ts +0 -1082
  16. package/src/__tests__/apideckcustomers.test.ts +0 -364
  17. package/src/__tests__/apideckdepartments.test.ts +0 -497
  18. package/src/__tests__/apiresources.test.ts +0 -62
  19. package/src/__tests__/apis.test.ts +0 -216
  20. package/src/__tests__/applicants.test.ts +0 -1445
  21. package/src/__tests__/applications.test.ts +0 -515
  22. package/src/__tests__/assertions.ts +0 -13
  23. package/src/__tests__/attachments.test.ts +0 -371
  24. package/src/__tests__/balancesheet.test.ts +0 -453
  25. package/src/__tests__/bankaccounts.test.ts +0 -324
  26. package/src/__tests__/bankfeedaccounts.test.ts +0 -343
  27. package/src/__tests__/bankfeedstatements.test.ts +0 -408
  28. package/src/__tests__/billpayments.test.ts +0 -1031
  29. package/src/__tests__/bills.test.ts +0 -1630
  30. package/src/__tests__/categories.test.ts +0 -127
  31. package/src/__tests__/collections.test.ts +0 -120
  32. package/src/__tests__/collectiontags.test.ts +0 -68
  33. package/src/__tests__/collectionticketcomments.test.ts +0 -501
  34. package/src/__tests__/collectiontickets.test.ts +0 -627
  35. package/src/__tests__/collectionusers.test.ts +0 -126
  36. package/src/__tests__/companies.test.ts +0 -1642
  37. package/src/__tests__/companyinfo.test.ts +0 -219
  38. package/src/__tests__/connectionconsent.test.ts +0 -89
  39. package/src/__tests__/connectionconsents.test.ts +0 -31
  40. package/src/__tests__/connectioncustommappings.test.ts +0 -69
  41. package/src/__tests__/connections.test.ts +0 -2127
  42. package/src/__tests__/connectionsettings.test.ts +0 -687
  43. package/src/__tests__/connectordocs.test.ts +0 -29
  44. package/src/__tests__/connectors.test.ts +0 -753
  45. package/src/__tests__/consumerrequestcounts.test.ts +0 -42
  46. package/src/__tests__/consumers.test.ts +0 -523
  47. package/src/__tests__/contacts.test.ts +0 -1421
  48. package/src/__tests__/createcallback.test.ts +0 -36
  49. package/src/__tests__/creditnotes.test.ts +0 -2040
  50. package/src/__tests__/customers.test.ts +0 -1600
  51. package/src/__tests__/customfields.test.ts +0 -52
  52. package/src/__tests__/custommappings.test.ts +0 -65
  53. package/src/__tests__/customobjects.test.ts +0 -408
  54. package/src/__tests__/customobjectschemas.test.ts +0 -734
  55. package/src/__tests__/departments.test.ts +0 -529
  56. package/src/__tests__/drivegroups.test.ts +0 -496
  57. package/src/__tests__/drives.test.ts +0 -487
  58. package/src/__tests__/employeepayrolls.test.ts +0 -491
  59. package/src/__tests__/employees.test.ts +0 -2968
  60. package/src/__tests__/employeeschedules.test.ts +0 -457
  61. package/src/__tests__/eventlogs.test.ts +0 -158
  62. package/src/__tests__/expensecategories.test.ts +0 -324
  63. package/src/__tests__/expensereports.test.ts +0 -634
  64. package/src/__tests__/expenses.test.ts +0 -867
  65. package/src/__tests__/files.test.ts +0 -506
  66. package/src/__tests__/files.ts +0 -56
  67. package/src/__tests__/folders.test.ts +0 -390
  68. package/src/__tests__/invoiceitems.test.ts +0 -855
  69. package/src/__tests__/invoices.test.ts +0 -2173
  70. package/src/__tests__/jobs.test.ts +0 -1150
  71. package/src/__tests__/journalentries.test.ts +0 -1542
  72. package/src/__tests__/leads.test.ts +0 -1341
  73. package/src/__tests__/ledgeraccounts.test.ts +0 -829
  74. package/src/__tests__/locations.test.ts +0 -856
  75. package/src/__tests__/logs.test.ts +0 -137
  76. package/src/__tests__/messages.test.ts +0 -588
  77. package/src/__tests__/notes.test.ts +0 -523
  78. package/src/__tests__/opportunities.test.ts +0 -718
  79. package/src/__tests__/orders.test.ts +0 -854
  80. package/src/__tests__/payments.test.ts +0 -867
  81. package/src/__tests__/payrolls.test.ts +0 -485
  82. package/src/__tests__/pipelines.test.ts +0 -574
  83. package/src/__tests__/products.test.ts +0 -509
  84. package/src/__tests__/profitandloss.test.ts +0 -223
  85. package/src/__tests__/projects.test.ts +0 -480
  86. package/src/__tests__/proxy.test.ts +0 -41
  87. package/src/__tests__/purchaseorders.test.ts +0 -2139
  88. package/src/__tests__/quotes.test.ts +0 -678
  89. package/src/__tests__/refunds.test.ts +0 -812
  90. package/src/__tests__/sessions.test.ts +0 -72
  91. package/src/__tests__/sharedlinks.test.ts +0 -511
  92. package/src/__tests__/stores.test.ts +0 -41
  93. package/src/__tests__/subsidiaries.test.ts +0 -496
  94. package/src/__tests__/suppliers.test.ts +0 -1574
  95. package/src/__tests__/taxrates.test.ts +0 -701
  96. package/src/__tests__/testclient.ts +0 -48
  97. package/src/__tests__/timeoffrequests.test.ts +0 -588
  98. package/src/__tests__/trackingcategories.test.ts +0 -515
  99. package/src/__tests__/uploadsessions.test.ts +0 -221
  100. package/src/__tests__/users.test.ts +0 -1020
  101. package/src/__tests__/validateconnection.test.ts +0 -34
  102. package/src/__tests__/webhooks.test.ts +0 -254
@@ -1,1341 +0,0 @@
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("Leads Crm Leads All", async () => {
10
- const testHttpClient = createTestHTTPClient("crm.leadsAll");
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.leads.list({
19
- consumerId: "test-consumer",
20
- appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
21
- serviceId: "salesforce",
22
- filter: {
23
- firstName: "Elon",
24
- lastName: "Musk",
25
- email: "elon@tesla.com",
26
- phoneNumber: "1234567890",
27
- },
28
- sort: {
29
- by: "created_at",
30
- direction: "desc",
31
- },
32
- passThrough: {
33
- "search": "San Francisco",
34
- },
35
- fields: "id,updated_at",
36
- });
37
- expect(result.httpMeta.response.status).toBe(200);
38
- expect(result.getLeadsResponse).toBeDefined();
39
- expect(result.getLeadsResponse).toEqual({
40
- statusCode: 200,
41
- status: "OK",
42
- service: "zoho-crm",
43
- resource: "companies",
44
- operation: "all",
45
- data: [
46
- {
47
- id: "12345",
48
- name: "Elon Musk",
49
- companyName: "Spacex",
50
- ownerId: "54321",
51
- ownerName: "John Doe",
52
- companyId: "2",
53
- leadId: "2",
54
- leadSource: "Cold Call",
55
- firstName: "Elon",
56
- lastName: "Musk",
57
- description: "A thinker",
58
- prefix: "Sir",
59
- title: "CEO",
60
- language: "EN",
61
- status: "New",
62
- monetaryAmount: 75000,
63
- currency: "USD",
64
- fax: "+12129876543",
65
- websites: [
66
- {
67
- id: "12345",
68
- url: "http://example.com",
69
- type: "primary",
70
- },
71
- {
72
- id: "12345",
73
- url: "http://example.com",
74
- type: "primary",
75
- },
76
- ],
77
- addresses: [
78
- {
79
- id: "123",
80
- type: "primary",
81
- string: "25 Spring Street, Blackburn, VIC 3130",
82
- name: "HQ US",
83
- line1: "Main street",
84
- line2: "apt #",
85
- line3: "Suite #",
86
- line4: "delivery instructions",
87
- streetNumber: "25",
88
- city: "San Francisco",
89
- state: "CA",
90
- postalCode: "94104",
91
- country: "US",
92
- latitude: "40.759211",
93
- longitude: "-73.984638",
94
- county: "Santa Clara",
95
- contactName: "Elon Musk",
96
- salutation: "Mr",
97
- phoneNumber: "111-111-1111",
98
- fax: "122-111-1111",
99
- email: "elon@musk.com",
100
- website: "https://elonmusk.com",
101
- notes: "Address notes or delivery instructions.",
102
- rowVersion: "1-12345",
103
- },
104
- {
105
- id: "123",
106
- type: "primary",
107
- string: "25 Spring Street, Blackburn, VIC 3130",
108
- name: "HQ US",
109
- line1: "Main street",
110
- line2: "apt #",
111
- line3: "Suite #",
112
- line4: "delivery instructions",
113
- streetNumber: "25",
114
- city: "San Francisco",
115
- state: "CA",
116
- postalCode: "94104",
117
- country: "US",
118
- latitude: "40.759211",
119
- longitude: "-73.984638",
120
- county: "Santa Clara",
121
- contactName: "Elon Musk",
122
- salutation: "Mr",
123
- phoneNumber: "111-111-1111",
124
- fax: "122-111-1111",
125
- email: "elon@musk.com",
126
- website: "https://elonmusk.com",
127
- notes: "Address notes or delivery instructions.",
128
- rowVersion: "1-12345",
129
- },
130
- {
131
- id: "123",
132
- type: "primary",
133
- string: "25 Spring Street, Blackburn, VIC 3130",
134
- name: "HQ US",
135
- line1: "Main street",
136
- line2: "apt #",
137
- line3: "Suite #",
138
- line4: "delivery instructions",
139
- streetNumber: "25",
140
- city: "San Francisco",
141
- state: "CA",
142
- postalCode: "94104",
143
- country: "US",
144
- latitude: "40.759211",
145
- longitude: "-73.984638",
146
- county: "Santa Clara",
147
- contactName: "Elon Musk",
148
- salutation: "Mr",
149
- phoneNumber: "111-111-1111",
150
- fax: "122-111-1111",
151
- email: "elon@musk.com",
152
- website: "https://elonmusk.com",
153
- notes: "Address notes or delivery instructions.",
154
- rowVersion: "1-12345",
155
- },
156
- ],
157
- socialLinks: [
158
- {
159
- id: "12345",
160
- url: "https://www.twitter.com/apideck",
161
- type: "twitter",
162
- },
163
- ],
164
- phoneNumbers: [
165
- {
166
- id: "12345",
167
- countryCode: "1",
168
- areaCode: "323",
169
- number: "111-111-1111",
170
- extension: "105",
171
- type: "primary",
172
- },
173
- ],
174
- emails: [
175
- {
176
- id: "123",
177
- email: "elon@musk.com",
178
- type: "primary",
179
- },
180
- ],
181
- customFields: [
182
- {
183
- id: "2389328923893298",
184
- name: "employee_level",
185
- description: "Employee Level",
186
- value: {},
187
- },
188
- {
189
- id: "2389328923893298",
190
- name: "employee_level",
191
- description: "Employee Level",
192
- value: "Uses Salesforce and Marketo",
193
- },
194
- ],
195
- tags: [
196
- "New",
197
- ],
198
- updatedAt: "2020-09-30T07:43:32.000Z",
199
- createdAt: "2020-09-30T07:43:32.000Z",
200
- passThrough: [
201
- {
202
- serviceId: "<id>",
203
- extendPaths: [
204
- {
205
- path: "$.nested.property",
206
- value: {
207
- "TaxClassificationRef": {
208
- "value": "EUC-99990201-V1-00020000",
209
- },
210
- },
211
- },
212
- ],
213
- },
214
- {
215
- serviceId: "<id>",
216
- extendPaths: [
217
- {
218
- path: "$.nested.property",
219
- value: {
220
- "TaxClassificationRef": {
221
- "value": "EUC-99990201-V1-00020000",
222
- },
223
- },
224
- },
225
- ],
226
- },
227
- {
228
- serviceId: "<id>",
229
- extendPaths: [
230
- {
231
- path: "$.nested.property",
232
- value: {
233
- "TaxClassificationRef": {
234
- "value": "EUC-99990201-V1-00020000",
235
- },
236
- },
237
- },
238
- {
239
- path: "$.nested.property",
240
- value: {
241
- "TaxClassificationRef": {
242
- "value": "EUC-99990201-V1-00020000",
243
- },
244
- },
245
- },
246
- {
247
- path: "$.nested.property",
248
- value: {
249
- "TaxClassificationRef": {
250
- "value": "EUC-99990201-V1-00020000",
251
- },
252
- },
253
- },
254
- ],
255
- },
256
- ],
257
- },
258
- {
259
- id: "12345",
260
- name: "Elon Musk",
261
- companyName: "Spacex",
262
- ownerId: "54321",
263
- ownerName: "John Doe",
264
- companyId: "2",
265
- leadId: "2",
266
- leadSource: "Cold Call",
267
- firstName: "Elon",
268
- lastName: "Musk",
269
- description: "A thinker",
270
- prefix: "Sir",
271
- title: "CEO",
272
- language: "EN",
273
- status: "New",
274
- monetaryAmount: 75000,
275
- currency: "USD",
276
- fax: "+12129876543",
277
- websites: [
278
- {
279
- id: "12345",
280
- url: "http://example.com",
281
- type: "primary",
282
- },
283
- {
284
- id: "12345",
285
- url: "http://example.com",
286
- type: "primary",
287
- },
288
- ],
289
- addresses: [
290
- {
291
- id: "123",
292
- type: "primary",
293
- string: "25 Spring Street, Blackburn, VIC 3130",
294
- name: "HQ US",
295
- line1: "Main street",
296
- line2: "apt #",
297
- line3: "Suite #",
298
- line4: "delivery instructions",
299
- streetNumber: "25",
300
- city: "San Francisco",
301
- state: "CA",
302
- postalCode: "94104",
303
- country: "US",
304
- latitude: "40.759211",
305
- longitude: "-73.984638",
306
- county: "Santa Clara",
307
- contactName: "Elon Musk",
308
- salutation: "Mr",
309
- phoneNumber: "111-111-1111",
310
- fax: "122-111-1111",
311
- email: "elon@musk.com",
312
- website: "https://elonmusk.com",
313
- notes: "Address notes or delivery instructions.",
314
- rowVersion: "1-12345",
315
- },
316
- {
317
- id: "123",
318
- type: "primary",
319
- string: "25 Spring Street, Blackburn, VIC 3130",
320
- name: "HQ US",
321
- line1: "Main street",
322
- line2: "apt #",
323
- line3: "Suite #",
324
- line4: "delivery instructions",
325
- streetNumber: "25",
326
- city: "San Francisco",
327
- state: "CA",
328
- postalCode: "94104",
329
- country: "US",
330
- latitude: "40.759211",
331
- longitude: "-73.984638",
332
- county: "Santa Clara",
333
- contactName: "Elon Musk",
334
- salutation: "Mr",
335
- phoneNumber: "111-111-1111",
336
- fax: "122-111-1111",
337
- email: "elon@musk.com",
338
- website: "https://elonmusk.com",
339
- notes: "Address notes or delivery instructions.",
340
- rowVersion: "1-12345",
341
- },
342
- ],
343
- socialLinks: [
344
- {
345
- id: "12345",
346
- url: "https://www.twitter.com/apideck",
347
- type: "twitter",
348
- },
349
- ],
350
- phoneNumbers: [
351
- {
352
- id: "12345",
353
- countryCode: "1",
354
- areaCode: "323",
355
- number: "111-111-1111",
356
- extension: "105",
357
- type: "primary",
358
- },
359
- ],
360
- emails: [
361
- {
362
- id: "123",
363
- email: "elon@musk.com",
364
- type: "primary",
365
- },
366
- {
367
- id: "123",
368
- email: "elon@musk.com",
369
- type: "primary",
370
- },
371
- ],
372
- customFields: [
373
- {
374
- id: "2389328923893298",
375
- name: "employee_level",
376
- description: "Employee Level",
377
- value: "Uses Salesforce and Marketo",
378
- },
379
- {
380
- id: "2389328923893298",
381
- name: "employee_level",
382
- description: "Employee Level",
383
- value: {
384
- "0": {},
385
- "1": {},
386
- },
387
- },
388
- ],
389
- tags: [
390
- "New",
391
- ],
392
- updatedAt: "2020-09-30T07:43:32.000Z",
393
- createdAt: "2020-09-30T07:43:32.000Z",
394
- passThrough: [
395
- {
396
- serviceId: "<id>",
397
- extendPaths: [
398
- {
399
- path: "$.nested.property",
400
- value: {
401
- "TaxClassificationRef": {
402
- "value": "EUC-99990201-V1-00020000",
403
- },
404
- },
405
- },
406
- {
407
- path: "$.nested.property",
408
- value: {
409
- "TaxClassificationRef": {
410
- "value": "EUC-99990201-V1-00020000",
411
- },
412
- },
413
- },
414
- ],
415
- },
416
- {
417
- serviceId: "<id>",
418
- extendPaths: [
419
- {
420
- path: "$.nested.property",
421
- value: {
422
- "TaxClassificationRef": {
423
- "value": "EUC-99990201-V1-00020000",
424
- },
425
- },
426
- },
427
- ],
428
- },
429
- {
430
- serviceId: "<id>",
431
- extendPaths: [
432
- {
433
- path: "$.nested.property",
434
- value: {
435
- "TaxClassificationRef": {
436
- "value": "EUC-99990201-V1-00020000",
437
- },
438
- },
439
- },
440
- ],
441
- },
442
- ],
443
- },
444
- {
445
- id: "12345",
446
- name: "Elon Musk",
447
- companyName: "Spacex",
448
- ownerId: "54321",
449
- ownerName: "John Doe",
450
- companyId: "2",
451
- leadId: "2",
452
- leadSource: "Cold Call",
453
- firstName: "Elon",
454
- lastName: "Musk",
455
- description: "A thinker",
456
- prefix: "Sir",
457
- title: "CEO",
458
- language: "EN",
459
- status: "New",
460
- monetaryAmount: 75000,
461
- currency: "USD",
462
- fax: "+12129876543",
463
- websites: [
464
- {
465
- id: "12345",
466
- url: "http://example.com",
467
- type: "primary",
468
- },
469
- {
470
- id: "12345",
471
- url: "http://example.com",
472
- type: "primary",
473
- },
474
- {
475
- id: "12345",
476
- url: "http://example.com",
477
- type: "primary",
478
- },
479
- ],
480
- addresses: [
481
- {
482
- id: "123",
483
- type: "primary",
484
- string: "25 Spring Street, Blackburn, VIC 3130",
485
- name: "HQ US",
486
- line1: "Main street",
487
- line2: "apt #",
488
- line3: "Suite #",
489
- line4: "delivery instructions",
490
- streetNumber: "25",
491
- city: "San Francisco",
492
- state: "CA",
493
- postalCode: "94104",
494
- country: "US",
495
- latitude: "40.759211",
496
- longitude: "-73.984638",
497
- county: "Santa Clara",
498
- contactName: "Elon Musk",
499
- salutation: "Mr",
500
- phoneNumber: "111-111-1111",
501
- fax: "122-111-1111",
502
- email: "elon@musk.com",
503
- website: "https://elonmusk.com",
504
- notes: "Address notes or delivery instructions.",
505
- rowVersion: "1-12345",
506
- },
507
- ],
508
- socialLinks: [
509
- {
510
- id: "12345",
511
- url: "https://www.twitter.com/apideck",
512
- type: "twitter",
513
- },
514
- {
515
- id: "12345",
516
- url: "https://www.twitter.com/apideck",
517
- type: "twitter",
518
- },
519
- {
520
- id: "12345",
521
- url: "https://www.twitter.com/apideck",
522
- type: "twitter",
523
- },
524
- ],
525
- phoneNumbers: [
526
- {
527
- id: "12345",
528
- countryCode: "1",
529
- areaCode: "323",
530
- number: "111-111-1111",
531
- extension: "105",
532
- type: "primary",
533
- },
534
- {
535
- id: "12345",
536
- countryCode: "1",
537
- areaCode: "323",
538
- number: "111-111-1111",
539
- extension: "105",
540
- type: "primary",
541
- },
542
- ],
543
- emails: [
544
- {
545
- id: "123",
546
- email: "elon@musk.com",
547
- type: "primary",
548
- },
549
- {
550
- id: "123",
551
- email: "elon@musk.com",
552
- type: "primary",
553
- },
554
- {
555
- id: "123",
556
- email: "elon@musk.com",
557
- type: "primary",
558
- },
559
- ],
560
- customFields: [
561
- {
562
- id: "2389328923893298",
563
- name: "employee_level",
564
- description: "Employee Level",
565
- value: "Uses Salesforce and Marketo",
566
- },
567
- ],
568
- tags: [
569
- "New",
570
- ],
571
- updatedAt: "2020-09-30T07:43:32.000Z",
572
- createdAt: "2020-09-30T07:43:32.000Z",
573
- passThrough: [
574
- {
575
- serviceId: "<id>",
576
- extendPaths: [
577
- {
578
- path: "$.nested.property",
579
- value: {
580
- "TaxClassificationRef": {
581
- "value": "EUC-99990201-V1-00020000",
582
- },
583
- },
584
- },
585
- ],
586
- },
587
- {
588
- serviceId: "<id>",
589
- extendPaths: [
590
- {
591
- path: "$.nested.property",
592
- value: {
593
- "TaxClassificationRef": {
594
- "value": "EUC-99990201-V1-00020000",
595
- },
596
- },
597
- },
598
- {
599
- path: "$.nested.property",
600
- value: {
601
- "TaxClassificationRef": {
602
- "value": "EUC-99990201-V1-00020000",
603
- },
604
- },
605
- },
606
- ],
607
- },
608
- {
609
- serviceId: "<id>",
610
- extendPaths: [
611
- {
612
- path: "$.nested.property",
613
- value: {
614
- "TaxClassificationRef": {
615
- "value": "EUC-99990201-V1-00020000",
616
- },
617
- },
618
- },
619
- {
620
- path: "$.nested.property",
621
- value: {
622
- "TaxClassificationRef": {
623
- "value": "EUC-99990201-V1-00020000",
624
- },
625
- },
626
- },
627
- ],
628
- },
629
- ],
630
- },
631
- ],
632
- meta: {
633
- itemsOnPage: 50,
634
- cursors: {
635
- previous: "em9oby1jcm06OnBhZ2U6OjE=",
636
- current: "em9oby1jcm06OnBhZ2U6OjI=",
637
- next: "em9oby1jcm06OnBhZ2U6OjM=",
638
- },
639
- },
640
- links: {
641
- previous:
642
- "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjE%3D",
643
- current: "https://unify.apideck.com/crm/companies",
644
- next:
645
- "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjM",
646
- },
647
- });
648
- });
649
-
650
- test("Leads Crm Leads Add", async () => {
651
- const testHttpClient = createTestHTTPClient("crm.leadsAdd");
652
-
653
- const apideck = new Apideck({
654
- serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
655
- httpClient: testHttpClient,
656
- apiKey: process.env["APIDECK_API_KEY"] ?? "value",
657
- });
658
-
659
- const result = await apideck.crm.leads.create({
660
- consumerId: "test-consumer",
661
- appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
662
- serviceId: "salesforce",
663
- lead: {
664
- name: "Elon Musk",
665
- companyName: "Spacex",
666
- ownerId: "54321",
667
- ownerName: "John Doe",
668
- companyId: "2",
669
- leadId: "2",
670
- leadSource: "Cold Call",
671
- firstName: "Elon",
672
- lastName: "Musk",
673
- description: "A thinker",
674
- prefix: "Sir",
675
- title: "CEO",
676
- language: "EN",
677
- status: "New",
678
- monetaryAmount: 75000,
679
- currency: "USD",
680
- fax: "+12129876543",
681
- websites: [
682
- {
683
- id: "12345",
684
- url: "http://example.com",
685
- type: "primary",
686
- },
687
- {
688
- id: "12345",
689
- url: "http://example.com",
690
- type: "primary",
691
- },
692
- ],
693
- addresses: [
694
- {
695
- id: "123",
696
- type: "primary",
697
- string: "25 Spring Street, Blackburn, VIC 3130",
698
- name: "HQ US",
699
- line1: "Main street",
700
- line2: "apt #",
701
- line3: "Suite #",
702
- line4: "delivery instructions",
703
- streetNumber: "25",
704
- city: "San Francisco",
705
- state: "CA",
706
- postalCode: "94104",
707
- country: "US",
708
- latitude: "40.759211",
709
- longitude: "-73.984638",
710
- county: "Santa Clara",
711
- contactName: "Elon Musk",
712
- salutation: "Mr",
713
- phoneNumber: "111-111-1111",
714
- fax: "122-111-1111",
715
- email: "elon@musk.com",
716
- website: "https://elonmusk.com",
717
- notes: "Address notes or delivery instructions.",
718
- rowVersion: "1-12345",
719
- },
720
- {
721
- id: "123",
722
- type: "primary",
723
- string: "25 Spring Street, Blackburn, VIC 3130",
724
- name: "HQ US",
725
- line1: "Main street",
726
- line2: "apt #",
727
- line3: "Suite #",
728
- line4: "delivery instructions",
729
- streetNumber: "25",
730
- city: "San Francisco",
731
- state: "CA",
732
- postalCode: "94104",
733
- country: "US",
734
- latitude: "40.759211",
735
- longitude: "-73.984638",
736
- county: "Santa Clara",
737
- contactName: "Elon Musk",
738
- salutation: "Mr",
739
- phoneNumber: "111-111-1111",
740
- fax: "122-111-1111",
741
- email: "elon@musk.com",
742
- website: "https://elonmusk.com",
743
- notes: "Address notes or delivery instructions.",
744
- rowVersion: "1-12345",
745
- },
746
- ],
747
- socialLinks: [
748
- {
749
- id: "12345",
750
- url: "https://www.twitter.com/apideck",
751
- type: "twitter",
752
- },
753
- {
754
- id: "12345",
755
- url: "https://www.twitter.com/apideck",
756
- type: "twitter",
757
- },
758
- ],
759
- phoneNumbers: [
760
- {
761
- id: "12345",
762
- countryCode: "1",
763
- areaCode: "323",
764
- number: "111-111-1111",
765
- extension: "105",
766
- type: "primary",
767
- },
768
- ],
769
- emails: [
770
- {
771
- id: "123",
772
- email: "elon@musk.com",
773
- type: "primary",
774
- },
775
- ],
776
- customFields: [
777
- {
778
- id: "2389328923893298",
779
- name: "employee_level",
780
- description: "Employee Level",
781
- value: {},
782
- },
783
- {
784
- id: "2389328923893298",
785
- name: "employee_level",
786
- description: "Employee Level",
787
- value: 10,
788
- },
789
- {
790
- id: "2389328923893298",
791
- name: "employee_level",
792
- description: "Employee Level",
793
- value: "Uses Salesforce and Marketo",
794
- },
795
- ],
796
- tags: [
797
- "New",
798
- ],
799
- passThrough: [
800
- {
801
- serviceId: "<id>",
802
- extendPaths: [
803
- {
804
- path: "$.nested.property",
805
- value: {
806
- "TaxClassificationRef": {
807
- "value": "EUC-99990201-V1-00020000",
808
- },
809
- },
810
- },
811
- {
812
- path: "$.nested.property",
813
- value: {
814
- "TaxClassificationRef": {
815
- "value": "EUC-99990201-V1-00020000",
816
- },
817
- },
818
- },
819
- {
820
- path: "$.nested.property",
821
- value: {
822
- "TaxClassificationRef": {
823
- "value": "EUC-99990201-V1-00020000",
824
- },
825
- },
826
- },
827
- ],
828
- },
829
- {
830
- serviceId: "<id>",
831
- extendPaths: [
832
- {
833
- path: "$.nested.property",
834
- value: {
835
- "TaxClassificationRef": {
836
- "value": "EUC-99990201-V1-00020000",
837
- },
838
- },
839
- },
840
- {
841
- path: "$.nested.property",
842
- value: {
843
- "TaxClassificationRef": {
844
- "value": "EUC-99990201-V1-00020000",
845
- },
846
- },
847
- },
848
- ],
849
- },
850
- {
851
- serviceId: "<id>",
852
- extendPaths: [
853
- {
854
- path: "$.nested.property",
855
- value: {
856
- "TaxClassificationRef": {
857
- "value": "EUC-99990201-V1-00020000",
858
- },
859
- },
860
- },
861
- {
862
- path: "$.nested.property",
863
- value: {
864
- "TaxClassificationRef": {
865
- "value": "EUC-99990201-V1-00020000",
866
- },
867
- },
868
- },
869
- {
870
- path: "$.nested.property",
871
- value: {
872
- "TaxClassificationRef": {
873
- "value": "EUC-99990201-V1-00020000",
874
- },
875
- },
876
- },
877
- ],
878
- },
879
- ],
880
- },
881
- });
882
- expect(result.httpMeta.response.status).toBe(201);
883
- expect(result.createLeadResponse).toBeDefined();
884
- expect(result.createLeadResponse).toEqual({
885
- statusCode: 200,
886
- status: "OK",
887
- service: "zoho-crm",
888
- resource: "companies",
889
- operation: "add",
890
- data: {
891
- id: "12345",
892
- },
893
- });
894
- });
895
-
896
- test("Leads Crm Leads One", async () => {
897
- const testHttpClient = createTestHTTPClient("crm.leadsOne");
898
-
899
- const apideck = new Apideck({
900
- serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
901
- httpClient: testHttpClient,
902
- apiKey: process.env["APIDECK_API_KEY"] ?? "value",
903
- });
904
-
905
- const result = await apideck.crm.leads.get({
906
- id: "<id>",
907
- consumerId: "test-consumer",
908
- appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
909
- serviceId: "salesforce",
910
- fields: "id,updated_at",
911
- });
912
- expect(result.httpMeta.response.status).toBe(200);
913
- expect(result.getLeadResponse).toBeDefined();
914
- expect(result.getLeadResponse).toEqual({
915
- statusCode: 200,
916
- status: "OK",
917
- service: "zoho-crm",
918
- resource: "companies",
919
- operation: "one",
920
- data: {
921
- id: "12345",
922
- name: "Elon Musk",
923
- companyName: "Spacex",
924
- ownerId: "54321",
925
- ownerName: "John Doe",
926
- companyId: "2",
927
- leadId: "2",
928
- leadSource: "Cold Call",
929
- firstName: "Elon",
930
- lastName: "Musk",
931
- description: "A thinker",
932
- prefix: "Sir",
933
- title: "CEO",
934
- language: "EN",
935
- status: "New",
936
- monetaryAmount: 75000,
937
- currency: "USD",
938
- fax: "+12129876543",
939
- websites: [
940
- {
941
- id: "12345",
942
- url: "http://example.com",
943
- type: "primary",
944
- },
945
- {
946
- id: "12345",
947
- url: "http://example.com",
948
- type: "primary",
949
- },
950
- {
951
- id: "12345",
952
- url: "http://example.com",
953
- type: "primary",
954
- },
955
- ],
956
- addresses: [
957
- {
958
- id: "123",
959
- type: "primary",
960
- string: "25 Spring Street, Blackburn, VIC 3130",
961
- name: "HQ US",
962
- line1: "Main street",
963
- line2: "apt #",
964
- line3: "Suite #",
965
- line4: "delivery instructions",
966
- streetNumber: "25",
967
- city: "San Francisco",
968
- state: "CA",
969
- postalCode: "94104",
970
- country: "US",
971
- latitude: "40.759211",
972
- longitude: "-73.984638",
973
- county: "Santa Clara",
974
- contactName: "Elon Musk",
975
- salutation: "Mr",
976
- phoneNumber: "111-111-1111",
977
- fax: "122-111-1111",
978
- email: "elon@musk.com",
979
- website: "https://elonmusk.com",
980
- notes: "Address notes or delivery instructions.",
981
- rowVersion: "1-12345",
982
- },
983
- {
984
- id: "123",
985
- type: "primary",
986
- string: "25 Spring Street, Blackburn, VIC 3130",
987
- name: "HQ US",
988
- line1: "Main street",
989
- line2: "apt #",
990
- line3: "Suite #",
991
- line4: "delivery instructions",
992
- streetNumber: "25",
993
- city: "San Francisco",
994
- state: "CA",
995
- postalCode: "94104",
996
- country: "US",
997
- latitude: "40.759211",
998
- longitude: "-73.984638",
999
- county: "Santa Clara",
1000
- contactName: "Elon Musk",
1001
- salutation: "Mr",
1002
- phoneNumber: "111-111-1111",
1003
- fax: "122-111-1111",
1004
- email: "elon@musk.com",
1005
- website: "https://elonmusk.com",
1006
- notes: "Address notes or delivery instructions.",
1007
- rowVersion: "1-12345",
1008
- },
1009
- ],
1010
- socialLinks: [
1011
- {
1012
- id: "12345",
1013
- url: "https://www.twitter.com/apideck",
1014
- type: "twitter",
1015
- },
1016
- {
1017
- id: "12345",
1018
- url: "https://www.twitter.com/apideck",
1019
- type: "twitter",
1020
- },
1021
- ],
1022
- phoneNumbers: [
1023
- {
1024
- id: "12345",
1025
- countryCode: "1",
1026
- areaCode: "323",
1027
- number: "111-111-1111",
1028
- extension: "105",
1029
- type: "primary",
1030
- },
1031
- {
1032
- id: "12345",
1033
- countryCode: "1",
1034
- areaCode: "323",
1035
- number: "111-111-1111",
1036
- extension: "105",
1037
- type: "primary",
1038
- },
1039
- ],
1040
- emails: [
1041
- {
1042
- id: "123",
1043
- email: "elon@musk.com",
1044
- type: "primary",
1045
- },
1046
- {
1047
- id: "123",
1048
- email: "elon@musk.com",
1049
- type: "primary",
1050
- },
1051
- {
1052
- id: "123",
1053
- email: "elon@musk.com",
1054
- type: "primary",
1055
- },
1056
- ],
1057
- customFields: [
1058
- {
1059
- id: "2389328923893298",
1060
- name: "employee_level",
1061
- description: "Employee Level",
1062
- value: true,
1063
- },
1064
- {
1065
- id: "2389328923893298",
1066
- name: "employee_level",
1067
- description: "Employee Level",
1068
- value: 10,
1069
- },
1070
- ],
1071
- tags: [
1072
- "New",
1073
- ],
1074
- updatedAt: "2020-09-30T07:43:32.000Z",
1075
- createdAt: "2020-09-30T07:43:32.000Z",
1076
- passThrough: [
1077
- {
1078
- serviceId: "<id>",
1079
- extendPaths: [
1080
- {
1081
- path: "$.nested.property",
1082
- value: {
1083
- "TaxClassificationRef": {
1084
- "value": "EUC-99990201-V1-00020000",
1085
- },
1086
- },
1087
- },
1088
- {
1089
- path: "$.nested.property",
1090
- value: {
1091
- "TaxClassificationRef": {
1092
- "value": "EUC-99990201-V1-00020000",
1093
- },
1094
- },
1095
- },
1096
- {
1097
- path: "$.nested.property",
1098
- value: {
1099
- "TaxClassificationRef": {
1100
- "value": "EUC-99990201-V1-00020000",
1101
- },
1102
- },
1103
- },
1104
- ],
1105
- },
1106
- ],
1107
- },
1108
- });
1109
- });
1110
-
1111
- test("Leads Crm Leads Update", async () => {
1112
- const testHttpClient = createTestHTTPClient("crm.leadsUpdate");
1113
-
1114
- const apideck = new Apideck({
1115
- serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
1116
- httpClient: testHttpClient,
1117
- apiKey: process.env["APIDECK_API_KEY"] ?? "value",
1118
- });
1119
-
1120
- const result = await apideck.crm.leads.update({
1121
- id: "<id>",
1122
- consumerId: "test-consumer",
1123
- appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
1124
- serviceId: "salesforce",
1125
- lead: {
1126
- name: "Elon Musk",
1127
- companyName: "Spacex",
1128
- ownerId: "54321",
1129
- ownerName: "John Doe",
1130
- companyId: "2",
1131
- leadId: "2",
1132
- leadSource: "Cold Call",
1133
- firstName: "Elon",
1134
- lastName: "Musk",
1135
- description: "A thinker",
1136
- prefix: "Sir",
1137
- title: "CEO",
1138
- language: "EN",
1139
- status: "New",
1140
- monetaryAmount: 75000,
1141
- currency: "USD",
1142
- fax: "+12129876543",
1143
- websites: [
1144
- {
1145
- id: "12345",
1146
- url: "http://example.com",
1147
- type: "primary",
1148
- },
1149
- {
1150
- id: "12345",
1151
- url: "http://example.com",
1152
- type: "primary",
1153
- },
1154
- {
1155
- id: "12345",
1156
- url: "http://example.com",
1157
- type: "primary",
1158
- },
1159
- ],
1160
- addresses: [
1161
- {
1162
- id: "123",
1163
- type: "primary",
1164
- string: "25 Spring Street, Blackburn, VIC 3130",
1165
- name: "HQ US",
1166
- line1: "Main street",
1167
- line2: "apt #",
1168
- line3: "Suite #",
1169
- line4: "delivery instructions",
1170
- streetNumber: "25",
1171
- city: "San Francisco",
1172
- state: "CA",
1173
- postalCode: "94104",
1174
- country: "US",
1175
- latitude: "40.759211",
1176
- longitude: "-73.984638",
1177
- county: "Santa Clara",
1178
- contactName: "Elon Musk",
1179
- salutation: "Mr",
1180
- phoneNumber: "111-111-1111",
1181
- fax: "122-111-1111",
1182
- email: "elon@musk.com",
1183
- website: "https://elonmusk.com",
1184
- notes: "Address notes or delivery instructions.",
1185
- rowVersion: "1-12345",
1186
- },
1187
- {
1188
- id: "123",
1189
- type: "primary",
1190
- string: "25 Spring Street, Blackburn, VIC 3130",
1191
- name: "HQ US",
1192
- line1: "Main street",
1193
- line2: "apt #",
1194
- line3: "Suite #",
1195
- line4: "delivery instructions",
1196
- streetNumber: "25",
1197
- city: "San Francisco",
1198
- state: "CA",
1199
- postalCode: "94104",
1200
- country: "US",
1201
- latitude: "40.759211",
1202
- longitude: "-73.984638",
1203
- county: "Santa Clara",
1204
- contactName: "Elon Musk",
1205
- salutation: "Mr",
1206
- phoneNumber: "111-111-1111",
1207
- fax: "122-111-1111",
1208
- email: "elon@musk.com",
1209
- website: "https://elonmusk.com",
1210
- notes: "Address notes or delivery instructions.",
1211
- rowVersion: "1-12345",
1212
- },
1213
- ],
1214
- socialLinks: [
1215
- {
1216
- id: "12345",
1217
- url: "https://www.twitter.com/apideck",
1218
- type: "twitter",
1219
- },
1220
- {
1221
- id: "12345",
1222
- url: "https://www.twitter.com/apideck",
1223
- type: "twitter",
1224
- },
1225
- ],
1226
- phoneNumbers: [
1227
- {
1228
- id: "12345",
1229
- countryCode: "1",
1230
- areaCode: "323",
1231
- number: "111-111-1111",
1232
- extension: "105",
1233
- type: "primary",
1234
- },
1235
- {
1236
- id: "12345",
1237
- countryCode: "1",
1238
- areaCode: "323",
1239
- number: "111-111-1111",
1240
- extension: "105",
1241
- type: "primary",
1242
- },
1243
- {
1244
- id: "12345",
1245
- countryCode: "1",
1246
- areaCode: "323",
1247
- number: "111-111-1111",
1248
- extension: "105",
1249
- type: "primary",
1250
- },
1251
- ],
1252
- emails: [
1253
- {
1254
- id: "123",
1255
- email: "elon@musk.com",
1256
- type: "primary",
1257
- },
1258
- {
1259
- id: "123",
1260
- email: "elon@musk.com",
1261
- type: "primary",
1262
- },
1263
- ],
1264
- customFields: [
1265
- {
1266
- id: "2389328923893298",
1267
- name: "employee_level",
1268
- description: "Employee Level",
1269
- value: {},
1270
- },
1271
- {
1272
- id: "2389328923893298",
1273
- name: "employee_level",
1274
- description: "Employee Level",
1275
- value: {
1276
- "0": {},
1277
- },
1278
- },
1279
- ],
1280
- tags: [
1281
- "New",
1282
- ],
1283
- passThrough: [
1284
- {
1285
- serviceId: "<id>",
1286
- extendPaths: [
1287
- {
1288
- path: "$.nested.property",
1289
- value: {
1290
- "TaxClassificationRef": {
1291
- "value": "EUC-99990201-V1-00020000",
1292
- },
1293
- },
1294
- },
1295
- ],
1296
- },
1297
- ],
1298
- },
1299
- });
1300
- expect(result.httpMeta.response.status).toBe(200);
1301
- expect(result.updateLeadResponse).toBeDefined();
1302
- expect(result.updateLeadResponse).toEqual({
1303
- statusCode: 200,
1304
- status: "OK",
1305
- service: "zoho-crm",
1306
- resource: "companies",
1307
- operation: "update",
1308
- data: {
1309
- id: "12345",
1310
- },
1311
- });
1312
- });
1313
-
1314
- test("Leads Crm Leads Delete", async () => {
1315
- const testHttpClient = createTestHTTPClient("crm.leadsDelete");
1316
-
1317
- const apideck = new Apideck({
1318
- serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
1319
- httpClient: testHttpClient,
1320
- apiKey: process.env["APIDECK_API_KEY"] ?? "value",
1321
- });
1322
-
1323
- const result = await apideck.crm.leads.delete({
1324
- id: "<id>",
1325
- consumerId: "test-consumer",
1326
- appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
1327
- serviceId: "salesforce",
1328
- });
1329
- expect(result.httpMeta.response.status).toBe(200);
1330
- expect(result.deleteLeadResponse).toBeDefined();
1331
- expect(result.deleteLeadResponse).toEqual({
1332
- statusCode: 200,
1333
- status: "OK",
1334
- service: "zoho-crm",
1335
- resource: "companies",
1336
- operation: "delete",
1337
- data: {
1338
- id: "12345",
1339
- },
1340
- });
1341
- });