/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { expect, test } from "vitest"; import { Apideck } from "../index.js"; import { createTestHTTPClient } from "./testclient.js"; test("Employees Hris Employees All", async () => { const testHttpClient = createTestHTTPClient("hris.employeesAll"); const apideck = new Apideck({ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080", httpClient: testHttpClient, apiKey: process.env["APIDECK_API_KEY"] ?? "value", }); const result = await apideck.hris.employees.list({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", filter: { companyId: "1234", email: "elon@tesla.com", firstName: "Elon", title: "Manager", lastName: "Musk", managerId: "1234", employmentStatus: "active", employeeNumber: "123456-AB", departmentId: "1234", city: "San Francisco", country: "US", }, sort: { by: "created_at", direction: "desc", }, passThrough: { "search": "San Francisco", }, fields: "id,updated_at", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getEmployeesResponse).toBeDefined(); expect(result.getEmployeesResponse).toEqual({ statusCode: 200, status: "OK", service: "sage-hr", resource: "Employees", operation: "all", data: [ { id: "12345", downstreamId: "12345", firstName: "Elon", lastName: "Musk", middleName: "D.", displayName: "Technoking", preferredName: "Elon Musk", initials: "EM", salutation: "Mr", title: "CEO", maritalStatus: "married", partner: { id: "12345", firstName: "Elon", lastName: "Musk", middleName: "D.", gender: "male", initials: "EM", birthday: new Date("2000-08-12"), deceasedOn: new Date("2000-08-12"), }, division: "Europe", divisionId: "12345", departmentId: "12345", departmentName: "12345", team: { id: "1234", name: "Full Stack Engineers", }, companyId: "23456", companyName: "SpaceX", employmentStartDate: "2021-10-26", employmentEndDate: "2028-10-26", leavingReason: "resigned", employeeNumber: "123456-AB", employmentStatus: "active", ethnicity: "African American", manager: { id: "12345", name: "Elon Musk", firstName: "Elon", lastName: "Musk", email: "elon@musk.com", employmentStatus: "active", }, directReports: [ "a0d636c6-43b3-4bde-8c70-85b707d992f4", "a98lfd96-43b3-4bde-8c70-85b707d992e6", ], socialSecurityNumber: "123456789", birthday: new Date("2000-08-12"), deceasedOn: new Date("2000-08-12"), countryOfBirth: "US", description: "A description", gender: "male", pronouns: "she,her", preferredLanguage: "EN", languages: [ "EN", ], nationalities: [ "US", ], photoUrl: "https://unavatar.io/elon-musk", timezone: "Europe/London", source: "lever", sourceId: "12345", recordUrl: "https://app.intercom.io/contacts/12345", jobs: [ { id: "12345", employeeId: "12345", title: "CEO", role: "Sales", startDate: new Date("2020-08-12"), endDate: new Date("2020-08-12"), compensationRate: 72000, currency: "USD", paymentUnit: "year", hiredAt: new Date("2020-08-12"), isPrimary: true, isManager: true, status: "active", location: { id: "123", type: "primary", string: "25 Spring Street, Blackburn, VIC 3130", name: "HQ US", line1: "Main street", line2: "apt #", line3: "Suite #", line4: "delivery instructions", streetNumber: "25", city: "San Francisco", state: "CA", postalCode: "94104", country: "US", latitude: "40.759211", longitude: "-73.984638", county: "Santa Clara", contactName: "Elon Musk", salutation: "Mr", phoneNumber: "111-111-1111", fax: "122-111-1111", email: "elon@musk.com", website: "https://elonmusk.com", notes: "Address notes or delivery instructions.", rowVersion: "1-12345", }, }, { id: "12345", employeeId: "12345", title: "CEO", role: "Sales", startDate: new Date("2020-08-12"), endDate: new Date("2020-08-12"), compensationRate: 72000, currency: "USD", paymentUnit: "year", hiredAt: new Date("2020-08-12"), isPrimary: true, isManager: true, status: "active", location: { id: "123", type: "primary", string: "25 Spring Street, Blackburn, VIC 3130", name: "HQ US", line1: "Main street", line2: "apt #", line3: "Suite #", line4: "delivery instructions", streetNumber: "25", city: "San Francisco", state: "CA", postalCode: "94104", country: "US", latitude: "40.759211", longitude: "-73.984638", county: "Santa Clara", contactName: "Elon Musk", salutation: "Mr", phoneNumber: "111-111-1111", fax: "122-111-1111", email: "elon@musk.com", website: "https://elonmusk.com", notes: "Address notes or delivery instructions.", rowVersion: "1-12345", }, }, ], compensations: [ { id: "3404301363494309004", jobId: "3490439050957906679", rate: 50, paymentUnit: "hour", flsaStatus: "nonexempt", effectiveDate: "2021-06-11", }, ], worksRemote: true, addresses: [ { id: "123", type: "primary", string: "25 Spring Street, Blackburn, VIC 3130", name: "HQ US", line1: "Main street", line2: "apt #", line3: "Suite #", line4: "delivery instructions", streetNumber: "25", city: "San Francisco", state: "CA", postalCode: "94104", country: "US", latitude: "40.759211", longitude: "-73.984638", county: "Santa Clara", contactName: "Elon Musk", salutation: "Mr", phoneNumber: "111-111-1111", fax: "122-111-1111", email: "elon@musk.com", website: "https://elonmusk.com", notes: "Address notes or delivery instructions.", rowVersion: "1-12345", }, { id: "123", type: "primary", string: "25 Spring Street, Blackburn, VIC 3130", name: "HQ US", line1: "Main street", line2: "apt #", line3: "Suite #", line4: "delivery instructions", streetNumber: "25", city: "San Francisco", state: "CA", postalCode: "94104", country: "US", latitude: "40.759211", longitude: "-73.984638", county: "Santa Clara", contactName: "Elon Musk", salutation: "Mr", phoneNumber: "111-111-1111", fax: "122-111-1111", email: "elon@musk.com", website: "https://elonmusk.com", notes: "Address notes or delivery instructions.", rowVersion: "1-12345", }, { id: "123", type: "primary", string: "25 Spring Street, Blackburn, VIC 3130", name: "HQ US", line1: "Main street", line2: "apt #", line3: "Suite #", line4: "delivery instructions", streetNumber: "25", city: "San Francisco", state: "CA", postalCode: "94104", country: "US", latitude: "40.759211", longitude: "-73.984638", county: "Santa Clara", contactName: "Elon Musk", salutation: "Mr", phoneNumber: "111-111-1111", fax: "122-111-1111", email: "elon@musk.com", website: "https://elonmusk.com", notes: "Address notes or delivery instructions.", rowVersion: "1-12345", }, ], phoneNumbers: [ { id: "12345", countryCode: "1", areaCode: "323", number: "111-111-1111", extension: "105", type: "primary", }, ], emails: [ { id: "123", email: "elon@musk.com", type: "primary", }, ], customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: {}, }, ], socialLinks: [ { id: "12345", url: "https://www.twitter.com/apideck", type: "twitter", }, { id: "12345", url: "https://www.twitter.com/apideck", type: "twitter", }, ], bankAccounts: [ { bankName: "Monzo", accountNumber: "123465", accountName: "SPACEX LLC", accountType: "credit_card", iban: "CH2989144532982975332", bic: "AUDSCHGGXXX", routingNumber: "012345678", bsbNumber: "062-001", branchIdentifier: "001", bankCode: "BNH", currency: "USD", }, ], taxCode: "1111", taxId: "234-32-0000", dietaryPreference: "Veggie", foodAllergies: [ "No allergies", ], probationPeriod: { startDate: new Date("2021-10-01"), endDate: new Date("2021-11-28"), }, tags: [ "New", ], rowVersion: "1-12345", deleted: true, updatedBy: "12345", createdBy: "12345", updatedAt: new Date("2020-09-30T07:43:32.000Z"), createdAt: new Date("2020-09-30T07:43:32.000Z"), passThrough: [ { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, ], }, { id: "12345", downstreamId: "12345", firstName: "Elon", lastName: "Musk", middleName: "D.", displayName: "Technoking", preferredName: "Elon Musk", initials: "EM", salutation: "Mr", title: "CEO", maritalStatus: "married", partner: { id: "12345", firstName: "Elon", lastName: "Musk", middleName: "D.", gender: "male", initials: "EM", birthday: new Date("2000-08-12"), deceasedOn: new Date("2000-08-12"), }, division: "Europe", divisionId: "12345", departmentId: "12345", departmentName: "12345", team: { id: "1234", name: "Full Stack Engineers", }, companyId: "23456", companyName: "SpaceX", employmentStartDate: "2021-10-26", employmentEndDate: "2028-10-26", leavingReason: "resigned", employeeNumber: "123456-AB", employmentStatus: "active", ethnicity: "African American", manager: { id: "12345", name: "Elon Musk", firstName: "Elon", lastName: "Musk", email: "elon@musk.com", employmentStatus: "active", }, directReports: [ "a0d636c6-43b3-4bde-8c70-85b707d992f4", "a98lfd96-43b3-4bde-8c70-85b707d992e6", ], socialSecurityNumber: "123456789", birthday: new Date("2000-08-12"), deceasedOn: new Date("2000-08-12"), countryOfBirth: "US", description: "A description", gender: "male", pronouns: "she,her", preferredLanguage: "EN", languages: [ "EN", ], nationalities: [ "US", ], photoUrl: "https://unavatar.io/elon-musk", timezone: "Europe/London", source: "lever", sourceId: "12345", recordUrl: "https://app.intercom.io/contacts/12345", jobs: [ { id: "12345", employeeId: "12345", title: "CEO", role: "Sales", startDate: new Date("2020-08-12"), endDate: new Date("2020-08-12"), compensationRate: 72000, currency: "USD", paymentUnit: "year", hiredAt: new Date("2020-08-12"), isPrimary: true, isManager: true, status: "active", location: { id: "123", type: "primary", string: "25 Spring Street, Blackburn, VIC 3130", name: "HQ US", line1: "Main street", line2: "apt #", line3: "Suite #", line4: "delivery instructions", streetNumber: "25", city: "San Francisco", state: "CA", postalCode: "94104", country: "US", latitude: "40.759211", longitude: "-73.984638", county: "Santa Clara", contactName: "Elon Musk", salutation: "Mr", phoneNumber: "111-111-1111", fax: "122-111-1111", email: "elon@musk.com", website: "https://elonmusk.com", notes: "Address notes or delivery instructions.", rowVersion: "1-12345", }, }, { id: "12345", employeeId: "12345", title: "CEO", role: "Sales", startDate: new Date("2020-08-12"), endDate: new Date("2020-08-12"), compensationRate: 72000, currency: "USD", paymentUnit: "year", hiredAt: new Date("2020-08-12"), isPrimary: true, isManager: true, status: "active", location: { id: "123", type: "primary", string: "25 Spring Street, Blackburn, VIC 3130", name: "HQ US", line1: "Main street", line2: "apt #", line3: "Suite #", line4: "delivery instructions", streetNumber: "25", city: "San Francisco", state: "CA", postalCode: "94104", country: "US", latitude: "40.759211", longitude: "-73.984638", county: "Santa Clara", contactName: "Elon Musk", salutation: "Mr", phoneNumber: "111-111-1111", fax: "122-111-1111", email: "elon@musk.com", website: "https://elonmusk.com", notes: "Address notes or delivery instructions.", rowVersion: "1-12345", }, }, ], compensations: [ { id: "3404301363494309004", jobId: "3490439050957906679", rate: 50, paymentUnit: "hour", flsaStatus: "nonexempt", effectiveDate: "2021-06-11", }, ], worksRemote: true, addresses: [ { id: "123", type: "primary", string: "25 Spring Street, Blackburn, VIC 3130", name: "HQ US", line1: "Main street", line2: "apt #", line3: "Suite #", line4: "delivery instructions", streetNumber: "25", city: "San Francisco", state: "CA", postalCode: "94104", country: "US", latitude: "40.759211", longitude: "-73.984638", county: "Santa Clara", contactName: "Elon Musk", salutation: "Mr", phoneNumber: "111-111-1111", fax: "122-111-1111", email: "elon@musk.com", website: "https://elonmusk.com", notes: "Address notes or delivery instructions.", rowVersion: "1-12345", }, { id: "123", type: "primary", string: "25 Spring Street, Blackburn, VIC 3130", name: "HQ US", line1: "Main street", line2: "apt #", line3: "Suite #", line4: "delivery instructions", streetNumber: "25", city: "San Francisco", state: "CA", postalCode: "94104", country: "US", latitude: "40.759211", longitude: "-73.984638", county: "Santa Clara", contactName: "Elon Musk", salutation: "Mr", phoneNumber: "111-111-1111", fax: "122-111-1111", email: "elon@musk.com", website: "https://elonmusk.com", notes: "Address notes or delivery instructions.", rowVersion: "1-12345", }, ], phoneNumbers: [ { id: "12345", countryCode: "1", areaCode: "323", number: "111-111-1111", extension: "105", type: "primary", }, ], emails: [ { id: "123", email: "elon@musk.com", type: "primary", }, ], customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: true, }, { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: "Uses Salesforce and Marketo", }, ], socialLinks: [ { id: "12345", url: "https://www.twitter.com/apideck", type: "twitter", }, { id: "12345", url: "https://www.twitter.com/apideck", type: "twitter", }, { id: "12345", url: "https://www.twitter.com/apideck", type: "twitter", }, ], bankAccounts: [ { bankName: "Monzo", accountNumber: "123465", accountName: "SPACEX LLC", accountType: "credit_card", iban: "CH2989144532982975332", bic: "AUDSCHGGXXX", routingNumber: "012345678", bsbNumber: "062-001", branchIdentifier: "001", bankCode: "BNH", currency: "USD", }, { bankName: "Monzo", accountNumber: "123465", accountName: "SPACEX LLC", accountType: "credit_card", iban: "CH2989144532982975332", bic: "AUDSCHGGXXX", routingNumber: "012345678", bsbNumber: "062-001", branchIdentifier: "001", bankCode: "BNH", currency: "USD", }, ], taxCode: "1111", taxId: "234-32-0000", dietaryPreference: "Veggie", foodAllergies: [ "No allergies", ], probationPeriod: { startDate: new Date("2021-10-01"), endDate: new Date("2021-11-28"), }, tags: [ "New", ], rowVersion: "1-12345", deleted: true, updatedBy: "12345", createdBy: "12345", updatedAt: new Date("2020-09-30T07:43:32.000Z"), createdAt: new Date("2020-09-30T07:43:32.000Z"), passThrough: [ { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, ], }, { id: "12345", downstreamId: "12345", firstName: "Elon", lastName: "Musk", middleName: "D.", displayName: "Technoking", preferredName: "Elon Musk", initials: "EM", salutation: "Mr", title: "CEO", maritalStatus: "married", partner: { id: "12345", firstName: "Elon", lastName: "Musk", middleName: "D.", gender: "male", initials: "EM", birthday: new Date("2000-08-12"), deceasedOn: new Date("2000-08-12"), }, division: "Europe", divisionId: "12345", departmentId: "12345", departmentName: "12345", team: { id: "1234", name: "Full Stack Engineers", }, companyId: "23456", companyName: "SpaceX", employmentStartDate: "2021-10-26", employmentEndDate: "2028-10-26", leavingReason: "resigned", employeeNumber: "123456-AB", employmentStatus: "active", ethnicity: "African American", manager: { id: "12345", name: "Elon Musk", firstName: "Elon", lastName: "Musk", email: "elon@musk.com", employmentStatus: "active", }, directReports: [ "a0d636c6-43b3-4bde-8c70-85b707d992f4", "a98lfd96-43b3-4bde-8c70-85b707d992e6", ], socialSecurityNumber: "123456789", birthday: new Date("2000-08-12"), deceasedOn: new Date("2000-08-12"), countryOfBirth: "US", description: "A description", gender: "male", pronouns: "she,her", preferredLanguage: "EN", languages: [ "EN", ], nationalities: [ "US", ], photoUrl: "https://unavatar.io/elon-musk", timezone: "Europe/London", source: "lever", sourceId: "12345", recordUrl: "https://app.intercom.io/contacts/12345", jobs: [ { id: "12345", employeeId: "12345", title: "CEO", role: "Sales", startDate: new Date("2020-08-12"), endDate: new Date("2020-08-12"), compensationRate: 72000, currency: "USD", paymentUnit: "year", hiredAt: new Date("2020-08-12"), isPrimary: true, isManager: true, status: "active", location: { id: "123", type: "primary", string: "25 Spring Street, Blackburn, VIC 3130", name: "HQ US", line1: "Main street", line2: "apt #", line3: "Suite #", line4: "delivery instructions", streetNumber: "25", city: "San Francisco", state: "CA", postalCode: "94104", country: "US", latitude: "40.759211", longitude: "-73.984638", county: "Santa Clara", contactName: "Elon Musk", salutation: "Mr", phoneNumber: "111-111-1111", fax: "122-111-1111", email: "elon@musk.com", website: "https://elonmusk.com", notes: "Address notes or delivery instructions.", rowVersion: "1-12345", }, }, { id: "12345", employeeId: "12345", title: "CEO", role: "Sales", startDate: new Date("2020-08-12"), endDate: new Date("2020-08-12"), compensationRate: 72000, currency: "USD", paymentUnit: "year", hiredAt: new Date("2020-08-12"), isPrimary: true, isManager: true, status: "active", location: { id: "123", type: "primary", string: "25 Spring Street, Blackburn, VIC 3130", name: "HQ US", line1: "Main street", line2: "apt #", line3: "Suite #", line4: "delivery instructions", streetNumber: "25", city: "San Francisco", state: "CA", postalCode: "94104", country: "US", latitude: "40.759211", longitude: "-73.984638", county: "Santa Clara", contactName: "Elon Musk", salutation: "Mr", phoneNumber: "111-111-1111", fax: "122-111-1111", email: "elon@musk.com", website: "https://elonmusk.com", notes: "Address notes or delivery instructions.", rowVersion: "1-12345", }, }, { id: "12345", employeeId: "12345", title: "CEO", role: "Sales", startDate: new Date("2020-08-12"), endDate: new Date("2020-08-12"), compensationRate: 72000, currency: "USD", paymentUnit: "year", hiredAt: new Date("2020-08-12"), isPrimary: true, isManager: true, status: "active", location: { id: "123", type: "primary", string: "25 Spring Street, Blackburn, VIC 3130", name: "HQ US", line1: "Main street", line2: "apt #", line3: "Suite #", line4: "delivery instructions", streetNumber: "25", city: "San Francisco", state: "CA", postalCode: "94104", country: "US", latitude: "40.759211", longitude: "-73.984638", county: "Santa Clara", contactName: "Elon Musk", salutation: "Mr", phoneNumber: "111-111-1111", fax: "122-111-1111", email: "elon@musk.com", website: "https://elonmusk.com", notes: "Address notes or delivery instructions.", rowVersion: "1-12345", }, }, ], compensations: [ { id: "3404301363494309004", jobId: "3490439050957906679", rate: 50, paymentUnit: "hour", flsaStatus: "nonexempt", effectiveDate: "2021-06-11", }, ], worksRemote: true, addresses: [ { id: "123", type: "primary", string: "25 Spring Street, Blackburn, VIC 3130", name: "HQ US", line1: "Main street", line2: "apt #", line3: "Suite #", line4: "delivery instructions", streetNumber: "25", city: "San Francisco", state: "CA", postalCode: "94104", country: "US", latitude: "40.759211", longitude: "-73.984638", county: "Santa Clara", contactName: "Elon Musk", salutation: "Mr", phoneNumber: "111-111-1111", fax: "122-111-1111", email: "elon@musk.com", website: "https://elonmusk.com", notes: "Address notes or delivery instructions.", rowVersion: "1-12345", }, ], phoneNumbers: [ { id: "12345", countryCode: "1", areaCode: "323", number: "111-111-1111", extension: "105", type: "primary", }, { id: "12345", countryCode: "1", areaCode: "323", number: "111-111-1111", extension: "105", type: "primary", }, { id: "12345", countryCode: "1", areaCode: "323", number: "111-111-1111", extension: "105", type: "primary", }, ], emails: [ { id: "123", email: "elon@musk.com", type: "primary", }, { id: "123", email: "elon@musk.com", type: "primary", }, ], customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: 10, }, { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: "Uses Salesforce and Marketo", }, { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: {}, }, ], socialLinks: [ { id: "12345", url: "https://www.twitter.com/apideck", type: "twitter", }, { id: "12345", url: "https://www.twitter.com/apideck", type: "twitter", }, ], bankAccounts: [ { bankName: "Monzo", accountNumber: "123465", accountName: "SPACEX LLC", accountType: "credit_card", iban: "CH2989144532982975332", bic: "AUDSCHGGXXX", routingNumber: "012345678", bsbNumber: "062-001", branchIdentifier: "001", bankCode: "BNH", currency: "USD", }, { bankName: "Monzo", accountNumber: "123465", accountName: "SPACEX LLC", accountType: "credit_card", iban: "CH2989144532982975332", bic: "AUDSCHGGXXX", routingNumber: "012345678", bsbNumber: "062-001", branchIdentifier: "001", bankCode: "BNH", currency: "USD", }, ], taxCode: "1111", taxId: "234-32-0000", dietaryPreference: "Veggie", foodAllergies: [ "No allergies", ], probationPeriod: { startDate: new Date("2021-10-01"), endDate: new Date("2021-11-28"), }, tags: [ "New", ], rowVersion: "1-12345", deleted: true, updatedBy: "12345", createdBy: "12345", updatedAt: new Date("2020-09-30T07:43:32.000Z"), createdAt: new Date("2020-09-30T07:43:32.000Z"), passThrough: [ { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, ], }, ], meta: { itemsOnPage: 50, cursors: { previous: "em9oby1jcm06OnBhZ2U6OjE=", current: "em9oby1jcm06OnBhZ2U6OjI=", next: "em9oby1jcm06OnBhZ2U6OjM=", }, }, links: { previous: "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjE%3D", current: "https://unify.apideck.com/crm/companies", next: "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjM", }, }); }); test("Employees Hris Employees Add", async () => { const testHttpClient = createTestHTTPClient("hris.employeesAdd"); const apideck = new Apideck({ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080", httpClient: testHttpClient, apiKey: process.env["APIDECK_API_KEY"] ?? "value", }); const result = await apideck.hris.employees.create({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", employee: { id: "12345", firstName: "Elon", lastName: "Musk", middleName: "D.", displayName: "Technoking", preferredName: "Elon Musk", initials: "EM", salutation: "Mr", title: "CEO", maritalStatus: "married", partner: { firstName: "Elon", lastName: "Musk", middleName: "D.", gender: "male", initials: "EM", birthday: new Date("2000-08-12"), deceasedOn: new Date("2000-08-12"), }, division: "Europe", divisionId: "12345", departmentId: "12345", departmentName: "12345", team: { id: "1234", name: "Full Stack Engineers", }, companyId: "23456", companyName: "SpaceX", employmentStartDate: "2021-10-26", employmentEndDate: "2028-10-26", leavingReason: "resigned", employeeNumber: "123456-AB", employmentStatus: "active", ethnicity: "African American", manager: { id: "12345", name: "Elon Musk", firstName: "Elon", lastName: "Musk", email: "elon@musk.com", employmentStatus: "active", }, directReports: [ "a0d636c6-43b3-4bde-8c70-85b707d992f4", "a98lfd96-43b3-4bde-8c70-85b707d992e6", ], socialSecurityNumber: "123456789", birthday: new Date("2000-08-12"), deceasedOn: new Date("2000-08-12"), countryOfBirth: "US", description: "A description", gender: "male", pronouns: "she,her", preferredLanguage: "EN", languages: [ "EN", ], nationalities: [ "US", ], photoUrl: "https://unavatar.io/elon-musk", timezone: "Europe/London", source: "lever", sourceId: "12345", recordUrl: "https://app.intercom.io/contacts/12345", jobs: [ { title: "CEO", role: "Sales", startDate: new Date("2020-08-12"), endDate: new Date("2020-08-12"), compensationRate: 72000, currency: "USD", paymentUnit: "year", hiredAt: new Date("2020-08-12"), isPrimary: true, isManager: true, status: "active", location: { id: "123", type: "primary", string: "25 Spring Street, Blackburn, VIC 3130", name: "HQ US", line1: "Main street", line2: "apt #", line3: "Suite #", line4: "delivery instructions", streetNumber: "25", city: "San Francisco", state: "CA", postalCode: "94104", country: "US", latitude: "40.759211", longitude: "-73.984638", county: "Santa Clara", contactName: "Elon Musk", salutation: "Mr", phoneNumber: "111-111-1111", fax: "122-111-1111", email: "elon@musk.com", website: "https://elonmusk.com", notes: "Address notes or delivery instructions.", rowVersion: "1-12345", }, }, { title: "CEO", role: "Sales", startDate: new Date("2020-08-12"), endDate: new Date("2020-08-12"), compensationRate: 72000, currency: "USD", paymentUnit: "year", hiredAt: new Date("2020-08-12"), isPrimary: true, isManager: true, status: "active", location: { id: "123", type: "primary", string: "25 Spring Street, Blackburn, VIC 3130", name: "HQ US", line1: "Main street", line2: "apt #", line3: "Suite #", line4: "delivery instructions", streetNumber: "25", city: "San Francisco", state: "CA", postalCode: "94104", country: "US", latitude: "40.759211", longitude: "-73.984638", county: "Santa Clara", contactName: "Elon Musk", salutation: "Mr", phoneNumber: "111-111-1111", fax: "122-111-1111", email: "elon@musk.com", website: "https://elonmusk.com", notes: "Address notes or delivery instructions.", rowVersion: "1-12345", }, }, ], compensations: [ { rate: 50, paymentUnit: "hour", flsaStatus: "nonexempt", effectiveDate: "2021-06-11", }, ], worksRemote: true, addresses: [ { id: "123", type: "primary", string: "25 Spring Street, Blackburn, VIC 3130", name: "HQ US", line1: "Main street", line2: "apt #", line3: "Suite #", line4: "delivery instructions", streetNumber: "25", city: "San Francisco", state: "CA", postalCode: "94104", country: "US", latitude: "40.759211", longitude: "-73.984638", county: "Santa Clara", contactName: "Elon Musk", salutation: "Mr", phoneNumber: "111-111-1111", fax: "122-111-1111", email: "elon@musk.com", website: "https://elonmusk.com", notes: "Address notes or delivery instructions.", rowVersion: "1-12345", }, { id: "123", type: "primary", string: "25 Spring Street, Blackburn, VIC 3130", name: "HQ US", line1: "Main street", line2: "apt #", line3: "Suite #", line4: "delivery instructions", streetNumber: "25", city: "San Francisco", state: "CA", postalCode: "94104", country: "US", latitude: "40.759211", longitude: "-73.984638", county: "Santa Clara", contactName: "Elon Musk", salutation: "Mr", phoneNumber: "111-111-1111", fax: "122-111-1111", email: "elon@musk.com", website: "https://elonmusk.com", notes: "Address notes or delivery instructions.", rowVersion: "1-12345", }, ], phoneNumbers: [ { id: "12345", countryCode: "1", areaCode: "323", number: "111-111-1111", extension: "105", type: "primary", }, { id: "12345", countryCode: "1", areaCode: "323", number: "111-111-1111", extension: "105", type: "primary", }, ], emails: [ { id: "123", email: "elon@musk.com", type: "primary", }, ], customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: { "0": "", "1": "", "2": "", }, }, ], socialLinks: [ { id: "12345", url: "https://www.twitter.com/apideck", type: "twitter", }, ], bankAccounts: [ { bankName: "Monzo", accountNumber: "123465", accountName: "SPACEX LLC", accountType: "credit_card", iban: "CH2989144532982975332", bic: "AUDSCHGGXXX", routingNumber: "012345678", bsbNumber: "062-001", branchIdentifier: "001", bankCode: "BNH", currency: "USD", }, ], taxCode: "1111", taxId: "234-32-0000", dietaryPreference: "Veggie", foodAllergies: [ "No allergies", ], probationPeriod: { startDate: new Date("2021-10-01"), endDate: new Date("2021-11-28"), }, tags: [ "New", ], rowVersion: "1-12345", deleted: true, passThrough: [ { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, ], }, }); expect(result.httpMeta.response.status).toBe(201); expect(result.createEmployeeResponse).toBeDefined(); expect(result.createEmployeeResponse).toEqual({ statusCode: 200, status: "OK", service: "sage-hr", resource: "Employees", operation: "add", data: { id: "12345", }, }); }); test("Employees Hris Employees One", async () => { const testHttpClient = createTestHTTPClient("hris.employeesOne"); const apideck = new Apideck({ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080", httpClient: testHttpClient, apiKey: process.env["APIDECK_API_KEY"] ?? "value", }); const result = await apideck.hris.employees.get({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", fields: "id,updated_at", filter: { companyId: "1234", }, passThrough: { "search": "San Francisco", }, }); expect(result.httpMeta.response.status).toBe(200); expect(result.getEmployeeResponse).toBeDefined(); expect(result.getEmployeeResponse).toEqual({ statusCode: 200, status: "OK", service: "sage-hr", resource: "Employees", operation: "one", data: { id: "12345", downstreamId: "12345", firstName: "Elon", lastName: "Musk", middleName: "D.", displayName: "Technoking", preferredName: "Elon Musk", initials: "EM", salutation: "Mr", title: "CEO", maritalStatus: "married", partner: { id: "12345", firstName: "Elon", lastName: "Musk", middleName: "D.", gender: "male", initials: "EM", birthday: new Date("2000-08-12"), deceasedOn: new Date("2000-08-12"), }, division: "Europe", divisionId: "12345", departmentId: "12345", departmentName: "12345", team: { id: "1234", name: "Full Stack Engineers", }, companyId: "23456", companyName: "SpaceX", employmentStartDate: "2021-10-26", employmentEndDate: "2028-10-26", leavingReason: "resigned", employeeNumber: "123456-AB", employmentStatus: "active", ethnicity: "African American", manager: { id: "12345", name: "Elon Musk", firstName: "Elon", lastName: "Musk", email: "elon@musk.com", employmentStatus: "active", }, directReports: [ "a0d636c6-43b3-4bde-8c70-85b707d992f4", "a98lfd96-43b3-4bde-8c70-85b707d992e6", ], socialSecurityNumber: "123456789", birthday: new Date("2000-08-12"), deceasedOn: new Date("2000-08-12"), countryOfBirth: "US", description: "A description", gender: "male", pronouns: "she,her", preferredLanguage: "EN", languages: [ "EN", ], nationalities: [ "US", ], photoUrl: "https://unavatar.io/elon-musk", timezone: "Europe/London", source: "lever", sourceId: "12345", recordUrl: "https://app.intercom.io/contacts/12345", jobs: [ { id: "12345", employeeId: "12345", title: "CEO", role: "Sales", startDate: new Date("2020-08-12"), endDate: new Date("2020-08-12"), compensationRate: 72000, currency: "USD", paymentUnit: "year", hiredAt: new Date("2020-08-12"), isPrimary: true, isManager: true, status: "active", location: { id: "123", type: "primary", string: "25 Spring Street, Blackburn, VIC 3130", name: "HQ US", line1: "Main street", line2: "apt #", line3: "Suite #", line4: "delivery instructions", streetNumber: "25", city: "San Francisco", state: "CA", postalCode: "94104", country: "US", latitude: "40.759211", longitude: "-73.984638", county: "Santa Clara", contactName: "Elon Musk", salutation: "Mr", phoneNumber: "111-111-1111", fax: "122-111-1111", email: "elon@musk.com", website: "https://elonmusk.com", notes: "Address notes or delivery instructions.", rowVersion: "1-12345", }, }, { id: "12345", employeeId: "12345", title: "CEO", role: "Sales", startDate: new Date("2020-08-12"), endDate: new Date("2020-08-12"), compensationRate: 72000, currency: "USD", paymentUnit: "year", hiredAt: new Date("2020-08-12"), isPrimary: true, isManager: true, status: "active", location: { id: "123", type: "primary", string: "25 Spring Street, Blackburn, VIC 3130", name: "HQ US", line1: "Main street", line2: "apt #", line3: "Suite #", line4: "delivery instructions", streetNumber: "25", city: "San Francisco", state: "CA", postalCode: "94104", country: "US", latitude: "40.759211", longitude: "-73.984638", county: "Santa Clara", contactName: "Elon Musk", salutation: "Mr", phoneNumber: "111-111-1111", fax: "122-111-1111", email: "elon@musk.com", website: "https://elonmusk.com", notes: "Address notes or delivery instructions.", rowVersion: "1-12345", }, }, { id: "12345", employeeId: "12345", title: "CEO", role: "Sales", startDate: new Date("2020-08-12"), endDate: new Date("2020-08-12"), compensationRate: 72000, currency: "USD", paymentUnit: "year", hiredAt: new Date("2020-08-12"), isPrimary: true, isManager: true, status: "active", location: { id: "123", type: "primary", string: "25 Spring Street, Blackburn, VIC 3130", name: "HQ US", line1: "Main street", line2: "apt #", line3: "Suite #", line4: "delivery instructions", streetNumber: "25", city: "San Francisco", state: "CA", postalCode: "94104", country: "US", latitude: "40.759211", longitude: "-73.984638", county: "Santa Clara", contactName: "Elon Musk", salutation: "Mr", phoneNumber: "111-111-1111", fax: "122-111-1111", email: "elon@musk.com", website: "https://elonmusk.com", notes: "Address notes or delivery instructions.", rowVersion: "1-12345", }, }, ], compensations: [ { id: "3404301363494309004", jobId: "3490439050957906679", rate: 50, paymentUnit: "hour", flsaStatus: "nonexempt", effectiveDate: "2021-06-11", }, ], worksRemote: true, addresses: [ { id: "123", type: "primary", string: "25 Spring Street, Blackburn, VIC 3130", name: "HQ US", line1: "Main street", line2: "apt #", line3: "Suite #", line4: "delivery instructions", streetNumber: "25", city: "San Francisco", state: "CA", postalCode: "94104", country: "US", latitude: "40.759211", longitude: "-73.984638", county: "Santa Clara", contactName: "Elon Musk", salutation: "Mr", phoneNumber: "111-111-1111", fax: "122-111-1111", email: "elon@musk.com", website: "https://elonmusk.com", notes: "Address notes or delivery instructions.", rowVersion: "1-12345", }, { id: "123", type: "primary", string: "25 Spring Street, Blackburn, VIC 3130", name: "HQ US", line1: "Main street", line2: "apt #", line3: "Suite #", line4: "delivery instructions", streetNumber: "25", city: "San Francisco", state: "CA", postalCode: "94104", country: "US", latitude: "40.759211", longitude: "-73.984638", county: "Santa Clara", contactName: "Elon Musk", salutation: "Mr", phoneNumber: "111-111-1111", fax: "122-111-1111", email: "elon@musk.com", website: "https://elonmusk.com", notes: "Address notes or delivery instructions.", rowVersion: "1-12345", }, ], phoneNumbers: [ { id: "12345", countryCode: "1", areaCode: "323", number: "111-111-1111", extension: "105", type: "primary", }, { id: "12345", countryCode: "1", areaCode: "323", number: "111-111-1111", extension: "105", type: "primary", }, ], emails: [ { id: "123", email: "elon@musk.com", type: "primary", }, { id: "123", email: "elon@musk.com", type: "primary", }, ], customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: true, }, { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: true, }, { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: 10, }, ], socialLinks: [ { id: "12345", url: "https://www.twitter.com/apideck", type: "twitter", }, ], bankAccounts: [ { bankName: "Monzo", accountNumber: "123465", accountName: "SPACEX LLC", accountType: "credit_card", iban: "CH2989144532982975332", bic: "AUDSCHGGXXX", routingNumber: "012345678", bsbNumber: "062-001", branchIdentifier: "001", bankCode: "BNH", currency: "USD", }, { bankName: "Monzo", accountNumber: "123465", accountName: "SPACEX LLC", accountType: "credit_card", iban: "CH2989144532982975332", bic: "AUDSCHGGXXX", routingNumber: "012345678", bsbNumber: "062-001", branchIdentifier: "001", bankCode: "BNH", currency: "USD", }, { bankName: "Monzo", accountNumber: "123465", accountName: "SPACEX LLC", accountType: "credit_card", iban: "CH2989144532982975332", bic: "AUDSCHGGXXX", routingNumber: "012345678", bsbNumber: "062-001", branchIdentifier: "001", bankCode: "BNH", currency: "USD", }, ], taxCode: "1111", taxId: "234-32-0000", dietaryPreference: "Veggie", foodAllergies: [ "No allergies", ], probationPeriod: { startDate: new Date("2021-10-01"), endDate: new Date("2021-11-28"), }, tags: [ "New", ], rowVersion: "1-12345", deleted: true, updatedBy: "12345", createdBy: "12345", updatedAt: new Date("2020-09-30T07:43:32.000Z"), createdAt: new Date("2020-09-30T07:43:32.000Z"), passThrough: [ { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, ], }, }); }); test("Employees Hris Employees Update", async () => { const testHttpClient = createTestHTTPClient("hris.employeesUpdate"); const apideck = new Apideck({ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080", httpClient: testHttpClient, apiKey: process.env["APIDECK_API_KEY"] ?? "value", }); const result = await apideck.hris.employees.update({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", employee: { id: "12345", firstName: "Elon", lastName: "Musk", middleName: "D.", displayName: "Technoking", preferredName: "Elon Musk", initials: "EM", salutation: "Mr", title: "CEO", maritalStatus: "married", partner: { firstName: "Elon", lastName: "Musk", middleName: "D.", gender: "male", initials: "EM", birthday: new Date("2000-08-12"), deceasedOn: new Date("2000-08-12"), }, division: "Europe", divisionId: "12345", departmentId: "12345", departmentName: "12345", team: { id: "1234", name: "Full Stack Engineers", }, companyId: "23456", companyName: "SpaceX", employmentStartDate: "2021-10-26", employmentEndDate: "2028-10-26", leavingReason: "resigned", employeeNumber: "123456-AB", employmentStatus: "active", ethnicity: "African American", manager: { id: "12345", name: "Elon Musk", firstName: "Elon", lastName: "Musk", email: "elon@musk.com", employmentStatus: "active", }, directReports: [ "a0d636c6-43b3-4bde-8c70-85b707d992f4", "a98lfd96-43b3-4bde-8c70-85b707d992e6", ], socialSecurityNumber: "123456789", birthday: new Date("2000-08-12"), deceasedOn: new Date("2000-08-12"), countryOfBirth: "US", description: "A description", gender: "male", pronouns: "she,her", preferredLanguage: "EN", languages: [ "EN", ], nationalities: [ "US", ], photoUrl: "https://unavatar.io/elon-musk", timezone: "Europe/London", source: "lever", sourceId: "12345", recordUrl: "https://app.intercom.io/contacts/12345", jobs: [ { title: "CEO", role: "Sales", startDate: new Date("2020-08-12"), endDate: new Date("2020-08-12"), compensationRate: 72000, currency: "USD", paymentUnit: "year", hiredAt: new Date("2020-08-12"), isPrimary: true, isManager: true, status: "active", location: { id: "123", type: "primary", string: "25 Spring Street, Blackburn, VIC 3130", name: "HQ US", line1: "Main street", line2: "apt #", line3: "Suite #", line4: "delivery instructions", streetNumber: "25", city: "San Francisco", state: "CA", postalCode: "94104", country: "US", latitude: "40.759211", longitude: "-73.984638", county: "Santa Clara", contactName: "Elon Musk", salutation: "Mr", phoneNumber: "111-111-1111", fax: "122-111-1111", email: "elon@musk.com", website: "https://elonmusk.com", notes: "Address notes or delivery instructions.", rowVersion: "1-12345", }, }, { title: "CEO", role: "Sales", startDate: new Date("2020-08-12"), endDate: new Date("2020-08-12"), compensationRate: 72000, currency: "USD", paymentUnit: "year", hiredAt: new Date("2020-08-12"), isPrimary: true, isManager: true, status: "active", location: { id: "123", type: "primary", string: "25 Spring Street, Blackburn, VIC 3130", name: "HQ US", line1: "Main street", line2: "apt #", line3: "Suite #", line4: "delivery instructions", streetNumber: "25", city: "San Francisco", state: "CA", postalCode: "94104", country: "US", latitude: "40.759211", longitude: "-73.984638", county: "Santa Clara", contactName: "Elon Musk", salutation: "Mr", phoneNumber: "111-111-1111", fax: "122-111-1111", email: "elon@musk.com", website: "https://elonmusk.com", notes: "Address notes or delivery instructions.", rowVersion: "1-12345", }, }, { title: "CEO", role: "Sales", startDate: new Date("2020-08-12"), endDate: new Date("2020-08-12"), compensationRate: 72000, currency: "USD", paymentUnit: "year", hiredAt: new Date("2020-08-12"), isPrimary: true, isManager: true, status: "active", location: { id: "123", type: "primary", string: "25 Spring Street, Blackburn, VIC 3130", name: "HQ US", line1: "Main street", line2: "apt #", line3: "Suite #", line4: "delivery instructions", streetNumber: "25", city: "San Francisco", state: "CA", postalCode: "94104", country: "US", latitude: "40.759211", longitude: "-73.984638", county: "Santa Clara", contactName: "Elon Musk", salutation: "Mr", phoneNumber: "111-111-1111", fax: "122-111-1111", email: "elon@musk.com", website: "https://elonmusk.com", notes: "Address notes or delivery instructions.", rowVersion: "1-12345", }, }, ], compensations: [ { rate: 50, paymentUnit: "hour", flsaStatus: "nonexempt", effectiveDate: "2021-06-11", }, ], worksRemote: true, addresses: [ { id: "123", type: "primary", string: "25 Spring Street, Blackburn, VIC 3130", name: "HQ US", line1: "Main street", line2: "apt #", line3: "Suite #", line4: "delivery instructions", streetNumber: "25", city: "San Francisco", state: "CA", postalCode: "94104", country: "US", latitude: "40.759211", longitude: "-73.984638", county: "Santa Clara", contactName: "Elon Musk", salutation: "Mr", phoneNumber: "111-111-1111", fax: "122-111-1111", email: "elon@musk.com", website: "https://elonmusk.com", notes: "Address notes or delivery instructions.", rowVersion: "1-12345", }, { id: "123", type: "primary", string: "25 Spring Street, Blackburn, VIC 3130", name: "HQ US", line1: "Main street", line2: "apt #", line3: "Suite #", line4: "delivery instructions", streetNumber: "25", city: "San Francisco", state: "CA", postalCode: "94104", country: "US", latitude: "40.759211", longitude: "-73.984638", county: "Santa Clara", contactName: "Elon Musk", salutation: "Mr", phoneNumber: "111-111-1111", fax: "122-111-1111", email: "elon@musk.com", website: "https://elonmusk.com", notes: "Address notes or delivery instructions.", rowVersion: "1-12345", }, ], phoneNumbers: [ { id: "12345", countryCode: "1", areaCode: "323", number: "111-111-1111", extension: "105", type: "primary", }, { id: "12345", countryCode: "1", areaCode: "323", number: "111-111-1111", extension: "105", type: "primary", }, ], emails: [ { id: "123", email: "elon@musk.com", type: "primary", }, { id: "123", email: "elon@musk.com", type: "primary", }, { id: "123", email: "elon@musk.com", type: "primary", }, ], customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: true, }, { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: {}, }, ], socialLinks: [ { id: "12345", url: "https://www.twitter.com/apideck", type: "twitter", }, { id: "12345", url: "https://www.twitter.com/apideck", type: "twitter", }, { id: "12345", url: "https://www.twitter.com/apideck", type: "twitter", }, ], bankAccounts: [ { bankName: "Monzo", accountNumber: "123465", accountName: "SPACEX LLC", accountType: "credit_card", iban: "CH2989144532982975332", bic: "AUDSCHGGXXX", routingNumber: "012345678", bsbNumber: "062-001", branchIdentifier: "001", bankCode: "BNH", currency: "USD", }, { bankName: "Monzo", accountNumber: "123465", accountName: "SPACEX LLC", accountType: "credit_card", iban: "CH2989144532982975332", bic: "AUDSCHGGXXX", routingNumber: "012345678", bsbNumber: "062-001", branchIdentifier: "001", bankCode: "BNH", currency: "USD", }, ], taxCode: "1111", taxId: "234-32-0000", dietaryPreference: "Veggie", foodAllergies: [ "No allergies", ], probationPeriod: { startDate: new Date("2021-10-01"), endDate: new Date("2021-11-28"), }, tags: [ "New", ], rowVersion: "1-12345", deleted: true, passThrough: [ { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, ], }, }); expect(result.httpMeta.response.status).toBe(200); expect(result.updateEmployeeResponse).toBeDefined(); expect(result.updateEmployeeResponse).toEqual({ statusCode: 200, status: "OK", service: "sage-hr", resource: "Employees", operation: "update", data: { id: "12345", }, }); }); test("Employees Hris Employees Delete", async () => { const testHttpClient = createTestHTTPClient("hris.employeesDelete"); const apideck = new Apideck({ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080", httpClient: testHttpClient, apiKey: process.env["APIDECK_API_KEY"] ?? "value", }); const result = await apideck.hris.employees.delete({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", }); expect(result.httpMeta.response.status).toBe(200); expect(result.deleteEmployeeResponse).toBeDefined(); expect(result.deleteEmployeeResponse).toEqual({ statusCode: 200, status: "OK", service: "sage-hr", resource: "Employees", operation: "delete", data: { id: "12345", }, }); }); test("Employees Accounting Employees All", async () => { const testHttpClient = createTestHTTPClient("accounting.employeesAll"); const apideck = new Apideck({ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080", httpClient: testHttpClient, apiKey: process.env["APIDECK_API_KEY"] ?? "value", }); const result = await apideck.accounting.employees.list({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", fields: "id,updated_at", filter: { updatedSince: new Date("2020-09-30T07:43:32.000Z"), status: "active", }, passThrough: { "search": "San Francisco", }, }); expect(result.httpMeta.response.status).toBe(200); expect(result.getAccountingEmployeesResponse).toBeDefined(); expect(result.getAccountingEmployeesResponse).toEqual({ statusCode: 200, status: "OK", service: "quickbooks", resource: "Employees", operation: "all", data: [], meta: { itemsOnPage: 50, cursors: { previous: "em9oby1jcm06OnBhZ2U6OjE=", current: "em9oby1jcm06OnBhZ2U6OjI=", next: "em9oby1jcm06OnBhZ2U6OjM=", }, totalCount: 1, warnings: null, }, links: { previous: "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjE%3D", current: "https://unify.apideck.com/crm/companies", next: "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjM", }, }); }); test("Employees Accounting Employees Add", async () => { const testHttpClient = createTestHTTPClient("accounting.employeesAdd"); const apideck = new Apideck({ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080", httpClient: testHttpClient, apiKey: process.env["APIDECK_API_KEY"] ?? "value", }); const result = await apideck.accounting.employees.create({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", accountingEmployee: { displayId: "123456", firstName: "John", lastName: "Doe", displayName: "John Doe", emails: [ { id: "123", email: "elon@musk.com", type: "primary", }, ], employeeNumber: "EMP-001", jobTitle: "Senior Accountant", status: "active", isContractor: false, department: { displayId: "123456", name: "Acme Inc.", }, location: { id: "123456", displayId: "123456", name: "New York Office", }, manager: { id: "12345", name: "Jane Smith", }, hireDate: new Date("2020-01-15"), terminationDate: new Date("2025-12-31"), gender: "male", birthDate: new Date("1990-05-20"), subsidiary: { displayId: "123456", name: "Acme Inc.", }, trackingCategories: [ { id: "123456", code: "100", name: "New York", parentId: "123456", parentName: "New York", }, ], currency: "USD", notes: "Some notes about this employee", addresses: [ { id: "123", type: "primary", string: "25 Spring Street, Blackburn, VIC 3130", name: "HQ US", line1: "Main street", line2: "apt #", line3: "Suite #", line4: "delivery instructions", line5: "Attention: Finance Dept", streetNumber: "25", city: "San Francisco", state: "CA", postalCode: "94104", country: "US", latitude: "40.759211", longitude: "-73.984638", county: "Santa Clara", contactName: "Elon Musk", salutation: "Mr", phoneNumber: "111-111-1111", fax: "122-111-1111", email: "elon@musk.com", website: "https://elonmusk.com", notes: "Address notes or delivery instructions.", rowVersion: "1-12345", }, ], phoneNumbers: [ { id: "12345", countryCode: "1", areaCode: "323", number: "111-111-1111", extension: "105", type: "primary", }, ], bankAccount: { bankName: "Chase Bank", accountNumber: "123465", accountName: "Main Operating Account", accountType: "credit_card", iban: "GB33BUKB20201555555555", bic: "CHASUS33", routingNumber: "021000021", bsbNumber: "062-001", branchIdentifier: "001", bankCode: "BNH", currency: "USD", country: "US", }, customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: "Uses Salesforce and Marketo", }, ], rowVersion: "1-12345", passThrough: [ { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, ], }, }); expect(result.httpMeta.response.status).toBe(201); expect(result.createAccountingEmployeeResponse).toBeDefined(); expect(result.createAccountingEmployeeResponse).toEqual({ statusCode: 200, status: "OK", service: "quickbooks", resource: "Employees", operation: "add", data: { id: "12345", }, }); }); test("Employees Accounting Employees One", async () => { const testHttpClient = createTestHTTPClient("accounting.employeesOne"); const apideck = new Apideck({ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080", httpClient: testHttpClient, apiKey: process.env["APIDECK_API_KEY"] ?? "value", }); const result = await apideck.accounting.employees.get({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", fields: "id,updated_at", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getAccountingEmployeeResponse).toBeDefined(); expect(result.getAccountingEmployeeResponse).toEqual({ statusCode: 200, status: "OK", service: "quickbooks", resource: "Employees", operation: "one", data: { id: "12345", downstreamId: "12345", displayId: "123456", firstName: "John", lastName: "Doe", displayName: "John Doe", emails: [ { id: "123", email: "elon@musk.com", type: "primary", }, ], employeeNumber: "EMP-001", jobTitle: "Senior Accountant", status: "active", isContractor: false, department: { id: "12345", displayId: "123456", name: "Acme Inc.", downstreamId: "12345", }, location: { id: "123456", displayId: "123456", name: "New York Office", downstreamId: "12345", }, manager: { id: "12345", name: "Jane Smith", }, hireDate: new Date("2020-01-15"), terminationDate: new Date("2025-12-31"), gender: "male", birthDate: new Date("1990-05-20"), subsidiary: { id: "12345", displayId: "123456", name: "Acme Inc.", }, trackingCategories: [ { id: "123456", code: "100", name: "New York", parentId: "123456", parentName: "New York", }, ], currency: "USD", notes: "Some notes about this employee", addresses: [ { id: "123", type: "primary", string: "25 Spring Street, Blackburn, VIC 3130", name: "HQ US", line1: "Main street", line2: "apt #", line3: "Suite #", line4: "delivery instructions", line5: "Attention: Finance Dept", streetNumber: "25", city: "San Francisco", state: "CA", postalCode: "94104", country: "US", latitude: "40.759211", longitude: "-73.984638", county: "Santa Clara", contactName: "Elon Musk", salutation: "Mr", phoneNumber: "111-111-1111", fax: "122-111-1111", email: "elon@musk.com", website: "https://elonmusk.com", notes: "Address notes or delivery instructions.", rowVersion: "1-12345", }, ], phoneNumbers: [ { id: "12345", countryCode: "1", areaCode: "323", number: "111-111-1111", extension: "105", type: "primary", }, ], bankAccount: { bankName: "Chase Bank", accountNumber: "123465", accountName: "Main Operating Account", accountType: "credit_card", iban: "GB33BUKB20201555555555", bic: "CHASUS33", routingNumber: "021000021", bsbNumber: "062-001", branchIdentifier: "001", bankCode: "BNH", currency: "USD", country: "US", }, customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: "Uses Salesforce and Marketo", }, ], rowVersion: "1-12345", updatedAt: new Date("2020-09-30T07:43:32.000Z"), createdAt: new Date("2020-09-30T07:43:32.000Z"), passThrough: [ { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, ], }, meta: { itemsOnPage: 50, cursors: { previous: "em9oby1jcm06OnBhZ2U6OjE=", current: "em9oby1jcm06OnBhZ2U6OjI=", next: "em9oby1jcm06OnBhZ2U6OjM=", }, totalCount: 1, warnings: [ { type: "downstream_request_failed", statusCode: 429, operation: "getManager", }, ], }, }); }); test("Employees Accounting Employees Update", async () => { const testHttpClient = createTestHTTPClient("accounting.employeesUpdate"); const apideck = new Apideck({ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080", httpClient: testHttpClient, apiKey: process.env["APIDECK_API_KEY"] ?? "value", }); const result = await apideck.accounting.employees.update({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", accountingEmployee: { displayId: "123456", firstName: "John", lastName: "Doe", displayName: "John Doe", emails: [ { id: "123", email: "elon@musk.com", type: "primary", }, ], employeeNumber: "EMP-001", jobTitle: "Senior Accountant", status: "active", isContractor: false, department: { displayId: "123456", name: "Acme Inc.", }, location: { id: "123456", displayId: "123456", name: "New York Office", }, manager: { id: "12345", name: "Jane Smith", }, hireDate: new Date("2020-01-15"), terminationDate: new Date("2025-12-31"), gender: "male", birthDate: new Date("1990-05-20"), subsidiary: { displayId: "123456", name: "Acme Inc.", }, trackingCategories: [ { id: "123456", code: "100", name: "New York", parentId: "123456", parentName: "New York", }, ], currency: "USD", notes: "Some notes about this employee", addresses: [ { id: "123", type: "primary", string: "25 Spring Street, Blackburn, VIC 3130", name: "HQ US", line1: "Main street", line2: "apt #", line3: "Suite #", line4: "delivery instructions", line5: "Attention: Finance Dept", streetNumber: "25", city: "San Francisco", state: "CA", postalCode: "94104", country: "US", latitude: "40.759211", longitude: "-73.984638", county: "Santa Clara", contactName: "Elon Musk", salutation: "Mr", phoneNumber: "111-111-1111", fax: "122-111-1111", email: "elon@musk.com", website: "https://elonmusk.com", notes: "Address notes or delivery instructions.", rowVersion: "1-12345", }, ], phoneNumbers: [ { id: "12345", countryCode: "1", areaCode: "323", number: "111-111-1111", extension: "105", type: "primary", }, ], bankAccount: { bankName: "Chase Bank", accountNumber: "123465", accountName: "Main Operating Account", accountType: "credit_card", iban: "GB33BUKB20201555555555", bic: "CHASUS33", routingNumber: "021000021", bsbNumber: "062-001", branchIdentifier: "001", bankCode: "BNH", currency: "USD", country: "US", }, customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: "Uses Salesforce and Marketo", }, ], rowVersion: "1-12345", passThrough: [ { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, ], }, }); expect(result.httpMeta.response.status).toBe(200); expect(result.updateAccountingEmployeeResponse).toBeDefined(); expect(result.updateAccountingEmployeeResponse).toEqual({ statusCode: 200, status: "OK", service: "quickbooks", resource: "Employees", operation: "update", data: { id: "12345", }, }); }); test("Employees Accounting Employees Delete", async () => { const testHttpClient = createTestHTTPClient("accounting.employeesDelete"); const apideck = new Apideck({ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080", httpClient: testHttpClient, apiKey: process.env["APIDECK_API_KEY"] ?? "value", }); const result = await apideck.accounting.employees.delete({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", }); expect(result.httpMeta.response.status).toBe(200); expect(result.deleteAccountingEmployeeResponse).toBeDefined(); expect(result.deleteAccountingEmployeeResponse).toEqual({ statusCode: 200, status: "OK", service: "quickbooks", resource: "Employees", operation: "delete", data: { id: "12345", }, }); });