/* * 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("Customobjectschemas Crm Custom Object Schemas All", async () => { const testHttpClient = createTestHTTPClient("crm.customObjectSchemasAll"); 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.customObjectSchemas.list({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", passThrough: { "search": "San Francisco", }, }); expect(result.httpMeta.response.status).toBe(200); expect(result.getCustomObjectSchemasResponse).toBeDefined(); expect(result.getCustomObjectSchemasResponse).toEqual({ statusCode: 200, status: "OK", service: "zoho-crm", resource: "custom-object-schemas", operation: "all", data: [ { id: "cos_12345", name: "project", description: "This schema defines a project custom object", fields: [ { id: "field_123", name: "project_name", description: "Name of the project", type: "string", required: true, options: [ { value: "option1", label: "Option 1", }, { value: "option1", label: "Option 1", }, { value: "option1", label: "Option 1", }, ], defaultValue: "New Project", }, { id: "field_123", name: "project_name", description: "Name of the project", type: "string", required: true, options: [ { value: "option1", label: "Option 1", }, { value: "option1", label: "Option 1", }, { value: "option1", label: "Option 1", }, ], defaultValue: "New Project", }, ], visible: true, active: true, createdBy: "12345", updatedBy: "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: "cos_12345", name: "project", description: "This schema defines a project custom object", fields: [ { id: "field_123", name: "project_name", description: "Name of the project", type: "string", required: true, options: [ { value: "option1", label: "Option 1", }, { value: "option1", label: "Option 1", }, { value: "option1", label: "Option 1", }, ], defaultValue: "New Project", }, { id: "field_123", name: "project_name", description: "Name of the project", type: "string", required: true, options: [ { value: "option1", label: "Option 1", }, { value: "option1", label: "Option 1", }, { value: "option1", label: "Option 1", }, ], defaultValue: "New Project", }, ], visible: true, active: true, createdBy: "12345", updatedBy: "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: "cos_12345", name: "project", description: "This schema defines a project custom object", fields: [ { id: "field_123", name: "project_name", description: "Name of the project", type: "string", required: true, options: [ { value: "option1", label: "Option 1", }, { value: "option1", label: "Option 1", }, { value: "option1", label: "Option 1", }, ], defaultValue: "New Project", }, { id: "field_123", name: "project_name", description: "Name of the project", type: "string", required: true, options: [ { value: "option1", label: "Option 1", }, { value: "option1", label: "Option 1", }, { value: "option1", label: "Option 1", }, ], defaultValue: "New Project", }, ], visible: true, active: true, createdBy: "12345", updatedBy: "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("Customobjectschemas Crm Custom Object Schemas Add", async () => { const testHttpClient = createTestHTTPClient("crm.customObjectSchemasAdd"); 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.customObjectSchemas.create({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", customObjectSchema: { name: "project", description: "This schema defines a project custom object", fields: [ { id: "field_123", name: "project_name", description: "Name of the project", type: "string", required: true, options: [ { value: "option1", label: "Option 1", }, ], defaultValue: "New Project", }, ], visible: true, active: true, 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", }, }, }, ], }, ], }, }); expect(result.httpMeta.response.status).toBe(201); expect(result.createCustomObjectSchemaResponse).toBeDefined(); expect(result.createCustomObjectSchemaResponse).toEqual({ statusCode: 201, status: "Created", service: "zoho-crm", resource: "custom-object-schemas", operation: "add", data: { id: "cos_12345", name: "project", description: "This schema defines a project custom object", fields: [ { id: "field_123", name: "project_name", description: "Name of the project", type: "string", required: true, options: [ { value: "option1", label: "Option 1", }, ], defaultValue: "New Project", }, { id: "field_123", name: "project_name", description: "Name of the project", type: "string", required: true, options: [ { value: "option1", label: "Option 1", }, ], defaultValue: "New Project", }, ], visible: true, active: true, createdBy: "12345", updatedBy: "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", }, }, }, ], }, { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, ], }, }); }); test("Customobjectschemas Crm Custom Object Schemas One", async () => { const testHttpClient = createTestHTTPClient("crm.customObjectSchemasOne"); 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.customObjectSchemas.get({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getCustomObjectSchemaResponse).toBeDefined(); expect(result.getCustomObjectSchemaResponse).toEqual({ statusCode: 200, status: "OK", service: "zoho-crm", resource: "custom-object-schemas", operation: "one", data: { id: "cos_12345", name: "project", description: "This schema defines a project custom object", fields: [ { id: "field_123", name: "project_name", description: "Name of the project", type: "string", required: true, options: [ { value: "option1", label: "Option 1", }, ], defaultValue: "New Project", }, ], visible: true, active: true, createdBy: "12345", updatedBy: "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", }, }, }, ], }, { 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("Customobjectschemas Crm Custom Object Schemas Update", async () => { const testHttpClient = createTestHTTPClient("crm.customObjectSchemasUpdate"); 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.customObjectSchemas.update({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", customObjectSchema: { name: "project", description: "This schema defines a project custom object", fields: [ { id: "field_123", name: "project_name", description: "Name of the project", type: "string", required: true, options: [ { value: "option1", label: "Option 1", }, { value: "option1", label: "Option 1", }, ], defaultValue: "New Project", }, { id: "field_123", name: "project_name", description: "Name of the project", type: "string", required: true, options: [ { value: "option1", label: "Option 1", }, { value: "option1", label: "Option 1", }, ], defaultValue: "New Project", }, { id: "field_123", name: "project_name", description: "Name of the project", type: "string", required: true, options: [ { value: "option1", label: "Option 1", }, { value: "option1", label: "Option 1", }, ], defaultValue: "New Project", }, ], visible: true, active: 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", }, }, }, ], }, { 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", }, }, }, { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, ], }, }); expect(result.httpMeta.response.status).toBe(200); expect(result.updateCustomObjectSchemaResponse).toBeDefined(); expect(result.updateCustomObjectSchemaResponse).toEqual({ statusCode: 200, status: "OK", service: "zoho-crm", resource: "custom-object-schemas", operation: "update", data: { id: "12345", }, }); }); test("Customobjectschemas Crm Custom Object Schemas Delete", async () => { const testHttpClient = createTestHTTPClient("crm.customObjectSchemasDelete"); 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.customObjectSchemas.delete({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", }); expect(result.httpMeta.response.status).toBe(200); expect(result.deleteCustomObjectSchemaResponse).toBeDefined(); expect(result.deleteCustomObjectSchemaResponse).toEqual({ statusCode: 200, status: "OK", service: "zoho-crm", resource: "custom-object-schemas", operation: "delete", data: { id: "12345", }, }); });