/* * 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("Companies Crm Companies All", async () => { const testHttpClient = createTestHTTPClient("crm.companiesAll"); 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.crm.companies.list({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", filter: { name: "SpaceX", }, sort: { by: "created_at", direction: "desc", }, passThrough: { "search": "San Francisco", }, fields: "id,updated_at", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getCompaniesResponse1).toBeDefined(); expect(result.getCompaniesResponse1).toEqual({ statusCode: 200, status: "OK", service: "zoho-crm", resource: "companies", operation: "all", data: [ { id: "12345", name: "SpaceX", interactionCount: 1, ownerId: "12345", image: "https://www.spacex.com/static/images/share.jpg", description: "Space Exploration Technologies Corp. is an American aerospace manufacturer, space transportation services and communications company headquartered in Hawthorne, California.", vatNumber: "BE0689615164", currency: "USD", status: "Open", fax: "+12129876543", annualRevenue: "+$35m", numberOfEmployees: "500-1000", industry: "Apparel", ownership: "Public", salesTaxNumber: "12456EN", payeeNumber: "78932EN", abnOrTfn: "46 115 614 695", abnBranch: "123", acn: "XXX XXX XXX", firstName: "Elon", lastName: "Musk", parentId: "22345", 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", }, ], websites: [ { id: "12345", url: "http://example.com", type: "primary", }, { id: "12345", url: "http://example.com", type: "primary", }, { id: "12345", url: "http://example.com", type: "primary", }, ], 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", }, ], socialLinks: [ { id: "12345", url: "https://www.twitter.com/apideck", type: "twitter", }, ], phoneNumbers: [ { 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", }, ], rowType: { id: "12345", name: "Customer Account", }, customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: "Uses Salesforce and Marketo", }, { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: {}, }, ], tags: [ "New", ], readOnly: false, lastActivityAt: new Date("2020-09-30T07:43:32.000Z"), deleted: false, salutation: "Mr", birthday: new Date("2000-08-12"), 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", }, }, }, ], }, ], }, { id: "12345", name: "SpaceX", interactionCount: 1, ownerId: "12345", image: "https://www.spacex.com/static/images/share.jpg", description: "Space Exploration Technologies Corp. is an American aerospace manufacturer, space transportation services and communications company headquartered in Hawthorne, California.", vatNumber: "BE0689615164", currency: "USD", status: "Open", fax: "+12129876543", annualRevenue: "+$35m", numberOfEmployees: "500-1000", industry: "Apparel", ownership: "Public", salesTaxNumber: "12456EN", payeeNumber: "78932EN", abnOrTfn: "46 115 614 695", abnBranch: "123", acn: "XXX XXX XXX", firstName: "Elon", lastName: "Musk", parentId: "22345", 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", }, ], websites: [ { id: "12345", url: "http://example.com", type: "primary", }, { id: "12345", url: "http://example.com", type: "primary", }, ], 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", }, ], socialLinks: [ { id: "12345", url: "https://www.twitter.com/apideck", type: "twitter", }, ], 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", }, ], rowType: { id: "12345", name: "Customer Account", }, customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: { "0": {}, "1": {}, }, }, ], tags: [ "New", ], readOnly: false, lastActivityAt: new Date("2020-09-30T07:43:32.000Z"), deleted: false, salutation: "Mr", birthday: new Date("2000-08-12"), 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", name: "SpaceX", interactionCount: 1, ownerId: "12345", image: "https://www.spacex.com/static/images/share.jpg", description: "Space Exploration Technologies Corp. is an American aerospace manufacturer, space transportation services and communications company headquartered in Hawthorne, California.", vatNumber: "BE0689615164", currency: "USD", status: "Open", fax: "+12129876543", annualRevenue: "+$35m", numberOfEmployees: "500-1000", industry: "Apparel", ownership: "Public", salesTaxNumber: "12456EN", payeeNumber: "78932EN", abnOrTfn: "46 115 614 695", abnBranch: "123", acn: "XXX XXX XXX", firstName: "Elon", lastName: "Musk", parentId: "22345", 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", }, ], websites: [ { id: "12345", url: "http://example.com", type: "primary", }, ], 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", }, ], socialLinks: [ { id: "12345", url: "https://www.twitter.com/apideck", type: "twitter", }, { id: "12345", url: "https://www.twitter.com/apideck", type: "twitter", }, ], 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", }, ], rowType: { id: "12345", name: "Customer Account", }, customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: {}, }, ], tags: [ "New", ], readOnly: false, lastActivityAt: new Date("2020-09-30T07:43:32.000Z"), deleted: false, salutation: "Mr", birthday: new Date("2000-08-12"), 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", }, }, }, ], }, ], }, ], 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("Companies Crm Companies Add", async () => { const testHttpClient = createTestHTTPClient("crm.companiesAdd"); 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.crm.companies.create({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", company1: { name: "SpaceX", ownerId: "12345", image: "https://www.spacex.com/static/images/share.jpg", description: "Space Exploration Technologies Corp. is an American aerospace manufacturer, space transportation services and communications company headquartered in Hawthorne, California.", vatNumber: "BE0689615164", currency: "USD", status: "Open", fax: "+12129876543", annualRevenue: "+$35m", numberOfEmployees: "500-1000", industry: "Apparel", ownership: "Public", salesTaxNumber: "12456EN", payeeNumber: "78932EN", abnOrTfn: "46 115 614 695", abnBranch: "123", acn: "XXX XXX XXX", firstName: "Elon", lastName: "Musk", 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", }, ], websites: [ { id: "12345", url: "http://example.com", type: "primary", }, { id: "12345", url: "http://example.com", type: "primary", }, ], 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", }, ], socialLinks: [ { id: "12345", url: "https://www.twitter.com/apideck", type: "twitter", }, ], phoneNumbers: [ { 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", }, ], rowType: { id: "12345", name: "Customer Account", }, customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: "Uses Salesforce and Marketo", }, { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: 10, }, { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: "Uses Salesforce and Marketo", }, ], tags: [ "New", ], readOnly: false, salutation: "Mr", birthday: new Date("2000-08-12"), 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", }, }, }, { 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", }, }, }, ], }, ], }, }); expect(result.httpMeta.response.status).toBe(201); expect(result.createCompanyResponse).toBeDefined(); expect(result.createCompanyResponse).toEqual({ statusCode: 200, status: "OK", service: "zoho-crm", resource: "companies", operation: "add", data: { id: "12345", }, }); }); test("Companies Crm Companies One", async () => { const testHttpClient = createTestHTTPClient("crm.companiesOne"); 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.crm.companies.get({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", fields: "id,updated_at", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getCompanyResponse).toBeDefined(); expect(result.getCompanyResponse).toEqual({ statusCode: 200, status: "OK", service: "zoho-crm", resource: "companies", operation: "one", data: { id: "12345", name: "SpaceX", interactionCount: 1, ownerId: "12345", image: "https://www.spacex.com/static/images/share.jpg", description: "Space Exploration Technologies Corp. is an American aerospace manufacturer, space transportation services and communications company headquartered in Hawthorne, California.", vatNumber: "BE0689615164", currency: "USD", status: "Open", fax: "+12129876543", annualRevenue: "+$35m", numberOfEmployees: "500-1000", industry: "Apparel", ownership: "Public", salesTaxNumber: "12456EN", payeeNumber: "78932EN", abnOrTfn: "46 115 614 695", abnBranch: "123", acn: "XXX XXX XXX", firstName: "Elon", lastName: "Musk", parentId: "22345", 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", }, ], websites: [ { id: "12345", url: "http://example.com", type: "primary", }, { id: "12345", url: "http://example.com", type: "primary", }, ], 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", }, ], socialLinks: [ { id: "12345", url: "https://www.twitter.com/apideck", type: "twitter", }, { id: "12345", url: "https://www.twitter.com/apideck", type: "twitter", }, ], 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", }, ], rowType: { id: "12345", name: "Customer Account", }, customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: 10, }, { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: 10, }, ], tags: [ "New", ], readOnly: false, lastActivityAt: new Date("2020-09-30T07:43:32.000Z"), deleted: false, salutation: "Mr", birthday: new Date("2000-08-12"), 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", }, }, }, { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, ], }, }); }); test("Companies Crm Companies Update", async () => { const testHttpClient = createTestHTTPClient("crm.companiesUpdate"); 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.crm.companies.update({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", company1: { name: "SpaceX", ownerId: "12345", image: "https://www.spacex.com/static/images/share.jpg", description: "Space Exploration Technologies Corp. is an American aerospace manufacturer, space transportation services and communications company headquartered in Hawthorne, California.", vatNumber: "BE0689615164", currency: "USD", status: "Open", fax: "+12129876543", annualRevenue: "+$35m", numberOfEmployees: "500-1000", industry: "Apparel", ownership: "Public", salesTaxNumber: "12456EN", payeeNumber: "78932EN", abnOrTfn: "46 115 614 695", abnBranch: "123", acn: "XXX XXX XXX", firstName: "Elon", lastName: "Musk", 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", }, ], websites: [ { id: "12345", url: "http://example.com", type: "primary", }, { id: "12345", url: "http://example.com", type: "primary", }, ], 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", }, ], 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", }, ], 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", }, ], rowType: { id: "12345", name: "Customer Account", }, customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: "Uses Salesforce and Marketo", }, { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: { "0": {}, }, }, { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: 10, }, ], tags: [ "New", ], readOnly: false, salutation: "Mr", birthday: new Date("2000-08-12"), passThrough: [ { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, ], }, }); expect(result.httpMeta.response.status).toBe(200); expect(result.updateCompanyResponse).toBeDefined(); expect(result.updateCompanyResponse).toEqual({ statusCode: 200, status: "OK", service: "zoho-crm", resource: "companies", operation: "update", data: { id: "12345", }, }); }); test("Companies Crm Companies Delete", async () => { const testHttpClient = createTestHTTPClient("crm.companiesDelete"); 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.crm.companies.delete({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", }); expect(result.httpMeta.response.status).toBe(200); expect(result.deleteCompanyResponse).toBeDefined(); expect(result.deleteCompanyResponse).toEqual({ statusCode: 200, status: "OK", service: "zoho-crm", resource: "companies", operation: "delete", data: { id: "12345", }, }); }); test("Companies Accounting Companies All", async () => { const testHttpClient = createTestHTTPClient("accounting.companiesAll"); 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.companies.list({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", companyId: "12345", fields: "id,updated_at", passThrough: { "search": "San Francisco", }, }); expect(result.httpMeta.response.status).toBe(200); expect(result.getCompaniesResponse).toBeDefined(); expect(result.getCompaniesResponse).toEqual({ statusCode: 200, status: "OK", service: "xero", resource: "companies", operation: "all", data: [ { id: "12345", name: "Acme Corporation", }, ], meta: { itemsOnPage: 50, cursors: { previous: "em9oby1jcm06OnBhZ2U6OjE=", current: "em9oby1jcm06OnBhZ2U6OjI=", next: "em9oby1jcm06OnBhZ2U6OjM=", }, totalCount: 1, warnings: [ { type: "downstream_request_failed", statusCode: 429, operation: "getManager", }, ], }, 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", }, }); });