@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,2968 @@
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("Employees Hris Employees All", async () => {
10
+ const testHttpClient = createTestHTTPClient("hris.employeesAll");
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.hris.employees.list({
19
+ consumerId: "test-consumer",
20
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
21
+ serviceId: "salesforce",
22
+ filter: {
23
+ companyId: "1234",
24
+ email: "elon@tesla.com",
25
+ firstName: "Elon",
26
+ title: "Manager",
27
+ lastName: "Musk",
28
+ managerId: "1234",
29
+ employmentStatus: "active",
30
+ employeeNumber: "123456-AB",
31
+ departmentId: "1234",
32
+ city: "San Francisco",
33
+ country: "US",
34
+ },
35
+ sort: {
36
+ by: "created_at",
37
+ direction: "desc",
38
+ },
39
+ passThrough: {
40
+ "search": "San Francisco",
41
+ },
42
+ fields: "id,updated_at",
43
+ });
44
+ expect(result.httpMeta.response.status).toBe(200);
45
+ expect(result.getEmployeesResponse).toBeDefined();
46
+ expect(result.getEmployeesResponse).toEqual({
47
+ statusCode: 200,
48
+ status: "OK",
49
+ service: "sage-hr",
50
+ resource: "Employees",
51
+ operation: "all",
52
+ data: [
53
+ {
54
+ id: "12345",
55
+ downstreamId: "12345",
56
+ firstName: "Elon",
57
+ lastName: "Musk",
58
+ middleName: "D.",
59
+ displayName: "Technoking",
60
+ preferredName: "Elon Musk",
61
+ initials: "EM",
62
+ salutation: "Mr",
63
+ title: "CEO",
64
+ maritalStatus: "married",
65
+ partner: {
66
+ id: "12345",
67
+ firstName: "Elon",
68
+ lastName: "Musk",
69
+ middleName: "D.",
70
+ gender: "male",
71
+ initials: "EM",
72
+ birthday: new Date("2000-08-12"),
73
+ deceasedOn: new Date("2000-08-12"),
74
+ },
75
+ division: "Europe",
76
+ divisionId: "12345",
77
+ departmentId: "12345",
78
+ departmentName: "12345",
79
+ team: {
80
+ id: "1234",
81
+ name: "Full Stack Engineers",
82
+ },
83
+ companyId: "23456",
84
+ companyName: "SpaceX",
85
+ employmentStartDate: "2021-10-26",
86
+ employmentEndDate: "2028-10-26",
87
+ leavingReason: "resigned",
88
+ employeeNumber: "123456-AB",
89
+ employmentStatus: "active",
90
+ ethnicity: "African American",
91
+ manager: {
92
+ id: "12345",
93
+ name: "Elon Musk",
94
+ firstName: "Elon",
95
+ lastName: "Musk",
96
+ email: "elon@musk.com",
97
+ employmentStatus: "active",
98
+ },
99
+ directReports: [
100
+ "a0d636c6-43b3-4bde-8c70-85b707d992f4",
101
+ "a98lfd96-43b3-4bde-8c70-85b707d992e6",
102
+ ],
103
+ socialSecurityNumber: "123456789",
104
+ birthday: new Date("2000-08-12"),
105
+ deceasedOn: new Date("2000-08-12"),
106
+ countryOfBirth: "US",
107
+ description: "A description",
108
+ gender: "male",
109
+ pronouns: "she,her",
110
+ preferredLanguage: "EN",
111
+ languages: [
112
+ "EN",
113
+ ],
114
+ nationalities: [
115
+ "US",
116
+ ],
117
+ photoUrl: "https://unavatar.io/elon-musk",
118
+ timezone: "Europe/London",
119
+ source: "lever",
120
+ sourceId: "12345",
121
+ recordUrl: "https://app.intercom.io/contacts/12345",
122
+ jobs: [
123
+ {
124
+ id: "12345",
125
+ employeeId: "12345",
126
+ title: "CEO",
127
+ role: "Sales",
128
+ startDate: new Date("2020-08-12"),
129
+ endDate: new Date("2020-08-12"),
130
+ compensationRate: 72000,
131
+ currency: "USD",
132
+ paymentUnit: "year",
133
+ hiredAt: new Date("2020-08-12"),
134
+ isPrimary: true,
135
+ isManager: true,
136
+ status: "active",
137
+ location: {
138
+ id: "123",
139
+ type: "primary",
140
+ string: "25 Spring Street, Blackburn, VIC 3130",
141
+ name: "HQ US",
142
+ line1: "Main street",
143
+ line2: "apt #",
144
+ line3: "Suite #",
145
+ line4: "delivery instructions",
146
+ streetNumber: "25",
147
+ city: "San Francisco",
148
+ state: "CA",
149
+ postalCode: "94104",
150
+ country: "US",
151
+ latitude: "40.759211",
152
+ longitude: "-73.984638",
153
+ county: "Santa Clara",
154
+ contactName: "Elon Musk",
155
+ salutation: "Mr",
156
+ phoneNumber: "111-111-1111",
157
+ fax: "122-111-1111",
158
+ email: "elon@musk.com",
159
+ website: "https://elonmusk.com",
160
+ notes: "Address notes or delivery instructions.",
161
+ rowVersion: "1-12345",
162
+ },
163
+ },
164
+ {
165
+ id: "12345",
166
+ employeeId: "12345",
167
+ title: "CEO",
168
+ role: "Sales",
169
+ startDate: new Date("2020-08-12"),
170
+ endDate: new Date("2020-08-12"),
171
+ compensationRate: 72000,
172
+ currency: "USD",
173
+ paymentUnit: "year",
174
+ hiredAt: new Date("2020-08-12"),
175
+ isPrimary: true,
176
+ isManager: true,
177
+ status: "active",
178
+ location: {
179
+ id: "123",
180
+ type: "primary",
181
+ string: "25 Spring Street, Blackburn, VIC 3130",
182
+ name: "HQ US",
183
+ line1: "Main street",
184
+ line2: "apt #",
185
+ line3: "Suite #",
186
+ line4: "delivery instructions",
187
+ streetNumber: "25",
188
+ city: "San Francisco",
189
+ state: "CA",
190
+ postalCode: "94104",
191
+ country: "US",
192
+ latitude: "40.759211",
193
+ longitude: "-73.984638",
194
+ county: "Santa Clara",
195
+ contactName: "Elon Musk",
196
+ salutation: "Mr",
197
+ phoneNumber: "111-111-1111",
198
+ fax: "122-111-1111",
199
+ email: "elon@musk.com",
200
+ website: "https://elonmusk.com",
201
+ notes: "Address notes or delivery instructions.",
202
+ rowVersion: "1-12345",
203
+ },
204
+ },
205
+ ],
206
+ compensations: [
207
+ {
208
+ id: "3404301363494309004",
209
+ jobId: "3490439050957906679",
210
+ rate: 50,
211
+ paymentUnit: "hour",
212
+ flsaStatus: "nonexempt",
213
+ effectiveDate: "2021-06-11",
214
+ },
215
+ ],
216
+ worksRemote: true,
217
+ addresses: [
218
+ {
219
+ id: "123",
220
+ type: "primary",
221
+ string: "25 Spring Street, Blackburn, VIC 3130",
222
+ name: "HQ US",
223
+ line1: "Main street",
224
+ line2: "apt #",
225
+ line3: "Suite #",
226
+ line4: "delivery instructions",
227
+ streetNumber: "25",
228
+ city: "San Francisco",
229
+ state: "CA",
230
+ postalCode: "94104",
231
+ country: "US",
232
+ latitude: "40.759211",
233
+ longitude: "-73.984638",
234
+ county: "Santa Clara",
235
+ contactName: "Elon Musk",
236
+ salutation: "Mr",
237
+ phoneNumber: "111-111-1111",
238
+ fax: "122-111-1111",
239
+ email: "elon@musk.com",
240
+ website: "https://elonmusk.com",
241
+ notes: "Address notes or delivery instructions.",
242
+ rowVersion: "1-12345",
243
+ },
244
+ {
245
+ id: "123",
246
+ type: "primary",
247
+ string: "25 Spring Street, Blackburn, VIC 3130",
248
+ name: "HQ US",
249
+ line1: "Main street",
250
+ line2: "apt #",
251
+ line3: "Suite #",
252
+ line4: "delivery instructions",
253
+ streetNumber: "25",
254
+ city: "San Francisco",
255
+ state: "CA",
256
+ postalCode: "94104",
257
+ country: "US",
258
+ latitude: "40.759211",
259
+ longitude: "-73.984638",
260
+ county: "Santa Clara",
261
+ contactName: "Elon Musk",
262
+ salutation: "Mr",
263
+ phoneNumber: "111-111-1111",
264
+ fax: "122-111-1111",
265
+ email: "elon@musk.com",
266
+ website: "https://elonmusk.com",
267
+ notes: "Address notes or delivery instructions.",
268
+ rowVersion: "1-12345",
269
+ },
270
+ {
271
+ id: "123",
272
+ type: "primary",
273
+ string: "25 Spring Street, Blackburn, VIC 3130",
274
+ name: "HQ US",
275
+ line1: "Main street",
276
+ line2: "apt #",
277
+ line3: "Suite #",
278
+ line4: "delivery instructions",
279
+ streetNumber: "25",
280
+ city: "San Francisco",
281
+ state: "CA",
282
+ postalCode: "94104",
283
+ country: "US",
284
+ latitude: "40.759211",
285
+ longitude: "-73.984638",
286
+ county: "Santa Clara",
287
+ contactName: "Elon Musk",
288
+ salutation: "Mr",
289
+ phoneNumber: "111-111-1111",
290
+ fax: "122-111-1111",
291
+ email: "elon@musk.com",
292
+ website: "https://elonmusk.com",
293
+ notes: "Address notes or delivery instructions.",
294
+ rowVersion: "1-12345",
295
+ },
296
+ ],
297
+ phoneNumbers: [
298
+ {
299
+ id: "12345",
300
+ countryCode: "1",
301
+ areaCode: "323",
302
+ number: "111-111-1111",
303
+ extension: "105",
304
+ type: "primary",
305
+ },
306
+ ],
307
+ emails: [
308
+ {
309
+ id: "123",
310
+ email: "elon@musk.com",
311
+ type: "primary",
312
+ },
313
+ ],
314
+ customFields: [
315
+ {
316
+ id: "2389328923893298",
317
+ name: "employee_level",
318
+ description: "Employee Level",
319
+ value: {},
320
+ },
321
+ ],
322
+ socialLinks: [
323
+ {
324
+ id: "12345",
325
+ url: "https://www.twitter.com/apideck",
326
+ type: "twitter",
327
+ },
328
+ {
329
+ id: "12345",
330
+ url: "https://www.twitter.com/apideck",
331
+ type: "twitter",
332
+ },
333
+ ],
334
+ bankAccounts: [
335
+ {
336
+ bankName: "Monzo",
337
+ accountNumber: "123465",
338
+ accountName: "SPACEX LLC",
339
+ accountType: "credit_card",
340
+ iban: "CH2989144532982975332",
341
+ bic: "AUDSCHGGXXX",
342
+ routingNumber: "012345678",
343
+ bsbNumber: "062-001",
344
+ branchIdentifier: "001",
345
+ bankCode: "BNH",
346
+ currency: "USD",
347
+ },
348
+ ],
349
+ taxCode: "1111",
350
+ taxId: "234-32-0000",
351
+ dietaryPreference: "Veggie",
352
+ foodAllergies: [
353
+ "No allergies",
354
+ ],
355
+ probationPeriod: {
356
+ startDate: new Date("2021-10-01"),
357
+ endDate: new Date("2021-11-28"),
358
+ },
359
+ tags: [
360
+ "New",
361
+ ],
362
+ rowVersion: "1-12345",
363
+ deleted: true,
364
+ updatedBy: "12345",
365
+ createdBy: "12345",
366
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
367
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
368
+ passThrough: [
369
+ {
370
+ serviceId: "<id>",
371
+ extendPaths: [
372
+ {
373
+ path: "$.nested.property",
374
+ value: {
375
+ "TaxClassificationRef": {
376
+ "value": "EUC-99990201-V1-00020000",
377
+ },
378
+ },
379
+ },
380
+ ],
381
+ },
382
+ {
383
+ serviceId: "<id>",
384
+ extendPaths: [
385
+ {
386
+ path: "$.nested.property",
387
+ value: {
388
+ "TaxClassificationRef": {
389
+ "value": "EUC-99990201-V1-00020000",
390
+ },
391
+ },
392
+ },
393
+ ],
394
+ },
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
+ path: "$.nested.property",
416
+ value: {
417
+ "TaxClassificationRef": {
418
+ "value": "EUC-99990201-V1-00020000",
419
+ },
420
+ },
421
+ },
422
+ ],
423
+ },
424
+ ],
425
+ },
426
+ {
427
+ id: "12345",
428
+ downstreamId: "12345",
429
+ firstName: "Elon",
430
+ lastName: "Musk",
431
+ middleName: "D.",
432
+ displayName: "Technoking",
433
+ preferredName: "Elon Musk",
434
+ initials: "EM",
435
+ salutation: "Mr",
436
+ title: "CEO",
437
+ maritalStatus: "married",
438
+ partner: {
439
+ id: "12345",
440
+ firstName: "Elon",
441
+ lastName: "Musk",
442
+ middleName: "D.",
443
+ gender: "male",
444
+ initials: "EM",
445
+ birthday: new Date("2000-08-12"),
446
+ deceasedOn: new Date("2000-08-12"),
447
+ },
448
+ division: "Europe",
449
+ divisionId: "12345",
450
+ departmentId: "12345",
451
+ departmentName: "12345",
452
+ team: {
453
+ id: "1234",
454
+ name: "Full Stack Engineers",
455
+ },
456
+ companyId: "23456",
457
+ companyName: "SpaceX",
458
+ employmentStartDate: "2021-10-26",
459
+ employmentEndDate: "2028-10-26",
460
+ leavingReason: "resigned",
461
+ employeeNumber: "123456-AB",
462
+ employmentStatus: "active",
463
+ ethnicity: "African American",
464
+ manager: {
465
+ id: "12345",
466
+ name: "Elon Musk",
467
+ firstName: "Elon",
468
+ lastName: "Musk",
469
+ email: "elon@musk.com",
470
+ employmentStatus: "active",
471
+ },
472
+ directReports: [
473
+ "a0d636c6-43b3-4bde-8c70-85b707d992f4",
474
+ "a98lfd96-43b3-4bde-8c70-85b707d992e6",
475
+ ],
476
+ socialSecurityNumber: "123456789",
477
+ birthday: new Date("2000-08-12"),
478
+ deceasedOn: new Date("2000-08-12"),
479
+ countryOfBirth: "US",
480
+ description: "A description",
481
+ gender: "male",
482
+ pronouns: "she,her",
483
+ preferredLanguage: "EN",
484
+ languages: [
485
+ "EN",
486
+ ],
487
+ nationalities: [
488
+ "US",
489
+ ],
490
+ photoUrl: "https://unavatar.io/elon-musk",
491
+ timezone: "Europe/London",
492
+ source: "lever",
493
+ sourceId: "12345",
494
+ recordUrl: "https://app.intercom.io/contacts/12345",
495
+ jobs: [
496
+ {
497
+ id: "12345",
498
+ employeeId: "12345",
499
+ title: "CEO",
500
+ role: "Sales",
501
+ startDate: new Date("2020-08-12"),
502
+ endDate: new Date("2020-08-12"),
503
+ compensationRate: 72000,
504
+ currency: "USD",
505
+ paymentUnit: "year",
506
+ hiredAt: new Date("2020-08-12"),
507
+ isPrimary: true,
508
+ isManager: true,
509
+ status: "active",
510
+ location: {
511
+ id: "123",
512
+ type: "primary",
513
+ string: "25 Spring Street, Blackburn, VIC 3130",
514
+ name: "HQ US",
515
+ line1: "Main street",
516
+ line2: "apt #",
517
+ line3: "Suite #",
518
+ line4: "delivery instructions",
519
+ streetNumber: "25",
520
+ city: "San Francisco",
521
+ state: "CA",
522
+ postalCode: "94104",
523
+ country: "US",
524
+ latitude: "40.759211",
525
+ longitude: "-73.984638",
526
+ county: "Santa Clara",
527
+ contactName: "Elon Musk",
528
+ salutation: "Mr",
529
+ phoneNumber: "111-111-1111",
530
+ fax: "122-111-1111",
531
+ email: "elon@musk.com",
532
+ website: "https://elonmusk.com",
533
+ notes: "Address notes or delivery instructions.",
534
+ rowVersion: "1-12345",
535
+ },
536
+ },
537
+ {
538
+ id: "12345",
539
+ employeeId: "12345",
540
+ title: "CEO",
541
+ role: "Sales",
542
+ startDate: new Date("2020-08-12"),
543
+ endDate: new Date("2020-08-12"),
544
+ compensationRate: 72000,
545
+ currency: "USD",
546
+ paymentUnit: "year",
547
+ hiredAt: new Date("2020-08-12"),
548
+ isPrimary: true,
549
+ isManager: true,
550
+ status: "active",
551
+ location: {
552
+ id: "123",
553
+ type: "primary",
554
+ string: "25 Spring Street, Blackburn, VIC 3130",
555
+ name: "HQ US",
556
+ line1: "Main street",
557
+ line2: "apt #",
558
+ line3: "Suite #",
559
+ line4: "delivery instructions",
560
+ streetNumber: "25",
561
+ city: "San Francisco",
562
+ state: "CA",
563
+ postalCode: "94104",
564
+ country: "US",
565
+ latitude: "40.759211",
566
+ longitude: "-73.984638",
567
+ county: "Santa Clara",
568
+ contactName: "Elon Musk",
569
+ salutation: "Mr",
570
+ phoneNumber: "111-111-1111",
571
+ fax: "122-111-1111",
572
+ email: "elon@musk.com",
573
+ website: "https://elonmusk.com",
574
+ notes: "Address notes or delivery instructions.",
575
+ rowVersion: "1-12345",
576
+ },
577
+ },
578
+ ],
579
+ compensations: [
580
+ {
581
+ id: "3404301363494309004",
582
+ jobId: "3490439050957906679",
583
+ rate: 50,
584
+ paymentUnit: "hour",
585
+ flsaStatus: "nonexempt",
586
+ effectiveDate: "2021-06-11",
587
+ },
588
+ ],
589
+ worksRemote: true,
590
+ addresses: [
591
+ {
592
+ id: "123",
593
+ type: "primary",
594
+ string: "25 Spring Street, Blackburn, VIC 3130",
595
+ name: "HQ US",
596
+ line1: "Main street",
597
+ line2: "apt #",
598
+ line3: "Suite #",
599
+ line4: "delivery instructions",
600
+ streetNumber: "25",
601
+ city: "San Francisco",
602
+ state: "CA",
603
+ postalCode: "94104",
604
+ country: "US",
605
+ latitude: "40.759211",
606
+ longitude: "-73.984638",
607
+ county: "Santa Clara",
608
+ contactName: "Elon Musk",
609
+ salutation: "Mr",
610
+ phoneNumber: "111-111-1111",
611
+ fax: "122-111-1111",
612
+ email: "elon@musk.com",
613
+ website: "https://elonmusk.com",
614
+ notes: "Address notes or delivery instructions.",
615
+ rowVersion: "1-12345",
616
+ },
617
+ {
618
+ id: "123",
619
+ type: "primary",
620
+ string: "25 Spring Street, Blackburn, VIC 3130",
621
+ name: "HQ US",
622
+ line1: "Main street",
623
+ line2: "apt #",
624
+ line3: "Suite #",
625
+ line4: "delivery instructions",
626
+ streetNumber: "25",
627
+ city: "San Francisco",
628
+ state: "CA",
629
+ postalCode: "94104",
630
+ country: "US",
631
+ latitude: "40.759211",
632
+ longitude: "-73.984638",
633
+ county: "Santa Clara",
634
+ contactName: "Elon Musk",
635
+ salutation: "Mr",
636
+ phoneNumber: "111-111-1111",
637
+ fax: "122-111-1111",
638
+ email: "elon@musk.com",
639
+ website: "https://elonmusk.com",
640
+ notes: "Address notes or delivery instructions.",
641
+ rowVersion: "1-12345",
642
+ },
643
+ ],
644
+ phoneNumbers: [
645
+ {
646
+ id: "12345",
647
+ countryCode: "1",
648
+ areaCode: "323",
649
+ number: "111-111-1111",
650
+ extension: "105",
651
+ type: "primary",
652
+ },
653
+ ],
654
+ emails: [
655
+ {
656
+ id: "123",
657
+ email: "elon@musk.com",
658
+ type: "primary",
659
+ },
660
+ ],
661
+ customFields: [
662
+ {
663
+ id: "2389328923893298",
664
+ name: "employee_level",
665
+ description: "Employee Level",
666
+ value: true,
667
+ },
668
+ {
669
+ id: "2389328923893298",
670
+ name: "employee_level",
671
+ description: "Employee Level",
672
+ value: "Uses Salesforce and Marketo",
673
+ },
674
+ ],
675
+ socialLinks: [
676
+ {
677
+ id: "12345",
678
+ url: "https://www.twitter.com/apideck",
679
+ type: "twitter",
680
+ },
681
+ {
682
+ id: "12345",
683
+ url: "https://www.twitter.com/apideck",
684
+ type: "twitter",
685
+ },
686
+ {
687
+ id: "12345",
688
+ url: "https://www.twitter.com/apideck",
689
+ type: "twitter",
690
+ },
691
+ ],
692
+ bankAccounts: [
693
+ {
694
+ bankName: "Monzo",
695
+ accountNumber: "123465",
696
+ accountName: "SPACEX LLC",
697
+ accountType: "credit_card",
698
+ iban: "CH2989144532982975332",
699
+ bic: "AUDSCHGGXXX",
700
+ routingNumber: "012345678",
701
+ bsbNumber: "062-001",
702
+ branchIdentifier: "001",
703
+ bankCode: "BNH",
704
+ currency: "USD",
705
+ },
706
+ {
707
+ bankName: "Monzo",
708
+ accountNumber: "123465",
709
+ accountName: "SPACEX LLC",
710
+ accountType: "credit_card",
711
+ iban: "CH2989144532982975332",
712
+ bic: "AUDSCHGGXXX",
713
+ routingNumber: "012345678",
714
+ bsbNumber: "062-001",
715
+ branchIdentifier: "001",
716
+ bankCode: "BNH",
717
+ currency: "USD",
718
+ },
719
+ ],
720
+ taxCode: "1111",
721
+ taxId: "234-32-0000",
722
+ dietaryPreference: "Veggie",
723
+ foodAllergies: [
724
+ "No allergies",
725
+ ],
726
+ probationPeriod: {
727
+ startDate: new Date("2021-10-01"),
728
+ endDate: new Date("2021-11-28"),
729
+ },
730
+ tags: [
731
+ "New",
732
+ ],
733
+ rowVersion: "1-12345",
734
+ deleted: true,
735
+ updatedBy: "12345",
736
+ createdBy: "12345",
737
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
738
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
739
+ passThrough: [
740
+ {
741
+ serviceId: "<id>",
742
+ extendPaths: [
743
+ {
744
+ path: "$.nested.property",
745
+ value: {
746
+ "TaxClassificationRef": {
747
+ "value": "EUC-99990201-V1-00020000",
748
+ },
749
+ },
750
+ },
751
+ {
752
+ path: "$.nested.property",
753
+ value: {
754
+ "TaxClassificationRef": {
755
+ "value": "EUC-99990201-V1-00020000",
756
+ },
757
+ },
758
+ },
759
+ ],
760
+ },
761
+ {
762
+ serviceId: "<id>",
763
+ extendPaths: [
764
+ {
765
+ path: "$.nested.property",
766
+ value: {
767
+ "TaxClassificationRef": {
768
+ "value": "EUC-99990201-V1-00020000",
769
+ },
770
+ },
771
+ },
772
+ ],
773
+ },
774
+ {
775
+ serviceId: "<id>",
776
+ extendPaths: [
777
+ {
778
+ path: "$.nested.property",
779
+ value: {
780
+ "TaxClassificationRef": {
781
+ "value": "EUC-99990201-V1-00020000",
782
+ },
783
+ },
784
+ },
785
+ ],
786
+ },
787
+ ],
788
+ },
789
+ {
790
+ id: "12345",
791
+ downstreamId: "12345",
792
+ firstName: "Elon",
793
+ lastName: "Musk",
794
+ middleName: "D.",
795
+ displayName: "Technoking",
796
+ preferredName: "Elon Musk",
797
+ initials: "EM",
798
+ salutation: "Mr",
799
+ title: "CEO",
800
+ maritalStatus: "married",
801
+ partner: {
802
+ id: "12345",
803
+ firstName: "Elon",
804
+ lastName: "Musk",
805
+ middleName: "D.",
806
+ gender: "male",
807
+ initials: "EM",
808
+ birthday: new Date("2000-08-12"),
809
+ deceasedOn: new Date("2000-08-12"),
810
+ },
811
+ division: "Europe",
812
+ divisionId: "12345",
813
+ departmentId: "12345",
814
+ departmentName: "12345",
815
+ team: {
816
+ id: "1234",
817
+ name: "Full Stack Engineers",
818
+ },
819
+ companyId: "23456",
820
+ companyName: "SpaceX",
821
+ employmentStartDate: "2021-10-26",
822
+ employmentEndDate: "2028-10-26",
823
+ leavingReason: "resigned",
824
+ employeeNumber: "123456-AB",
825
+ employmentStatus: "active",
826
+ ethnicity: "African American",
827
+ manager: {
828
+ id: "12345",
829
+ name: "Elon Musk",
830
+ firstName: "Elon",
831
+ lastName: "Musk",
832
+ email: "elon@musk.com",
833
+ employmentStatus: "active",
834
+ },
835
+ directReports: [
836
+ "a0d636c6-43b3-4bde-8c70-85b707d992f4",
837
+ "a98lfd96-43b3-4bde-8c70-85b707d992e6",
838
+ ],
839
+ socialSecurityNumber: "123456789",
840
+ birthday: new Date("2000-08-12"),
841
+ deceasedOn: new Date("2000-08-12"),
842
+ countryOfBirth: "US",
843
+ description: "A description",
844
+ gender: "male",
845
+ pronouns: "she,her",
846
+ preferredLanguage: "EN",
847
+ languages: [
848
+ "EN",
849
+ ],
850
+ nationalities: [
851
+ "US",
852
+ ],
853
+ photoUrl: "https://unavatar.io/elon-musk",
854
+ timezone: "Europe/London",
855
+ source: "lever",
856
+ sourceId: "12345",
857
+ recordUrl: "https://app.intercom.io/contacts/12345",
858
+ jobs: [
859
+ {
860
+ id: "12345",
861
+ employeeId: "12345",
862
+ title: "CEO",
863
+ role: "Sales",
864
+ startDate: new Date("2020-08-12"),
865
+ endDate: new Date("2020-08-12"),
866
+ compensationRate: 72000,
867
+ currency: "USD",
868
+ paymentUnit: "year",
869
+ hiredAt: new Date("2020-08-12"),
870
+ isPrimary: true,
871
+ isManager: true,
872
+ status: "active",
873
+ location: {
874
+ id: "123",
875
+ type: "primary",
876
+ string: "25 Spring Street, Blackburn, VIC 3130",
877
+ name: "HQ US",
878
+ line1: "Main street",
879
+ line2: "apt #",
880
+ line3: "Suite #",
881
+ line4: "delivery instructions",
882
+ streetNumber: "25",
883
+ city: "San Francisco",
884
+ state: "CA",
885
+ postalCode: "94104",
886
+ country: "US",
887
+ latitude: "40.759211",
888
+ longitude: "-73.984638",
889
+ county: "Santa Clara",
890
+ contactName: "Elon Musk",
891
+ salutation: "Mr",
892
+ phoneNumber: "111-111-1111",
893
+ fax: "122-111-1111",
894
+ email: "elon@musk.com",
895
+ website: "https://elonmusk.com",
896
+ notes: "Address notes or delivery instructions.",
897
+ rowVersion: "1-12345",
898
+ },
899
+ },
900
+ {
901
+ id: "12345",
902
+ employeeId: "12345",
903
+ title: "CEO",
904
+ role: "Sales",
905
+ startDate: new Date("2020-08-12"),
906
+ endDate: new Date("2020-08-12"),
907
+ compensationRate: 72000,
908
+ currency: "USD",
909
+ paymentUnit: "year",
910
+ hiredAt: new Date("2020-08-12"),
911
+ isPrimary: true,
912
+ isManager: true,
913
+ status: "active",
914
+ location: {
915
+ id: "123",
916
+ type: "primary",
917
+ string: "25 Spring Street, Blackburn, VIC 3130",
918
+ name: "HQ US",
919
+ line1: "Main street",
920
+ line2: "apt #",
921
+ line3: "Suite #",
922
+ line4: "delivery instructions",
923
+ streetNumber: "25",
924
+ city: "San Francisco",
925
+ state: "CA",
926
+ postalCode: "94104",
927
+ country: "US",
928
+ latitude: "40.759211",
929
+ longitude: "-73.984638",
930
+ county: "Santa Clara",
931
+ contactName: "Elon Musk",
932
+ salutation: "Mr",
933
+ phoneNumber: "111-111-1111",
934
+ fax: "122-111-1111",
935
+ email: "elon@musk.com",
936
+ website: "https://elonmusk.com",
937
+ notes: "Address notes or delivery instructions.",
938
+ rowVersion: "1-12345",
939
+ },
940
+ },
941
+ {
942
+ id: "12345",
943
+ employeeId: "12345",
944
+ title: "CEO",
945
+ role: "Sales",
946
+ startDate: new Date("2020-08-12"),
947
+ endDate: new Date("2020-08-12"),
948
+ compensationRate: 72000,
949
+ currency: "USD",
950
+ paymentUnit: "year",
951
+ hiredAt: new Date("2020-08-12"),
952
+ isPrimary: true,
953
+ isManager: true,
954
+ status: "active",
955
+ location: {
956
+ id: "123",
957
+ type: "primary",
958
+ string: "25 Spring Street, Blackburn, VIC 3130",
959
+ name: "HQ US",
960
+ line1: "Main street",
961
+ line2: "apt #",
962
+ line3: "Suite #",
963
+ line4: "delivery instructions",
964
+ streetNumber: "25",
965
+ city: "San Francisco",
966
+ state: "CA",
967
+ postalCode: "94104",
968
+ country: "US",
969
+ latitude: "40.759211",
970
+ longitude: "-73.984638",
971
+ county: "Santa Clara",
972
+ contactName: "Elon Musk",
973
+ salutation: "Mr",
974
+ phoneNumber: "111-111-1111",
975
+ fax: "122-111-1111",
976
+ email: "elon@musk.com",
977
+ website: "https://elonmusk.com",
978
+ notes: "Address notes or delivery instructions.",
979
+ rowVersion: "1-12345",
980
+ },
981
+ },
982
+ ],
983
+ compensations: [
984
+ {
985
+ id: "3404301363494309004",
986
+ jobId: "3490439050957906679",
987
+ rate: 50,
988
+ paymentUnit: "hour",
989
+ flsaStatus: "nonexempt",
990
+ effectiveDate: "2021-06-11",
991
+ },
992
+ ],
993
+ worksRemote: true,
994
+ addresses: [
995
+ {
996
+ id: "123",
997
+ type: "primary",
998
+ string: "25 Spring Street, Blackburn, VIC 3130",
999
+ name: "HQ US",
1000
+ line1: "Main street",
1001
+ line2: "apt #",
1002
+ line3: "Suite #",
1003
+ line4: "delivery instructions",
1004
+ streetNumber: "25",
1005
+ city: "San Francisco",
1006
+ state: "CA",
1007
+ postalCode: "94104",
1008
+ country: "US",
1009
+ latitude: "40.759211",
1010
+ longitude: "-73.984638",
1011
+ county: "Santa Clara",
1012
+ contactName: "Elon Musk",
1013
+ salutation: "Mr",
1014
+ phoneNumber: "111-111-1111",
1015
+ fax: "122-111-1111",
1016
+ email: "elon@musk.com",
1017
+ website: "https://elonmusk.com",
1018
+ notes: "Address notes or delivery instructions.",
1019
+ rowVersion: "1-12345",
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
+ id: "12345",
1041
+ countryCode: "1",
1042
+ areaCode: "323",
1043
+ number: "111-111-1111",
1044
+ extension: "105",
1045
+ type: "primary",
1046
+ },
1047
+ ],
1048
+ emails: [
1049
+ {
1050
+ id: "123",
1051
+ email: "elon@musk.com",
1052
+ type: "primary",
1053
+ },
1054
+ {
1055
+ id: "123",
1056
+ email: "elon@musk.com",
1057
+ type: "primary",
1058
+ },
1059
+ ],
1060
+ customFields: [
1061
+ {
1062
+ id: "2389328923893298",
1063
+ name: "employee_level",
1064
+ description: "Employee Level",
1065
+ value: 10,
1066
+ },
1067
+ {
1068
+ id: "2389328923893298",
1069
+ name: "employee_level",
1070
+ description: "Employee Level",
1071
+ value: "Uses Salesforce and Marketo",
1072
+ },
1073
+ {
1074
+ id: "2389328923893298",
1075
+ name: "employee_level",
1076
+ description: "Employee Level",
1077
+ value: {},
1078
+ },
1079
+ ],
1080
+ socialLinks: [
1081
+ {
1082
+ id: "12345",
1083
+ url: "https://www.twitter.com/apideck",
1084
+ type: "twitter",
1085
+ },
1086
+ {
1087
+ id: "12345",
1088
+ url: "https://www.twitter.com/apideck",
1089
+ type: "twitter",
1090
+ },
1091
+ ],
1092
+ bankAccounts: [
1093
+ {
1094
+ bankName: "Monzo",
1095
+ accountNumber: "123465",
1096
+ accountName: "SPACEX LLC",
1097
+ accountType: "credit_card",
1098
+ iban: "CH2989144532982975332",
1099
+ bic: "AUDSCHGGXXX",
1100
+ routingNumber: "012345678",
1101
+ bsbNumber: "062-001",
1102
+ branchIdentifier: "001",
1103
+ bankCode: "BNH",
1104
+ currency: "USD",
1105
+ },
1106
+ {
1107
+ bankName: "Monzo",
1108
+ accountNumber: "123465",
1109
+ accountName: "SPACEX LLC",
1110
+ accountType: "credit_card",
1111
+ iban: "CH2989144532982975332",
1112
+ bic: "AUDSCHGGXXX",
1113
+ routingNumber: "012345678",
1114
+ bsbNumber: "062-001",
1115
+ branchIdentifier: "001",
1116
+ bankCode: "BNH",
1117
+ currency: "USD",
1118
+ },
1119
+ ],
1120
+ taxCode: "1111",
1121
+ taxId: "234-32-0000",
1122
+ dietaryPreference: "Veggie",
1123
+ foodAllergies: [
1124
+ "No allergies",
1125
+ ],
1126
+ probationPeriod: {
1127
+ startDate: new Date("2021-10-01"),
1128
+ endDate: new Date("2021-11-28"),
1129
+ },
1130
+ tags: [
1131
+ "New",
1132
+ ],
1133
+ rowVersion: "1-12345",
1134
+ deleted: true,
1135
+ updatedBy: "12345",
1136
+ createdBy: "12345",
1137
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
1138
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
1139
+ passThrough: [
1140
+ {
1141
+ serviceId: "<id>",
1142
+ extendPaths: [
1143
+ {
1144
+ path: "$.nested.property",
1145
+ value: {
1146
+ "TaxClassificationRef": {
1147
+ "value": "EUC-99990201-V1-00020000",
1148
+ },
1149
+ },
1150
+ },
1151
+ {
1152
+ path: "$.nested.property",
1153
+ value: {
1154
+ "TaxClassificationRef": {
1155
+ "value": "EUC-99990201-V1-00020000",
1156
+ },
1157
+ },
1158
+ },
1159
+ ],
1160
+ },
1161
+ {
1162
+ serviceId: "<id>",
1163
+ extendPaths: [
1164
+ {
1165
+ path: "$.nested.property",
1166
+ value: {
1167
+ "TaxClassificationRef": {
1168
+ "value": "EUC-99990201-V1-00020000",
1169
+ },
1170
+ },
1171
+ },
1172
+ ],
1173
+ },
1174
+ ],
1175
+ },
1176
+ ],
1177
+ meta: {
1178
+ itemsOnPage: 50,
1179
+ cursors: {
1180
+ previous: "em9oby1jcm06OnBhZ2U6OjE=",
1181
+ current: "em9oby1jcm06OnBhZ2U6OjI=",
1182
+ next: "em9oby1jcm06OnBhZ2U6OjM=",
1183
+ },
1184
+ },
1185
+ links: {
1186
+ previous:
1187
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjE%3D",
1188
+ current: "https://unify.apideck.com/crm/companies",
1189
+ next:
1190
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjM",
1191
+ },
1192
+ });
1193
+ });
1194
+
1195
+ test("Employees Hris Employees Add", async () => {
1196
+ const testHttpClient = createTestHTTPClient("hris.employeesAdd");
1197
+
1198
+ const apideck = new Apideck({
1199
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
1200
+ httpClient: testHttpClient,
1201
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
1202
+ });
1203
+
1204
+ const result = await apideck.hris.employees.create({
1205
+ consumerId: "test-consumer",
1206
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
1207
+ serviceId: "salesforce",
1208
+ employee: {
1209
+ id: "12345",
1210
+ firstName: "Elon",
1211
+ lastName: "Musk",
1212
+ middleName: "D.",
1213
+ displayName: "Technoking",
1214
+ preferredName: "Elon Musk",
1215
+ initials: "EM",
1216
+ salutation: "Mr",
1217
+ title: "CEO",
1218
+ maritalStatus: "married",
1219
+ partner: {
1220
+ firstName: "Elon",
1221
+ lastName: "Musk",
1222
+ middleName: "D.",
1223
+ gender: "male",
1224
+ initials: "EM",
1225
+ birthday: new Date("2000-08-12"),
1226
+ deceasedOn: new Date("2000-08-12"),
1227
+ },
1228
+ division: "Europe",
1229
+ divisionId: "12345",
1230
+ departmentId: "12345",
1231
+ departmentName: "12345",
1232
+ team: {
1233
+ id: "1234",
1234
+ name: "Full Stack Engineers",
1235
+ },
1236
+ companyId: "23456",
1237
+ companyName: "SpaceX",
1238
+ employmentStartDate: "2021-10-26",
1239
+ employmentEndDate: "2028-10-26",
1240
+ leavingReason: "resigned",
1241
+ employeeNumber: "123456-AB",
1242
+ employmentStatus: "active",
1243
+ ethnicity: "African American",
1244
+ manager: {
1245
+ id: "12345",
1246
+ name: "Elon Musk",
1247
+ firstName: "Elon",
1248
+ lastName: "Musk",
1249
+ email: "elon@musk.com",
1250
+ employmentStatus: "active",
1251
+ },
1252
+ directReports: [
1253
+ "a0d636c6-43b3-4bde-8c70-85b707d992f4",
1254
+ "a98lfd96-43b3-4bde-8c70-85b707d992e6",
1255
+ ],
1256
+ socialSecurityNumber: "123456789",
1257
+ birthday: new Date("2000-08-12"),
1258
+ deceasedOn: new Date("2000-08-12"),
1259
+ countryOfBirth: "US",
1260
+ description: "A description",
1261
+ gender: "male",
1262
+ pronouns: "she,her",
1263
+ preferredLanguage: "EN",
1264
+ languages: [
1265
+ "EN",
1266
+ ],
1267
+ nationalities: [
1268
+ "US",
1269
+ ],
1270
+ photoUrl: "https://unavatar.io/elon-musk",
1271
+ timezone: "Europe/London",
1272
+ source: "lever",
1273
+ sourceId: "12345",
1274
+ recordUrl: "https://app.intercom.io/contacts/12345",
1275
+ jobs: [
1276
+ {
1277
+ title: "CEO",
1278
+ role: "Sales",
1279
+ startDate: new Date("2020-08-12"),
1280
+ endDate: new Date("2020-08-12"),
1281
+ compensationRate: 72000,
1282
+ currency: "USD",
1283
+ paymentUnit: "year",
1284
+ hiredAt: new Date("2020-08-12"),
1285
+ isPrimary: true,
1286
+ isManager: true,
1287
+ status: "active",
1288
+ location: {
1289
+ id: "123",
1290
+ type: "primary",
1291
+ string: "25 Spring Street, Blackburn, VIC 3130",
1292
+ name: "HQ US",
1293
+ line1: "Main street",
1294
+ line2: "apt #",
1295
+ line3: "Suite #",
1296
+ line4: "delivery instructions",
1297
+ streetNumber: "25",
1298
+ city: "San Francisco",
1299
+ state: "CA",
1300
+ postalCode: "94104",
1301
+ country: "US",
1302
+ latitude: "40.759211",
1303
+ longitude: "-73.984638",
1304
+ county: "Santa Clara",
1305
+ contactName: "Elon Musk",
1306
+ salutation: "Mr",
1307
+ phoneNumber: "111-111-1111",
1308
+ fax: "122-111-1111",
1309
+ email: "elon@musk.com",
1310
+ website: "https://elonmusk.com",
1311
+ notes: "Address notes or delivery instructions.",
1312
+ rowVersion: "1-12345",
1313
+ },
1314
+ },
1315
+ {
1316
+ title: "CEO",
1317
+ role: "Sales",
1318
+ startDate: new Date("2020-08-12"),
1319
+ endDate: new Date("2020-08-12"),
1320
+ compensationRate: 72000,
1321
+ currency: "USD",
1322
+ paymentUnit: "year",
1323
+ hiredAt: new Date("2020-08-12"),
1324
+ isPrimary: true,
1325
+ isManager: true,
1326
+ status: "active",
1327
+ location: {
1328
+ id: "123",
1329
+ type: "primary",
1330
+ string: "25 Spring Street, Blackburn, VIC 3130",
1331
+ name: "HQ US",
1332
+ line1: "Main street",
1333
+ line2: "apt #",
1334
+ line3: "Suite #",
1335
+ line4: "delivery instructions",
1336
+ streetNumber: "25",
1337
+ city: "San Francisco",
1338
+ state: "CA",
1339
+ postalCode: "94104",
1340
+ country: "US",
1341
+ latitude: "40.759211",
1342
+ longitude: "-73.984638",
1343
+ county: "Santa Clara",
1344
+ contactName: "Elon Musk",
1345
+ salutation: "Mr",
1346
+ phoneNumber: "111-111-1111",
1347
+ fax: "122-111-1111",
1348
+ email: "elon@musk.com",
1349
+ website: "https://elonmusk.com",
1350
+ notes: "Address notes or delivery instructions.",
1351
+ rowVersion: "1-12345",
1352
+ },
1353
+ },
1354
+ ],
1355
+ compensations: [
1356
+ {
1357
+ rate: 50,
1358
+ paymentUnit: "hour",
1359
+ flsaStatus: "nonexempt",
1360
+ effectiveDate: "2021-06-11",
1361
+ },
1362
+ ],
1363
+ worksRemote: true,
1364
+ addresses: [
1365
+ {
1366
+ id: "123",
1367
+ type: "primary",
1368
+ string: "25 Spring Street, Blackburn, VIC 3130",
1369
+ name: "HQ US",
1370
+ line1: "Main street",
1371
+ line2: "apt #",
1372
+ line3: "Suite #",
1373
+ line4: "delivery instructions",
1374
+ streetNumber: "25",
1375
+ city: "San Francisco",
1376
+ state: "CA",
1377
+ postalCode: "94104",
1378
+ country: "US",
1379
+ latitude: "40.759211",
1380
+ longitude: "-73.984638",
1381
+ county: "Santa Clara",
1382
+ contactName: "Elon Musk",
1383
+ salutation: "Mr",
1384
+ phoneNumber: "111-111-1111",
1385
+ fax: "122-111-1111",
1386
+ email: "elon@musk.com",
1387
+ website: "https://elonmusk.com",
1388
+ notes: "Address notes or delivery instructions.",
1389
+ rowVersion: "1-12345",
1390
+ },
1391
+ {
1392
+ id: "123",
1393
+ type: "primary",
1394
+ string: "25 Spring Street, Blackburn, VIC 3130",
1395
+ name: "HQ US",
1396
+ line1: "Main street",
1397
+ line2: "apt #",
1398
+ line3: "Suite #",
1399
+ line4: "delivery instructions",
1400
+ streetNumber: "25",
1401
+ city: "San Francisco",
1402
+ state: "CA",
1403
+ postalCode: "94104",
1404
+ country: "US",
1405
+ latitude: "40.759211",
1406
+ longitude: "-73.984638",
1407
+ county: "Santa Clara",
1408
+ contactName: "Elon Musk",
1409
+ salutation: "Mr",
1410
+ phoneNumber: "111-111-1111",
1411
+ fax: "122-111-1111",
1412
+ email: "elon@musk.com",
1413
+ website: "https://elonmusk.com",
1414
+ notes: "Address notes or delivery instructions.",
1415
+ rowVersion: "1-12345",
1416
+ },
1417
+ ],
1418
+ phoneNumbers: [
1419
+ {
1420
+ id: "12345",
1421
+ countryCode: "1",
1422
+ areaCode: "323",
1423
+ number: "111-111-1111",
1424
+ extension: "105",
1425
+ type: "primary",
1426
+ },
1427
+ {
1428
+ id: "12345",
1429
+ countryCode: "1",
1430
+ areaCode: "323",
1431
+ number: "111-111-1111",
1432
+ extension: "105",
1433
+ type: "primary",
1434
+ },
1435
+ ],
1436
+ emails: [
1437
+ {
1438
+ id: "123",
1439
+ email: "elon@musk.com",
1440
+ type: "primary",
1441
+ },
1442
+ ],
1443
+ customFields: [
1444
+ {
1445
+ id: "2389328923893298",
1446
+ name: "employee_level",
1447
+ description: "Employee Level",
1448
+ value: {
1449
+ "0": "<value>",
1450
+ "1": "<value>",
1451
+ "2": "<value>",
1452
+ },
1453
+ },
1454
+ ],
1455
+ socialLinks: [
1456
+ {
1457
+ id: "12345",
1458
+ url: "https://www.twitter.com/apideck",
1459
+ type: "twitter",
1460
+ },
1461
+ ],
1462
+ bankAccounts: [
1463
+ {
1464
+ bankName: "Monzo",
1465
+ accountNumber: "123465",
1466
+ accountName: "SPACEX LLC",
1467
+ accountType: "credit_card",
1468
+ iban: "CH2989144532982975332",
1469
+ bic: "AUDSCHGGXXX",
1470
+ routingNumber: "012345678",
1471
+ bsbNumber: "062-001",
1472
+ branchIdentifier: "001",
1473
+ bankCode: "BNH",
1474
+ currency: "USD",
1475
+ },
1476
+ ],
1477
+ taxCode: "1111",
1478
+ taxId: "234-32-0000",
1479
+ dietaryPreference: "Veggie",
1480
+ foodAllergies: [
1481
+ "No allergies",
1482
+ ],
1483
+ probationPeriod: {
1484
+ startDate: new Date("2021-10-01"),
1485
+ endDate: new Date("2021-11-28"),
1486
+ },
1487
+ tags: [
1488
+ "New",
1489
+ ],
1490
+ rowVersion: "1-12345",
1491
+ deleted: true,
1492
+ passThrough: [
1493
+ {
1494
+ serviceId: "<id>",
1495
+ extendPaths: [
1496
+ {
1497
+ path: "$.nested.property",
1498
+ value: {
1499
+ "TaxClassificationRef": {
1500
+ "value": "EUC-99990201-V1-00020000",
1501
+ },
1502
+ },
1503
+ },
1504
+ {
1505
+ path: "$.nested.property",
1506
+ value: {
1507
+ "TaxClassificationRef": {
1508
+ "value": "EUC-99990201-V1-00020000",
1509
+ },
1510
+ },
1511
+ },
1512
+ {
1513
+ path: "$.nested.property",
1514
+ value: {
1515
+ "TaxClassificationRef": {
1516
+ "value": "EUC-99990201-V1-00020000",
1517
+ },
1518
+ },
1519
+ },
1520
+ ],
1521
+ },
1522
+ ],
1523
+ },
1524
+ });
1525
+ expect(result.httpMeta.response.status).toBe(201);
1526
+ expect(result.createEmployeeResponse).toBeDefined();
1527
+ expect(result.createEmployeeResponse).toEqual({
1528
+ statusCode: 200,
1529
+ status: "OK",
1530
+ service: "sage-hr",
1531
+ resource: "Employees",
1532
+ operation: "add",
1533
+ data: {
1534
+ id: "12345",
1535
+ },
1536
+ });
1537
+ });
1538
+
1539
+ test("Employees Hris Employees One", async () => {
1540
+ const testHttpClient = createTestHTTPClient("hris.employeesOne");
1541
+
1542
+ const apideck = new Apideck({
1543
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
1544
+ httpClient: testHttpClient,
1545
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
1546
+ });
1547
+
1548
+ const result = await apideck.hris.employees.get({
1549
+ id: "<id>",
1550
+ consumerId: "test-consumer",
1551
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
1552
+ serviceId: "salesforce",
1553
+ fields: "id,updated_at",
1554
+ filter: {
1555
+ companyId: "1234",
1556
+ },
1557
+ passThrough: {
1558
+ "search": "San Francisco",
1559
+ },
1560
+ });
1561
+ expect(result.httpMeta.response.status).toBe(200);
1562
+ expect(result.getEmployeeResponse).toBeDefined();
1563
+ expect(result.getEmployeeResponse).toEqual({
1564
+ statusCode: 200,
1565
+ status: "OK",
1566
+ service: "sage-hr",
1567
+ resource: "Employees",
1568
+ operation: "one",
1569
+ data: {
1570
+ id: "12345",
1571
+ downstreamId: "12345",
1572
+ firstName: "Elon",
1573
+ lastName: "Musk",
1574
+ middleName: "D.",
1575
+ displayName: "Technoking",
1576
+ preferredName: "Elon Musk",
1577
+ initials: "EM",
1578
+ salutation: "Mr",
1579
+ title: "CEO",
1580
+ maritalStatus: "married",
1581
+ partner: {
1582
+ id: "12345",
1583
+ firstName: "Elon",
1584
+ lastName: "Musk",
1585
+ middleName: "D.",
1586
+ gender: "male",
1587
+ initials: "EM",
1588
+ birthday: new Date("2000-08-12"),
1589
+ deceasedOn: new Date("2000-08-12"),
1590
+ },
1591
+ division: "Europe",
1592
+ divisionId: "12345",
1593
+ departmentId: "12345",
1594
+ departmentName: "12345",
1595
+ team: {
1596
+ id: "1234",
1597
+ name: "Full Stack Engineers",
1598
+ },
1599
+ companyId: "23456",
1600
+ companyName: "SpaceX",
1601
+ employmentStartDate: "2021-10-26",
1602
+ employmentEndDate: "2028-10-26",
1603
+ leavingReason: "resigned",
1604
+ employeeNumber: "123456-AB",
1605
+ employmentStatus: "active",
1606
+ ethnicity: "African American",
1607
+ manager: {
1608
+ id: "12345",
1609
+ name: "Elon Musk",
1610
+ firstName: "Elon",
1611
+ lastName: "Musk",
1612
+ email: "elon@musk.com",
1613
+ employmentStatus: "active",
1614
+ },
1615
+ directReports: [
1616
+ "a0d636c6-43b3-4bde-8c70-85b707d992f4",
1617
+ "a98lfd96-43b3-4bde-8c70-85b707d992e6",
1618
+ ],
1619
+ socialSecurityNumber: "123456789",
1620
+ birthday: new Date("2000-08-12"),
1621
+ deceasedOn: new Date("2000-08-12"),
1622
+ countryOfBirth: "US",
1623
+ description: "A description",
1624
+ gender: "male",
1625
+ pronouns: "she,her",
1626
+ preferredLanguage: "EN",
1627
+ languages: [
1628
+ "EN",
1629
+ ],
1630
+ nationalities: [
1631
+ "US",
1632
+ ],
1633
+ photoUrl: "https://unavatar.io/elon-musk",
1634
+ timezone: "Europe/London",
1635
+ source: "lever",
1636
+ sourceId: "12345",
1637
+ recordUrl: "https://app.intercom.io/contacts/12345",
1638
+ jobs: [
1639
+ {
1640
+ id: "12345",
1641
+ employeeId: "12345",
1642
+ title: "CEO",
1643
+ role: "Sales",
1644
+ startDate: new Date("2020-08-12"),
1645
+ endDate: new Date("2020-08-12"),
1646
+ compensationRate: 72000,
1647
+ currency: "USD",
1648
+ paymentUnit: "year",
1649
+ hiredAt: new Date("2020-08-12"),
1650
+ isPrimary: true,
1651
+ isManager: true,
1652
+ status: "active",
1653
+ location: {
1654
+ id: "123",
1655
+ type: "primary",
1656
+ string: "25 Spring Street, Blackburn, VIC 3130",
1657
+ name: "HQ US",
1658
+ line1: "Main street",
1659
+ line2: "apt #",
1660
+ line3: "Suite #",
1661
+ line4: "delivery instructions",
1662
+ streetNumber: "25",
1663
+ city: "San Francisco",
1664
+ state: "CA",
1665
+ postalCode: "94104",
1666
+ country: "US",
1667
+ latitude: "40.759211",
1668
+ longitude: "-73.984638",
1669
+ county: "Santa Clara",
1670
+ contactName: "Elon Musk",
1671
+ salutation: "Mr",
1672
+ phoneNumber: "111-111-1111",
1673
+ fax: "122-111-1111",
1674
+ email: "elon@musk.com",
1675
+ website: "https://elonmusk.com",
1676
+ notes: "Address notes or delivery instructions.",
1677
+ rowVersion: "1-12345",
1678
+ },
1679
+ },
1680
+ {
1681
+ id: "12345",
1682
+ employeeId: "12345",
1683
+ title: "CEO",
1684
+ role: "Sales",
1685
+ startDate: new Date("2020-08-12"),
1686
+ endDate: new Date("2020-08-12"),
1687
+ compensationRate: 72000,
1688
+ currency: "USD",
1689
+ paymentUnit: "year",
1690
+ hiredAt: new Date("2020-08-12"),
1691
+ isPrimary: true,
1692
+ isManager: true,
1693
+ status: "active",
1694
+ location: {
1695
+ id: "123",
1696
+ type: "primary",
1697
+ string: "25 Spring Street, Blackburn, VIC 3130",
1698
+ name: "HQ US",
1699
+ line1: "Main street",
1700
+ line2: "apt #",
1701
+ line3: "Suite #",
1702
+ line4: "delivery instructions",
1703
+ streetNumber: "25",
1704
+ city: "San Francisco",
1705
+ state: "CA",
1706
+ postalCode: "94104",
1707
+ country: "US",
1708
+ latitude: "40.759211",
1709
+ longitude: "-73.984638",
1710
+ county: "Santa Clara",
1711
+ contactName: "Elon Musk",
1712
+ salutation: "Mr",
1713
+ phoneNumber: "111-111-1111",
1714
+ fax: "122-111-1111",
1715
+ email: "elon@musk.com",
1716
+ website: "https://elonmusk.com",
1717
+ notes: "Address notes or delivery instructions.",
1718
+ rowVersion: "1-12345",
1719
+ },
1720
+ },
1721
+ {
1722
+ id: "12345",
1723
+ employeeId: "12345",
1724
+ title: "CEO",
1725
+ role: "Sales",
1726
+ startDate: new Date("2020-08-12"),
1727
+ endDate: new Date("2020-08-12"),
1728
+ compensationRate: 72000,
1729
+ currency: "USD",
1730
+ paymentUnit: "year",
1731
+ hiredAt: new Date("2020-08-12"),
1732
+ isPrimary: true,
1733
+ isManager: true,
1734
+ status: "active",
1735
+ location: {
1736
+ id: "123",
1737
+ type: "primary",
1738
+ string: "25 Spring Street, Blackburn, VIC 3130",
1739
+ name: "HQ US",
1740
+ line1: "Main street",
1741
+ line2: "apt #",
1742
+ line3: "Suite #",
1743
+ line4: "delivery instructions",
1744
+ streetNumber: "25",
1745
+ city: "San Francisco",
1746
+ state: "CA",
1747
+ postalCode: "94104",
1748
+ country: "US",
1749
+ latitude: "40.759211",
1750
+ longitude: "-73.984638",
1751
+ county: "Santa Clara",
1752
+ contactName: "Elon Musk",
1753
+ salutation: "Mr",
1754
+ phoneNumber: "111-111-1111",
1755
+ fax: "122-111-1111",
1756
+ email: "elon@musk.com",
1757
+ website: "https://elonmusk.com",
1758
+ notes: "Address notes or delivery instructions.",
1759
+ rowVersion: "1-12345",
1760
+ },
1761
+ },
1762
+ ],
1763
+ compensations: [
1764
+ {
1765
+ id: "3404301363494309004",
1766
+ jobId: "3490439050957906679",
1767
+ rate: 50,
1768
+ paymentUnit: "hour",
1769
+ flsaStatus: "nonexempt",
1770
+ effectiveDate: "2021-06-11",
1771
+ },
1772
+ ],
1773
+ worksRemote: true,
1774
+ addresses: [
1775
+ {
1776
+ id: "123",
1777
+ type: "primary",
1778
+ string: "25 Spring Street, Blackburn, VIC 3130",
1779
+ name: "HQ US",
1780
+ line1: "Main street",
1781
+ line2: "apt #",
1782
+ line3: "Suite #",
1783
+ line4: "delivery instructions",
1784
+ streetNumber: "25",
1785
+ city: "San Francisco",
1786
+ state: "CA",
1787
+ postalCode: "94104",
1788
+ country: "US",
1789
+ latitude: "40.759211",
1790
+ longitude: "-73.984638",
1791
+ county: "Santa Clara",
1792
+ contactName: "Elon Musk",
1793
+ salutation: "Mr",
1794
+ phoneNumber: "111-111-1111",
1795
+ fax: "122-111-1111",
1796
+ email: "elon@musk.com",
1797
+ website: "https://elonmusk.com",
1798
+ notes: "Address notes or delivery instructions.",
1799
+ rowVersion: "1-12345",
1800
+ },
1801
+ {
1802
+ id: "123",
1803
+ type: "primary",
1804
+ string: "25 Spring Street, Blackburn, VIC 3130",
1805
+ name: "HQ US",
1806
+ line1: "Main street",
1807
+ line2: "apt #",
1808
+ line3: "Suite #",
1809
+ line4: "delivery instructions",
1810
+ streetNumber: "25",
1811
+ city: "San Francisco",
1812
+ state: "CA",
1813
+ postalCode: "94104",
1814
+ country: "US",
1815
+ latitude: "40.759211",
1816
+ longitude: "-73.984638",
1817
+ county: "Santa Clara",
1818
+ contactName: "Elon Musk",
1819
+ salutation: "Mr",
1820
+ phoneNumber: "111-111-1111",
1821
+ fax: "122-111-1111",
1822
+ email: "elon@musk.com",
1823
+ website: "https://elonmusk.com",
1824
+ notes: "Address notes or delivery instructions.",
1825
+ rowVersion: "1-12345",
1826
+ },
1827
+ ],
1828
+ phoneNumbers: [
1829
+ {
1830
+ id: "12345",
1831
+ countryCode: "1",
1832
+ areaCode: "323",
1833
+ number: "111-111-1111",
1834
+ extension: "105",
1835
+ type: "primary",
1836
+ },
1837
+ {
1838
+ id: "12345",
1839
+ countryCode: "1",
1840
+ areaCode: "323",
1841
+ number: "111-111-1111",
1842
+ extension: "105",
1843
+ type: "primary",
1844
+ },
1845
+ ],
1846
+ emails: [
1847
+ {
1848
+ id: "123",
1849
+ email: "elon@musk.com",
1850
+ type: "primary",
1851
+ },
1852
+ {
1853
+ id: "123",
1854
+ email: "elon@musk.com",
1855
+ type: "primary",
1856
+ },
1857
+ ],
1858
+ customFields: [
1859
+ {
1860
+ id: "2389328923893298",
1861
+ name: "employee_level",
1862
+ description: "Employee Level",
1863
+ value: true,
1864
+ },
1865
+ {
1866
+ id: "2389328923893298",
1867
+ name: "employee_level",
1868
+ description: "Employee Level",
1869
+ value: true,
1870
+ },
1871
+ {
1872
+ id: "2389328923893298",
1873
+ name: "employee_level",
1874
+ description: "Employee Level",
1875
+ value: 10,
1876
+ },
1877
+ ],
1878
+ socialLinks: [
1879
+ {
1880
+ id: "12345",
1881
+ url: "https://www.twitter.com/apideck",
1882
+ type: "twitter",
1883
+ },
1884
+ ],
1885
+ bankAccounts: [
1886
+ {
1887
+ bankName: "Monzo",
1888
+ accountNumber: "123465",
1889
+ accountName: "SPACEX LLC",
1890
+ accountType: "credit_card",
1891
+ iban: "CH2989144532982975332",
1892
+ bic: "AUDSCHGGXXX",
1893
+ routingNumber: "012345678",
1894
+ bsbNumber: "062-001",
1895
+ branchIdentifier: "001",
1896
+ bankCode: "BNH",
1897
+ currency: "USD",
1898
+ },
1899
+ {
1900
+ bankName: "Monzo",
1901
+ accountNumber: "123465",
1902
+ accountName: "SPACEX LLC",
1903
+ accountType: "credit_card",
1904
+ iban: "CH2989144532982975332",
1905
+ bic: "AUDSCHGGXXX",
1906
+ routingNumber: "012345678",
1907
+ bsbNumber: "062-001",
1908
+ branchIdentifier: "001",
1909
+ bankCode: "BNH",
1910
+ currency: "USD",
1911
+ },
1912
+ {
1913
+ bankName: "Monzo",
1914
+ accountNumber: "123465",
1915
+ accountName: "SPACEX LLC",
1916
+ accountType: "credit_card",
1917
+ iban: "CH2989144532982975332",
1918
+ bic: "AUDSCHGGXXX",
1919
+ routingNumber: "012345678",
1920
+ bsbNumber: "062-001",
1921
+ branchIdentifier: "001",
1922
+ bankCode: "BNH",
1923
+ currency: "USD",
1924
+ },
1925
+ ],
1926
+ taxCode: "1111",
1927
+ taxId: "234-32-0000",
1928
+ dietaryPreference: "Veggie",
1929
+ foodAllergies: [
1930
+ "No allergies",
1931
+ ],
1932
+ probationPeriod: {
1933
+ startDate: new Date("2021-10-01"),
1934
+ endDate: new Date("2021-11-28"),
1935
+ },
1936
+ tags: [
1937
+ "New",
1938
+ ],
1939
+ rowVersion: "1-12345",
1940
+ deleted: true,
1941
+ updatedBy: "12345",
1942
+ createdBy: "12345",
1943
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
1944
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
1945
+ passThrough: [
1946
+ {
1947
+ serviceId: "<id>",
1948
+ extendPaths: [
1949
+ {
1950
+ path: "$.nested.property",
1951
+ value: {
1952
+ "TaxClassificationRef": {
1953
+ "value": "EUC-99990201-V1-00020000",
1954
+ },
1955
+ },
1956
+ },
1957
+ {
1958
+ path: "$.nested.property",
1959
+ value: {
1960
+ "TaxClassificationRef": {
1961
+ "value": "EUC-99990201-V1-00020000",
1962
+ },
1963
+ },
1964
+ },
1965
+ {
1966
+ path: "$.nested.property",
1967
+ value: {
1968
+ "TaxClassificationRef": {
1969
+ "value": "EUC-99990201-V1-00020000",
1970
+ },
1971
+ },
1972
+ },
1973
+ ],
1974
+ },
1975
+ {
1976
+ serviceId: "<id>",
1977
+ extendPaths: [
1978
+ {
1979
+ path: "$.nested.property",
1980
+ value: {
1981
+ "TaxClassificationRef": {
1982
+ "value": "EUC-99990201-V1-00020000",
1983
+ },
1984
+ },
1985
+ },
1986
+ ],
1987
+ },
1988
+ ],
1989
+ },
1990
+ });
1991
+ });
1992
+
1993
+ test("Employees Hris Employees Update", async () => {
1994
+ const testHttpClient = createTestHTTPClient("hris.employeesUpdate");
1995
+
1996
+ const apideck = new Apideck({
1997
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
1998
+ httpClient: testHttpClient,
1999
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
2000
+ });
2001
+
2002
+ const result = await apideck.hris.employees.update({
2003
+ id: "<id>",
2004
+ consumerId: "test-consumer",
2005
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
2006
+ serviceId: "salesforce",
2007
+ employee: {
2008
+ id: "12345",
2009
+ firstName: "Elon",
2010
+ lastName: "Musk",
2011
+ middleName: "D.",
2012
+ displayName: "Technoking",
2013
+ preferredName: "Elon Musk",
2014
+ initials: "EM",
2015
+ salutation: "Mr",
2016
+ title: "CEO",
2017
+ maritalStatus: "married",
2018
+ partner: {
2019
+ firstName: "Elon",
2020
+ lastName: "Musk",
2021
+ middleName: "D.",
2022
+ gender: "male",
2023
+ initials: "EM",
2024
+ birthday: new Date("2000-08-12"),
2025
+ deceasedOn: new Date("2000-08-12"),
2026
+ },
2027
+ division: "Europe",
2028
+ divisionId: "12345",
2029
+ departmentId: "12345",
2030
+ departmentName: "12345",
2031
+ team: {
2032
+ id: "1234",
2033
+ name: "Full Stack Engineers",
2034
+ },
2035
+ companyId: "23456",
2036
+ companyName: "SpaceX",
2037
+ employmentStartDate: "2021-10-26",
2038
+ employmentEndDate: "2028-10-26",
2039
+ leavingReason: "resigned",
2040
+ employeeNumber: "123456-AB",
2041
+ employmentStatus: "active",
2042
+ ethnicity: "African American",
2043
+ manager: {
2044
+ id: "12345",
2045
+ name: "Elon Musk",
2046
+ firstName: "Elon",
2047
+ lastName: "Musk",
2048
+ email: "elon@musk.com",
2049
+ employmentStatus: "active",
2050
+ },
2051
+ directReports: [
2052
+ "a0d636c6-43b3-4bde-8c70-85b707d992f4",
2053
+ "a98lfd96-43b3-4bde-8c70-85b707d992e6",
2054
+ ],
2055
+ socialSecurityNumber: "123456789",
2056
+ birthday: new Date("2000-08-12"),
2057
+ deceasedOn: new Date("2000-08-12"),
2058
+ countryOfBirth: "US",
2059
+ description: "A description",
2060
+ gender: "male",
2061
+ pronouns: "she,her",
2062
+ preferredLanguage: "EN",
2063
+ languages: [
2064
+ "EN",
2065
+ ],
2066
+ nationalities: [
2067
+ "US",
2068
+ ],
2069
+ photoUrl: "https://unavatar.io/elon-musk",
2070
+ timezone: "Europe/London",
2071
+ source: "lever",
2072
+ sourceId: "12345",
2073
+ recordUrl: "https://app.intercom.io/contacts/12345",
2074
+ jobs: [
2075
+ {
2076
+ title: "CEO",
2077
+ role: "Sales",
2078
+ startDate: new Date("2020-08-12"),
2079
+ endDate: new Date("2020-08-12"),
2080
+ compensationRate: 72000,
2081
+ currency: "USD",
2082
+ paymentUnit: "year",
2083
+ hiredAt: new Date("2020-08-12"),
2084
+ isPrimary: true,
2085
+ isManager: true,
2086
+ status: "active",
2087
+ location: {
2088
+ id: "123",
2089
+ type: "primary",
2090
+ string: "25 Spring Street, Blackburn, VIC 3130",
2091
+ name: "HQ US",
2092
+ line1: "Main street",
2093
+ line2: "apt #",
2094
+ line3: "Suite #",
2095
+ line4: "delivery instructions",
2096
+ streetNumber: "25",
2097
+ city: "San Francisco",
2098
+ state: "CA",
2099
+ postalCode: "94104",
2100
+ country: "US",
2101
+ latitude: "40.759211",
2102
+ longitude: "-73.984638",
2103
+ county: "Santa Clara",
2104
+ contactName: "Elon Musk",
2105
+ salutation: "Mr",
2106
+ phoneNumber: "111-111-1111",
2107
+ fax: "122-111-1111",
2108
+ email: "elon@musk.com",
2109
+ website: "https://elonmusk.com",
2110
+ notes: "Address notes or delivery instructions.",
2111
+ rowVersion: "1-12345",
2112
+ },
2113
+ },
2114
+ {
2115
+ title: "CEO",
2116
+ role: "Sales",
2117
+ startDate: new Date("2020-08-12"),
2118
+ endDate: new Date("2020-08-12"),
2119
+ compensationRate: 72000,
2120
+ currency: "USD",
2121
+ paymentUnit: "year",
2122
+ hiredAt: new Date("2020-08-12"),
2123
+ isPrimary: true,
2124
+ isManager: true,
2125
+ status: "active",
2126
+ location: {
2127
+ id: "123",
2128
+ type: "primary",
2129
+ string: "25 Spring Street, Blackburn, VIC 3130",
2130
+ name: "HQ US",
2131
+ line1: "Main street",
2132
+ line2: "apt #",
2133
+ line3: "Suite #",
2134
+ line4: "delivery instructions",
2135
+ streetNumber: "25",
2136
+ city: "San Francisco",
2137
+ state: "CA",
2138
+ postalCode: "94104",
2139
+ country: "US",
2140
+ latitude: "40.759211",
2141
+ longitude: "-73.984638",
2142
+ county: "Santa Clara",
2143
+ contactName: "Elon Musk",
2144
+ salutation: "Mr",
2145
+ phoneNumber: "111-111-1111",
2146
+ fax: "122-111-1111",
2147
+ email: "elon@musk.com",
2148
+ website: "https://elonmusk.com",
2149
+ notes: "Address notes or delivery instructions.",
2150
+ rowVersion: "1-12345",
2151
+ },
2152
+ },
2153
+ {
2154
+ title: "CEO",
2155
+ role: "Sales",
2156
+ startDate: new Date("2020-08-12"),
2157
+ endDate: new Date("2020-08-12"),
2158
+ compensationRate: 72000,
2159
+ currency: "USD",
2160
+ paymentUnit: "year",
2161
+ hiredAt: new Date("2020-08-12"),
2162
+ isPrimary: true,
2163
+ isManager: true,
2164
+ status: "active",
2165
+ location: {
2166
+ id: "123",
2167
+ type: "primary",
2168
+ string: "25 Spring Street, Blackburn, VIC 3130",
2169
+ name: "HQ US",
2170
+ line1: "Main street",
2171
+ line2: "apt #",
2172
+ line3: "Suite #",
2173
+ line4: "delivery instructions",
2174
+ streetNumber: "25",
2175
+ city: "San Francisco",
2176
+ state: "CA",
2177
+ postalCode: "94104",
2178
+ country: "US",
2179
+ latitude: "40.759211",
2180
+ longitude: "-73.984638",
2181
+ county: "Santa Clara",
2182
+ contactName: "Elon Musk",
2183
+ salutation: "Mr",
2184
+ phoneNumber: "111-111-1111",
2185
+ fax: "122-111-1111",
2186
+ email: "elon@musk.com",
2187
+ website: "https://elonmusk.com",
2188
+ notes: "Address notes or delivery instructions.",
2189
+ rowVersion: "1-12345",
2190
+ },
2191
+ },
2192
+ ],
2193
+ compensations: [
2194
+ {
2195
+ rate: 50,
2196
+ paymentUnit: "hour",
2197
+ flsaStatus: "nonexempt",
2198
+ effectiveDate: "2021-06-11",
2199
+ },
2200
+ ],
2201
+ worksRemote: true,
2202
+ addresses: [
2203
+ {
2204
+ id: "123",
2205
+ type: "primary",
2206
+ string: "25 Spring Street, Blackburn, VIC 3130",
2207
+ name: "HQ US",
2208
+ line1: "Main street",
2209
+ line2: "apt #",
2210
+ line3: "Suite #",
2211
+ line4: "delivery instructions",
2212
+ streetNumber: "25",
2213
+ city: "San Francisco",
2214
+ state: "CA",
2215
+ postalCode: "94104",
2216
+ country: "US",
2217
+ latitude: "40.759211",
2218
+ longitude: "-73.984638",
2219
+ county: "Santa Clara",
2220
+ contactName: "Elon Musk",
2221
+ salutation: "Mr",
2222
+ phoneNumber: "111-111-1111",
2223
+ fax: "122-111-1111",
2224
+ email: "elon@musk.com",
2225
+ website: "https://elonmusk.com",
2226
+ notes: "Address notes or delivery instructions.",
2227
+ rowVersion: "1-12345",
2228
+ },
2229
+ {
2230
+ id: "123",
2231
+ type: "primary",
2232
+ string: "25 Spring Street, Blackburn, VIC 3130",
2233
+ name: "HQ US",
2234
+ line1: "Main street",
2235
+ line2: "apt #",
2236
+ line3: "Suite #",
2237
+ line4: "delivery instructions",
2238
+ streetNumber: "25",
2239
+ city: "San Francisco",
2240
+ state: "CA",
2241
+ postalCode: "94104",
2242
+ country: "US",
2243
+ latitude: "40.759211",
2244
+ longitude: "-73.984638",
2245
+ county: "Santa Clara",
2246
+ contactName: "Elon Musk",
2247
+ salutation: "Mr",
2248
+ phoneNumber: "111-111-1111",
2249
+ fax: "122-111-1111",
2250
+ email: "elon@musk.com",
2251
+ website: "https://elonmusk.com",
2252
+ notes: "Address notes or delivery instructions.",
2253
+ rowVersion: "1-12345",
2254
+ },
2255
+ ],
2256
+ phoneNumbers: [
2257
+ {
2258
+ id: "12345",
2259
+ countryCode: "1",
2260
+ areaCode: "323",
2261
+ number: "111-111-1111",
2262
+ extension: "105",
2263
+ type: "primary",
2264
+ },
2265
+ {
2266
+ id: "12345",
2267
+ countryCode: "1",
2268
+ areaCode: "323",
2269
+ number: "111-111-1111",
2270
+ extension: "105",
2271
+ type: "primary",
2272
+ },
2273
+ ],
2274
+ emails: [
2275
+ {
2276
+ id: "123",
2277
+ email: "elon@musk.com",
2278
+ type: "primary",
2279
+ },
2280
+ {
2281
+ id: "123",
2282
+ email: "elon@musk.com",
2283
+ type: "primary",
2284
+ },
2285
+ {
2286
+ id: "123",
2287
+ email: "elon@musk.com",
2288
+ type: "primary",
2289
+ },
2290
+ ],
2291
+ customFields: [
2292
+ {
2293
+ id: "2389328923893298",
2294
+ name: "employee_level",
2295
+ description: "Employee Level",
2296
+ value: true,
2297
+ },
2298
+ {
2299
+ id: "2389328923893298",
2300
+ name: "employee_level",
2301
+ description: "Employee Level",
2302
+ value: {},
2303
+ },
2304
+ ],
2305
+ socialLinks: [
2306
+ {
2307
+ id: "12345",
2308
+ url: "https://www.twitter.com/apideck",
2309
+ type: "twitter",
2310
+ },
2311
+ {
2312
+ id: "12345",
2313
+ url: "https://www.twitter.com/apideck",
2314
+ type: "twitter",
2315
+ },
2316
+ {
2317
+ id: "12345",
2318
+ url: "https://www.twitter.com/apideck",
2319
+ type: "twitter",
2320
+ },
2321
+ ],
2322
+ bankAccounts: [
2323
+ {
2324
+ bankName: "Monzo",
2325
+ accountNumber: "123465",
2326
+ accountName: "SPACEX LLC",
2327
+ accountType: "credit_card",
2328
+ iban: "CH2989144532982975332",
2329
+ bic: "AUDSCHGGXXX",
2330
+ routingNumber: "012345678",
2331
+ bsbNumber: "062-001",
2332
+ branchIdentifier: "001",
2333
+ bankCode: "BNH",
2334
+ currency: "USD",
2335
+ },
2336
+ {
2337
+ bankName: "Monzo",
2338
+ accountNumber: "123465",
2339
+ accountName: "SPACEX LLC",
2340
+ accountType: "credit_card",
2341
+ iban: "CH2989144532982975332",
2342
+ bic: "AUDSCHGGXXX",
2343
+ routingNumber: "012345678",
2344
+ bsbNumber: "062-001",
2345
+ branchIdentifier: "001",
2346
+ bankCode: "BNH",
2347
+ currency: "USD",
2348
+ },
2349
+ ],
2350
+ taxCode: "1111",
2351
+ taxId: "234-32-0000",
2352
+ dietaryPreference: "Veggie",
2353
+ foodAllergies: [
2354
+ "No allergies",
2355
+ ],
2356
+ probationPeriod: {
2357
+ startDate: new Date("2021-10-01"),
2358
+ endDate: new Date("2021-11-28"),
2359
+ },
2360
+ tags: [
2361
+ "New",
2362
+ ],
2363
+ rowVersion: "1-12345",
2364
+ deleted: true,
2365
+ passThrough: [
2366
+ {
2367
+ serviceId: "<id>",
2368
+ extendPaths: [
2369
+ {
2370
+ path: "$.nested.property",
2371
+ value: {
2372
+ "TaxClassificationRef": {
2373
+ "value": "EUC-99990201-V1-00020000",
2374
+ },
2375
+ },
2376
+ },
2377
+ ],
2378
+ },
2379
+ ],
2380
+ },
2381
+ });
2382
+ expect(result.httpMeta.response.status).toBe(200);
2383
+ expect(result.updateEmployeeResponse).toBeDefined();
2384
+ expect(result.updateEmployeeResponse).toEqual({
2385
+ statusCode: 200,
2386
+ status: "OK",
2387
+ service: "sage-hr",
2388
+ resource: "Employees",
2389
+ operation: "update",
2390
+ data: {
2391
+ id: "12345",
2392
+ },
2393
+ });
2394
+ });
2395
+
2396
+ test("Employees Hris Employees Delete", async () => {
2397
+ const testHttpClient = createTestHTTPClient("hris.employeesDelete");
2398
+
2399
+ const apideck = new Apideck({
2400
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
2401
+ httpClient: testHttpClient,
2402
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
2403
+ });
2404
+
2405
+ const result = await apideck.hris.employees.delete({
2406
+ id: "<id>",
2407
+ consumerId: "test-consumer",
2408
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
2409
+ serviceId: "salesforce",
2410
+ });
2411
+ expect(result.httpMeta.response.status).toBe(200);
2412
+ expect(result.deleteEmployeeResponse).toBeDefined();
2413
+ expect(result.deleteEmployeeResponse).toEqual({
2414
+ statusCode: 200,
2415
+ status: "OK",
2416
+ service: "sage-hr",
2417
+ resource: "Employees",
2418
+ operation: "delete",
2419
+ data: {
2420
+ id: "12345",
2421
+ },
2422
+ });
2423
+ });
2424
+
2425
+ test("Employees Accounting Employees All", async () => {
2426
+ const testHttpClient = createTestHTTPClient("accounting.employeesAll");
2427
+
2428
+ const apideck = new Apideck({
2429
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
2430
+ httpClient: testHttpClient,
2431
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
2432
+ });
2433
+
2434
+ const result = await apideck.accounting.employees.list({
2435
+ consumerId: "test-consumer",
2436
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
2437
+ serviceId: "salesforce",
2438
+ fields: "id,updated_at",
2439
+ filter: {
2440
+ updatedSince: new Date("2020-09-30T07:43:32.000Z"),
2441
+ status: "active",
2442
+ },
2443
+ });
2444
+ expect(result.httpMeta.response.status).toBe(200);
2445
+ expect(result.getAccountingEmployeesResponse).toBeDefined();
2446
+ expect(result.getAccountingEmployeesResponse).toEqual({
2447
+ statusCode: 200,
2448
+ status: "OK",
2449
+ service: "quickbooks",
2450
+ resource: "Employees",
2451
+ operation: "all",
2452
+ data: [],
2453
+ meta: {
2454
+ itemsOnPage: 50,
2455
+ cursors: {
2456
+ previous: "em9oby1jcm06OnBhZ2U6OjE=",
2457
+ current: "em9oby1jcm06OnBhZ2U6OjI=",
2458
+ next: "em9oby1jcm06OnBhZ2U6OjM=",
2459
+ },
2460
+ },
2461
+ links: {
2462
+ previous:
2463
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjE%3D",
2464
+ current: "https://unify.apideck.com/crm/companies",
2465
+ next:
2466
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjM",
2467
+ },
2468
+ });
2469
+ });
2470
+
2471
+ test("Employees Accounting Employees Add", async () => {
2472
+ const testHttpClient = createTestHTTPClient("accounting.employeesAdd");
2473
+
2474
+ const apideck = new Apideck({
2475
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
2476
+ httpClient: testHttpClient,
2477
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
2478
+ });
2479
+
2480
+ const result = await apideck.accounting.employees.create({
2481
+ consumerId: "test-consumer",
2482
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
2483
+ serviceId: "salesforce",
2484
+ accountingEmployee: {
2485
+ displayId: "123456",
2486
+ firstName: "John",
2487
+ lastName: "Doe",
2488
+ displayName: "John Doe",
2489
+ emails: [
2490
+ {
2491
+ id: "123",
2492
+ email: "elon@musk.com",
2493
+ type: "primary",
2494
+ },
2495
+ ],
2496
+ employeeNumber: "EMP-001",
2497
+ jobTitle: "Senior Accountant",
2498
+ status: "active",
2499
+ isContractor: false,
2500
+ department: {
2501
+ displayId: "123456",
2502
+ name: "Acme Inc.",
2503
+ },
2504
+ location: {
2505
+ id: "123456",
2506
+ displayId: "123456",
2507
+ name: "New York Office",
2508
+ },
2509
+ manager: {
2510
+ id: "12345",
2511
+ name: "Jane Smith",
2512
+ },
2513
+ hireDate: new Date("2020-01-15"),
2514
+ terminationDate: new Date("2025-12-31"),
2515
+ gender: "male",
2516
+ birthDate: new Date("1990-05-20"),
2517
+ subsidiary: {
2518
+ displayId: "123456",
2519
+ name: "Acme Inc.",
2520
+ },
2521
+ trackingCategories: [
2522
+ {
2523
+ id: "123456",
2524
+ code: "100",
2525
+ name: "New York",
2526
+ parentId: "123456",
2527
+ parentName: "New York",
2528
+ },
2529
+ ],
2530
+ currency: "USD",
2531
+ notes: "Some notes about this employee",
2532
+ addresses: [
2533
+ {
2534
+ id: "123",
2535
+ type: "primary",
2536
+ string: "25 Spring Street, Blackburn, VIC 3130",
2537
+ name: "HQ US",
2538
+ line1: "Main street",
2539
+ line2: "apt #",
2540
+ line3: "Suite #",
2541
+ line4: "delivery instructions",
2542
+ line5: "Attention: Finance Dept",
2543
+ streetNumber: "25",
2544
+ city: "San Francisco",
2545
+ state: "CA",
2546
+ postalCode: "94104",
2547
+ country: "US",
2548
+ latitude: "40.759211",
2549
+ longitude: "-73.984638",
2550
+ county: "Santa Clara",
2551
+ contactName: "Elon Musk",
2552
+ salutation: "Mr",
2553
+ phoneNumber: "111-111-1111",
2554
+ fax: "122-111-1111",
2555
+ email: "elon@musk.com",
2556
+ website: "https://elonmusk.com",
2557
+ notes: "Address notes or delivery instructions.",
2558
+ rowVersion: "1-12345",
2559
+ },
2560
+ ],
2561
+ phoneNumbers: [
2562
+ {
2563
+ id: "12345",
2564
+ countryCode: "1",
2565
+ areaCode: "323",
2566
+ number: "111-111-1111",
2567
+ extension: "105",
2568
+ type: "primary",
2569
+ },
2570
+ ],
2571
+ bankAccount: {
2572
+ bankName: "Chase Bank",
2573
+ accountNumber: "123465",
2574
+ accountName: "Main Operating Account",
2575
+ accountType: "credit_card",
2576
+ iban: "GB33BUKB20201555555555",
2577
+ bic: "CHASUS33",
2578
+ routingNumber: "021000021",
2579
+ bsbNumber: "062-001",
2580
+ branchIdentifier: "001",
2581
+ bankCode: "BNH",
2582
+ currency: "USD",
2583
+ country: "US",
2584
+ },
2585
+ customFields: [
2586
+ {
2587
+ id: "2389328923893298",
2588
+ name: "employee_level",
2589
+ description: "Employee Level",
2590
+ value: "Uses Salesforce and Marketo",
2591
+ },
2592
+ ],
2593
+ rowVersion: "1-12345",
2594
+ passThrough: [
2595
+ {
2596
+ serviceId: "<id>",
2597
+ extendPaths: [
2598
+ {
2599
+ path: "$.nested.property",
2600
+ value: {
2601
+ "TaxClassificationRef": {
2602
+ "value": "EUC-99990201-V1-00020000",
2603
+ },
2604
+ },
2605
+ },
2606
+ ],
2607
+ },
2608
+ ],
2609
+ },
2610
+ });
2611
+ expect(result.httpMeta.response.status).toBe(201);
2612
+ expect(result.createAccountingEmployeeResponse).toBeDefined();
2613
+ expect(result.createAccountingEmployeeResponse).toEqual({
2614
+ statusCode: 200,
2615
+ status: "OK",
2616
+ service: "quickbooks",
2617
+ resource: "Employees",
2618
+ operation: "add",
2619
+ data: {
2620
+ id: "12345",
2621
+ },
2622
+ });
2623
+ });
2624
+
2625
+ test("Employees Accounting Employees One", async () => {
2626
+ const testHttpClient = createTestHTTPClient("accounting.employeesOne");
2627
+
2628
+ const apideck = new Apideck({
2629
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
2630
+ httpClient: testHttpClient,
2631
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
2632
+ });
2633
+
2634
+ const result = await apideck.accounting.employees.get({
2635
+ id: "<id>",
2636
+ consumerId: "test-consumer",
2637
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
2638
+ serviceId: "salesforce",
2639
+ fields: "id,updated_at",
2640
+ });
2641
+ expect(result.httpMeta.response.status).toBe(200);
2642
+ expect(result.getAccountingEmployeeResponse).toBeDefined();
2643
+ expect(result.getAccountingEmployeeResponse).toEqual({
2644
+ statusCode: 200,
2645
+ status: "OK",
2646
+ service: "quickbooks",
2647
+ resource: "Employees",
2648
+ operation: "one",
2649
+ data: {
2650
+ id: "12345",
2651
+ downstreamId: "12345",
2652
+ displayId: "123456",
2653
+ firstName: "John",
2654
+ lastName: "Doe",
2655
+ displayName: "John Doe",
2656
+ emails: [
2657
+ {
2658
+ id: "123",
2659
+ email: "elon@musk.com",
2660
+ type: "primary",
2661
+ },
2662
+ ],
2663
+ employeeNumber: "EMP-001",
2664
+ jobTitle: "Senior Accountant",
2665
+ status: "active",
2666
+ isContractor: false,
2667
+ department: {
2668
+ id: "12345",
2669
+ displayId: "123456",
2670
+ name: "Acme Inc.",
2671
+ downstreamId: "12345",
2672
+ },
2673
+ location: {
2674
+ id: "123456",
2675
+ displayId: "123456",
2676
+ name: "New York Office",
2677
+ downstreamId: "12345",
2678
+ },
2679
+ manager: {
2680
+ id: "12345",
2681
+ name: "Jane Smith",
2682
+ },
2683
+ hireDate: new Date("2020-01-15"),
2684
+ terminationDate: new Date("2025-12-31"),
2685
+ gender: "male",
2686
+ birthDate: new Date("1990-05-20"),
2687
+ subsidiary: {
2688
+ id: "12345",
2689
+ displayId: "123456",
2690
+ name: "Acme Inc.",
2691
+ },
2692
+ trackingCategories: [
2693
+ {
2694
+ id: "123456",
2695
+ code: "100",
2696
+ name: "New York",
2697
+ parentId: "123456",
2698
+ parentName: "New York",
2699
+ },
2700
+ ],
2701
+ currency: "USD",
2702
+ notes: "Some notes about this employee",
2703
+ addresses: [
2704
+ {
2705
+ id: "123",
2706
+ type: "primary",
2707
+ string: "25 Spring Street, Blackburn, VIC 3130",
2708
+ name: "HQ US",
2709
+ line1: "Main street",
2710
+ line2: "apt #",
2711
+ line3: "Suite #",
2712
+ line4: "delivery instructions",
2713
+ line5: "Attention: Finance Dept",
2714
+ streetNumber: "25",
2715
+ city: "San Francisco",
2716
+ state: "CA",
2717
+ postalCode: "94104",
2718
+ country: "US",
2719
+ latitude: "40.759211",
2720
+ longitude: "-73.984638",
2721
+ county: "Santa Clara",
2722
+ contactName: "Elon Musk",
2723
+ salutation: "Mr",
2724
+ phoneNumber: "111-111-1111",
2725
+ fax: "122-111-1111",
2726
+ email: "elon@musk.com",
2727
+ website: "https://elonmusk.com",
2728
+ notes: "Address notes or delivery instructions.",
2729
+ rowVersion: "1-12345",
2730
+ },
2731
+ ],
2732
+ phoneNumbers: [
2733
+ {
2734
+ id: "12345",
2735
+ countryCode: "1",
2736
+ areaCode: "323",
2737
+ number: "111-111-1111",
2738
+ extension: "105",
2739
+ type: "primary",
2740
+ },
2741
+ ],
2742
+ bankAccount: {
2743
+ bankName: "Chase Bank",
2744
+ accountNumber: "123465",
2745
+ accountName: "Main Operating Account",
2746
+ accountType: "credit_card",
2747
+ iban: "GB33BUKB20201555555555",
2748
+ bic: "CHASUS33",
2749
+ routingNumber: "021000021",
2750
+ bsbNumber: "062-001",
2751
+ branchIdentifier: "001",
2752
+ bankCode: "BNH",
2753
+ currency: "USD",
2754
+ country: "US",
2755
+ },
2756
+ customFields: [
2757
+ {
2758
+ id: "2389328923893298",
2759
+ name: "employee_level",
2760
+ description: "Employee Level",
2761
+ value: "Uses Salesforce and Marketo",
2762
+ },
2763
+ ],
2764
+ rowVersion: "1-12345",
2765
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
2766
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
2767
+ passThrough: [
2768
+ {
2769
+ serviceId: "<id>",
2770
+ extendPaths: [
2771
+ {
2772
+ path: "$.nested.property",
2773
+ value: {
2774
+ "TaxClassificationRef": {
2775
+ "value": "EUC-99990201-V1-00020000",
2776
+ },
2777
+ },
2778
+ },
2779
+ ],
2780
+ },
2781
+ ],
2782
+ },
2783
+ });
2784
+ });
2785
+
2786
+ test("Employees Accounting Employees Update", async () => {
2787
+ const testHttpClient = createTestHTTPClient("accounting.employeesUpdate");
2788
+
2789
+ const apideck = new Apideck({
2790
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
2791
+ httpClient: testHttpClient,
2792
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
2793
+ });
2794
+
2795
+ const result = await apideck.accounting.employees.update({
2796
+ id: "<id>",
2797
+ consumerId: "test-consumer",
2798
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
2799
+ serviceId: "salesforce",
2800
+ accountingEmployee: {
2801
+ displayId: "123456",
2802
+ firstName: "John",
2803
+ lastName: "Doe",
2804
+ displayName: "John Doe",
2805
+ emails: [
2806
+ {
2807
+ id: "123",
2808
+ email: "elon@musk.com",
2809
+ type: "primary",
2810
+ },
2811
+ ],
2812
+ employeeNumber: "EMP-001",
2813
+ jobTitle: "Senior Accountant",
2814
+ status: "active",
2815
+ isContractor: false,
2816
+ department: {
2817
+ displayId: "123456",
2818
+ name: "Acme Inc.",
2819
+ },
2820
+ location: {
2821
+ id: "123456",
2822
+ displayId: "123456",
2823
+ name: "New York Office",
2824
+ },
2825
+ manager: {
2826
+ id: "12345",
2827
+ name: "Jane Smith",
2828
+ },
2829
+ hireDate: new Date("2020-01-15"),
2830
+ terminationDate: new Date("2025-12-31"),
2831
+ gender: "male",
2832
+ birthDate: new Date("1990-05-20"),
2833
+ subsidiary: {
2834
+ displayId: "123456",
2835
+ name: "Acme Inc.",
2836
+ },
2837
+ trackingCategories: [
2838
+ {
2839
+ id: "123456",
2840
+ code: "100",
2841
+ name: "New York",
2842
+ parentId: "123456",
2843
+ parentName: "New York",
2844
+ },
2845
+ ],
2846
+ currency: "USD",
2847
+ notes: "Some notes about this employee",
2848
+ addresses: [
2849
+ {
2850
+ id: "123",
2851
+ type: "primary",
2852
+ string: "25 Spring Street, Blackburn, VIC 3130",
2853
+ name: "HQ US",
2854
+ line1: "Main street",
2855
+ line2: "apt #",
2856
+ line3: "Suite #",
2857
+ line4: "delivery instructions",
2858
+ line5: "Attention: Finance Dept",
2859
+ streetNumber: "25",
2860
+ city: "San Francisco",
2861
+ state: "CA",
2862
+ postalCode: "94104",
2863
+ country: "US",
2864
+ latitude: "40.759211",
2865
+ longitude: "-73.984638",
2866
+ county: "Santa Clara",
2867
+ contactName: "Elon Musk",
2868
+ salutation: "Mr",
2869
+ phoneNumber: "111-111-1111",
2870
+ fax: "122-111-1111",
2871
+ email: "elon@musk.com",
2872
+ website: "https://elonmusk.com",
2873
+ notes: "Address notes or delivery instructions.",
2874
+ rowVersion: "1-12345",
2875
+ },
2876
+ ],
2877
+ phoneNumbers: [
2878
+ {
2879
+ id: "12345",
2880
+ countryCode: "1",
2881
+ areaCode: "323",
2882
+ number: "111-111-1111",
2883
+ extension: "105",
2884
+ type: "primary",
2885
+ },
2886
+ ],
2887
+ bankAccount: {
2888
+ bankName: "Chase Bank",
2889
+ accountNumber: "123465",
2890
+ accountName: "Main Operating Account",
2891
+ accountType: "credit_card",
2892
+ iban: "GB33BUKB20201555555555",
2893
+ bic: "CHASUS33",
2894
+ routingNumber: "021000021",
2895
+ bsbNumber: "062-001",
2896
+ branchIdentifier: "001",
2897
+ bankCode: "BNH",
2898
+ currency: "USD",
2899
+ country: "US",
2900
+ },
2901
+ customFields: [
2902
+ {
2903
+ id: "2389328923893298",
2904
+ name: "employee_level",
2905
+ description: "Employee Level",
2906
+ value: "Uses Salesforce and Marketo",
2907
+ },
2908
+ ],
2909
+ rowVersion: "1-12345",
2910
+ passThrough: [
2911
+ {
2912
+ serviceId: "<id>",
2913
+ extendPaths: [
2914
+ {
2915
+ path: "$.nested.property",
2916
+ value: {
2917
+ "TaxClassificationRef": {
2918
+ "value": "EUC-99990201-V1-00020000",
2919
+ },
2920
+ },
2921
+ },
2922
+ ],
2923
+ },
2924
+ ],
2925
+ },
2926
+ });
2927
+ expect(result.httpMeta.response.status).toBe(200);
2928
+ expect(result.updateAccountingEmployeeResponse).toBeDefined();
2929
+ expect(result.updateAccountingEmployeeResponse).toEqual({
2930
+ statusCode: 200,
2931
+ status: "OK",
2932
+ service: "quickbooks",
2933
+ resource: "Employees",
2934
+ operation: "update",
2935
+ data: {
2936
+ id: "12345",
2937
+ },
2938
+ });
2939
+ });
2940
+
2941
+ test("Employees Accounting Employees Delete", async () => {
2942
+ const testHttpClient = createTestHTTPClient("accounting.employeesDelete");
2943
+
2944
+ const apideck = new Apideck({
2945
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
2946
+ httpClient: testHttpClient,
2947
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
2948
+ });
2949
+
2950
+ const result = await apideck.accounting.employees.delete({
2951
+ id: "<id>",
2952
+ consumerId: "test-consumer",
2953
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
2954
+ serviceId: "salesforce",
2955
+ });
2956
+ expect(result.httpMeta.response.status).toBe(200);
2957
+ expect(result.deleteAccountingEmployeeResponse).toBeDefined();
2958
+ expect(result.deleteAccountingEmployeeResponse).toEqual({
2959
+ statusCode: 200,
2960
+ status: "OK",
2961
+ service: "quickbooks",
2962
+ resource: "Employees",
2963
+ operation: "delete",
2964
+ data: {
2965
+ id: "12345",
2966
+ },
2967
+ });
2968
+ });