/* * 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("Customobjects Crm Custom Objects All", async () => { const testHttpClient = createTestHTTPClient("crm.customObjectsAll"); 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.customObjects.list({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", passThrough: { "search": "San Francisco", }, fields: "id,updated_at", objectId: "", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getCustomObjectsResponse).toBeDefined(); expect(result.getCustomObjectsResponse).toEqual({ statusCode: 200, status: "OK", service: "zoho-crm", resource: "custom-objects", operation: "all", data: [ { id: "co_12345", ownerId: "user_12345", name: "project", fields: [ { name: "name", value: "string", }, ], updatedBy: "user_12345", createdBy: "user_12345", updatedAt: "2020-09-30T07:43:32.000Z", createdAt: "2020-09-30T07:43:32.000Z", passThrough: [ { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, ], }, { id: "co_12345", ownerId: "user_12345", name: "project", fields: [ { name: "name", value: "string", }, ], updatedBy: "user_12345", createdBy: "user_12345", updatedAt: "2020-09-30T07:43:32.000Z", createdAt: "2020-09-30T07:43:32.000Z", passThrough: [ { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, ], }, { id: "co_12345", ownerId: "user_12345", name: "project", fields: [ { name: "name", value: "string", }, ], updatedBy: "user_12345", createdBy: "user_12345", updatedAt: "2020-09-30T07:43:32.000Z", createdAt: "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=", }, }, 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("Customobjects Crm Custom Objects Add", async () => { const testHttpClient = createTestHTTPClient("crm.customObjectsAdd"); 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.customObjects.create({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", objectId: "", customObject: { name: "project", fields: [ { name: "name", value: "string", }, { name: "name", value: "string", }, { name: "name", value: "string", }, ], 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", }, }, }, ], }, ], }, }); expect(result.httpMeta.response.status).toBe(201); expect(result.createCustomObjectResponse).toBeDefined(); expect(result.createCustomObjectResponse).toEqual({ statusCode: 200, status: "OK", service: "zoho-crm", resource: "custom-objects", operation: "add", data: { id: "12345", }, }); }); test("Customobjects Crm Custom Objects One", async () => { const testHttpClient = createTestHTTPClient("crm.customObjectsOne"); 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.customObjects.get({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", objectId: "", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getCustomObjectResponse).toBeDefined(); expect(result.getCustomObjectResponse).toEqual({ statusCode: 200, status: "OK", service: "zoho-crm", resource: "custom-objects", operation: "one", data: { id: "co_12345", ownerId: "user_12345", name: "project", fields: [ { name: "name", value: "string", }, { name: "name", value: "string", }, { name: "name", value: "string", }, ], updatedBy: "user_12345", createdBy: "user_12345", updatedAt: "2020-09-30T07:43:32.000Z", createdAt: "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", }, }, }, ], }, ], }, }); }); test("Customobjects Crm Custom Objects Update", async () => { const testHttpClient = createTestHTTPClient("crm.customObjectsUpdate"); 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.customObjects.update({ id: "", objectId: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", customObject: { name: "project", fields: [ { name: "name", value: "string", }, { name: "name", value: "string", }, ], passThrough: [ { serviceId: "", extendPaths: [ { 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(200); expect(result.updateCustomObjectResponse).toBeDefined(); expect(result.updateCustomObjectResponse).toEqual({ statusCode: 200, status: "OK", service: "zoho-crm", resource: "custom-objects", operation: "update", data: { id: "12345", }, }); }); test("Customobjects Crm Custom Objects Delete", async () => { const testHttpClient = createTestHTTPClient("crm.customObjectsDelete"); 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.customObjects.delete({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", objectId: "", }); expect(result.httpMeta.response.status).toBe(200); expect(result.deleteCustomObjectResponse).toBeDefined(); expect(result.deleteCustomObjectResponse).toEqual({ statusCode: 200, status: "OK", service: "zoho-crm", resource: "custom-objects", operation: "delete", data: { id: "12345", }, }); });