/* * 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("Jobs Ats Jobs All", async () => { const testHttpClient = createTestHTTPClient("ats.jobsAll"); 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.ats.jobs.list({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", passThrough: { "search": "San Francisco", }, fields: "id,updated_at", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getJobsResponse).toBeDefined(); expect(result.getJobsResponse).toEqual({ statusCode: 200, status: "OK", service: "lever", resource: "Jobs", operation: "all", data: [ { id: "12345", slug: "ceo", title: "CEO", sequence: 3, visibility: "internal", status: "completed", code: "123-OC", language: "EN", employmentTerms: "full-time", experience: "Director/ Vice President", location: "San Francisco", remote: true, requisitionId: "abc123", department: { id: "12345", parentId: "22345", name: "R&D", code: "2", description: "R&D", 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", }, }, }, ], }, ], }, branch: { id: "123", name: "HQ NY", }, recruiters: [ "a0d636c6-43b3-4bde-8c70-85b707d992f4", ], hiringManagers: [ "123456", ], followers: [ "a0d636c6-43b3-4bde-8c70-85b707d992f4", "a98lfd96-43b3-4bde-8c70-85b707d992e6", ], description: "A description", blocks: [ { title: "string", content: "string", }, ], closing: "The closing section of the job description", closingDate: new Date("2020-10-30"), salary: { min: 8000, max: 10000, currency: "USD", interval: "year", }, links: [ { type: "job_portal", url: "https://app.intercom.io/contacts/12345", }, ], confidential: false, availableToEmployees: false, tags: [ "New", ], 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", }, ], customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: {}, }, { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: "Uses Salesforce and Marketo", }, ], deleted: true, ownerId: "54321", publishedAt: new Date("2020-09-30T07:43:32.000Z"), updatedBy: "12345", createdBy: "12345", updatedAt: new Date("2020-09-30T07:43:32.000Z"), createdAt: new Date("2020-09-30T07:43:32.000Z"), }, { id: "12345", slug: "ceo", title: "CEO", sequence: 3, visibility: "internal", status: "completed", code: "123-OC", language: "EN", employmentTerms: "full-time", experience: "Director/ Vice President", location: "San Francisco", remote: true, requisitionId: "abc123", department: { id: "12345", parentId: "22345", name: "R&D", code: "2", description: "R&D", 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", }, }, }, ], }, ], }, branch: { id: "123", name: "HQ NY", }, recruiters: [ "a0d636c6-43b3-4bde-8c70-85b707d992f4", ], hiringManagers: [ "123456", ], followers: [ "a0d636c6-43b3-4bde-8c70-85b707d992f4", "a98lfd96-43b3-4bde-8c70-85b707d992e6", ], description: "A description", blocks: [ { title: "string", content: "string", }, ], closing: "The closing section of the job description", closingDate: new Date("2020-10-30"), salary: { min: 8000, max: 10000, currency: "USD", interval: "year", }, links: [ { type: "job_portal", url: "https://app.intercom.io/contacts/12345", }, { type: "job_portal", url: "https://app.intercom.io/contacts/12345", }, ], confidential: false, availableToEmployees: false, tags: [ "New", ], 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", }, ], customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: "Uses Salesforce and Marketo", }, ], deleted: true, ownerId: "54321", publishedAt: new Date("2020-09-30T07:43:32.000Z"), updatedBy: "12345", createdBy: "12345", updatedAt: new Date("2020-09-30T07:43:32.000Z"), createdAt: new Date("2020-09-30T07:43:32.000Z"), }, { id: "12345", slug: "ceo", title: "CEO", sequence: 3, visibility: "internal", status: "completed", code: "123-OC", language: "EN", employmentTerms: "full-time", experience: "Director/ Vice President", location: "San Francisco", remote: true, requisitionId: "abc123", department: { id: "12345", parentId: "22345", name: "R&D", code: "2", description: "R&D", 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", }, }, }, ], }, ], }, branch: { id: "123", name: "HQ NY", }, recruiters: [ "a0d636c6-43b3-4bde-8c70-85b707d992f4", ], hiringManagers: [ "123456", ], followers: [ "a0d636c6-43b3-4bde-8c70-85b707d992f4", "a98lfd96-43b3-4bde-8c70-85b707d992e6", ], description: "A description", blocks: [ { title: "string", content: "string", }, ], closing: "The closing section of the job description", closingDate: new Date("2020-10-30"), salary: { min: 8000, max: 10000, currency: "USD", interval: "year", }, links: [ { type: "job_portal", url: "https://app.intercom.io/contacts/12345", }, { type: "job_portal", url: "https://app.intercom.io/contacts/12345", }, { type: "job_portal", url: "https://app.intercom.io/contacts/12345", }, ], confidential: false, availableToEmployees: false, tags: [ "New", ], 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", }, ], customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: true, }, { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: "Uses Salesforce and Marketo", }, { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: 10, }, ], deleted: true, ownerId: "54321", publishedAt: new Date("2020-09-30T07:43:32.000Z"), updatedBy: "12345", createdBy: "12345", updatedAt: new Date("2020-09-30T07:43:32.000Z"), createdAt: new Date("2020-09-30T07:43:32.000Z"), }, ], 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("Jobs Ats Jobs One", async () => { const testHttpClient = createTestHTTPClient("ats.jobsOne"); 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.ats.jobs.get({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", fields: "id,updated_at", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getJobResponse).toBeDefined(); expect(result.getJobResponse).toEqual({ statusCode: 200, status: "OK", service: "lever", resource: "Jobs", operation: "one", data: { id: "12345", slug: "ceo", title: "CEO", sequence: 3, visibility: "internal", status: "completed", code: "123-OC", language: "EN", employmentTerms: "full-time", experience: "Director/ Vice President", location: "San Francisco", remote: true, requisitionId: "abc123", department: { id: "12345", parentId: "22345", name: "R&D", code: "2", description: "R&D", 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", }, }, }, { 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", }, }, }, ], }, ], }, branch: { id: "123", name: "HQ NY", }, recruiters: [ "a0d636c6-43b3-4bde-8c70-85b707d992f4", ], hiringManagers: [ "123456", ], followers: [ "a0d636c6-43b3-4bde-8c70-85b707d992f4", "a98lfd96-43b3-4bde-8c70-85b707d992e6", ], description: "A description", blocks: [ { title: "string", content: "string", }, ], closing: "The closing section of the job description", closingDate: new Date("2020-10-30"), salary: { min: 8000, max: 10000, currency: "USD", interval: "year", }, links: [ { type: "job_portal", url: "https://app.intercom.io/contacts/12345", }, { type: "job_portal", url: "https://app.intercom.io/contacts/12345", }, { type: "job_portal", url: "https://app.intercom.io/contacts/12345", }, ], confidential: false, availableToEmployees: false, tags: [ "New", ], 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", }, ], customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: 10, }, { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: 10, }, ], deleted: true, ownerId: "54321", publishedAt: new Date("2020-09-30T07:43:32.000Z"), updatedBy: "12345", createdBy: "12345", updatedAt: new Date("2020-09-30T07:43:32.000Z"), createdAt: new Date("2020-09-30T07:43:32.000Z"), }, }); }); test("Jobs Ats Jobs Add", async () => { const testHttpClient = createTestHTTPClient("ats.jobsAdd"); 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.ats.jobs.create({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", job: { slug: "ceo", title: "CEO", sequence: 3, visibility: "internal", status: "completed", code: "123-OC", language: "EN", employmentTerms: "full-time", experience: "Director/ Vice President", location: "San Francisco", remote: true, requisitionId: "abc123", department: { name: "R&D", code: "2", description: "R&D", passThrough: [ { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, ], }, branch: { name: "HQ NY", }, recruiters: [ "a0d636c6-43b3-4bde-8c70-85b707d992f4", ], hiringManagers: [ "123456", ], followers: [ "a0d636c6-43b3-4bde-8c70-85b707d992f4", "a98lfd96-43b3-4bde-8c70-85b707d992e6", ], description: "A description", blocks: [ { title: "string", content: "string", }, ], closing: "The closing section of the job description", closingDate: new Date("2020-10-30"), salary: { min: 8000, max: 10000, currency: "USD", interval: "year", }, links: [ { type: "job_portal", url: "https://app.intercom.io/contacts/12345", }, ], confidential: false, availableToEmployees: false, tags: [ "New", ], 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", }, ], customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: "Uses Salesforce and Marketo", }, ], deleted: true, ownerId: "54321", }, }); expect(result.httpMeta.response.status).toBe(201); expect(result.createJobResponse).toBeDefined(); expect(result.createJobResponse).toEqual({ statusCode: 200, status: "OK", service: "sage-hr", resource: "Jobs", operation: "add", data: { id: "12345", }, }); }); test("Jobs Ats Jobs Update", async () => { const testHttpClient = createTestHTTPClient("ats.jobsUpdate"); 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.ats.jobs.update({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", job: { slug: "ceo", title: "CEO", sequence: 3, visibility: "internal", status: "completed", code: "123-OC", language: "EN", employmentTerms: "full-time", experience: "Director/ Vice President", location: "San Francisco", remote: true, requisitionId: "abc123", department: { name: "R&D", code: "2", description: "R&D", passThrough: [ { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, ], }, branch: { name: "HQ NY", }, recruiters: [ "a0d636c6-43b3-4bde-8c70-85b707d992f4", ], hiringManagers: [ "123456", ], followers: [ "a0d636c6-43b3-4bde-8c70-85b707d992f4", "a98lfd96-43b3-4bde-8c70-85b707d992e6", ], description: "A description", blocks: [ { title: "string", content: "string", }, ], closing: "The closing section of the job description", closingDate: new Date("2020-10-30"), salary: { min: 8000, max: 10000, currency: "USD", interval: "year", }, links: [ { type: "job_portal", url: "https://app.intercom.io/contacts/12345", }, ], confidential: false, availableToEmployees: false, tags: [ "New", ], 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", }, ], customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: "Uses Salesforce and Marketo", }, ], deleted: true, ownerId: "54321", }, }); expect(result.httpMeta.response.status).toBe(200); expect(result.updateJobResponse).toBeDefined(); expect(result.updateJobResponse).toEqual({ statusCode: 200, status: "OK", service: "sage-hr", resource: "Jobs", operation: "update", data: { id: "12345", }, }); }); test("Jobs Ats Jobs Delete", async () => { const testHttpClient = createTestHTTPClient("ats.jobsDelete"); 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.ats.jobs.delete({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", }); expect(result.httpMeta.response.status).toBe(200); expect(result.deleteJobResponse).toBeDefined(); expect(result.deleteJobResponse).toEqual({ statusCode: 200, status: "OK", service: "sage-hr", resource: "Jobs", operation: "delete", data: { id: "12345", }, }); });