/* * 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("Pipelines Crm Pipelines All", async () => { const testHttpClient = createTestHTTPClient("crm.pipelinesAll"); 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.pipelines.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.getPipelinesResponse).toBeDefined(); expect(result.getPipelinesResponse).toEqual({ statusCode: 200, status: "OK", service: "zoho-crm", resource: "pipelines", operation: "all", data: [ { id: "default", name: "Sales Pipeline", currency: "USD", archived: false, active: false, displayOrder: 1, winProbabilityEnabled: true, stages: [ { id: "contractsent", name: "Contract Sent", value: "CONTRACT_SENT", winProbability: 50, displayOrder: 1, }, { id: "contractsent", name: "Contract Sent", value: "CONTRACT_SENT", winProbability: 50, displayOrder: 1, }, ], 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", }, }, }, ], }, ], }, { id: "default", name: "Sales Pipeline", currency: "USD", archived: false, active: false, displayOrder: 1, winProbabilityEnabled: true, stages: [ { id: "contractsent", name: "Contract Sent", value: "CONTRACT_SENT", winProbability: 50, displayOrder: 1, }, { id: "contractsent", name: "Contract Sent", value: "CONTRACT_SENT", winProbability: 50, displayOrder: 1, }, ], 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", }, }, }, { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, ], }, { id: "default", name: "Sales Pipeline", currency: "USD", archived: false, active: false, displayOrder: 1, winProbabilityEnabled: true, stages: [ { id: "contractsent", name: "Contract Sent", value: "CONTRACT_SENT", winProbability: 50, displayOrder: 1, }, ], 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", }, }, }, ], }, ], }, ], 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("Pipelines Crm Pipelines Add", async () => { const testHttpClient = createTestHTTPClient("crm.pipelinesAdd"); 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.pipelines.create({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", pipeline: { id: "default", name: "Sales Pipeline", currency: "USD", archived: false, active: false, displayOrder: 1, winProbabilityEnabled: true, stages: [ { name: "Contract Sent", value: "CONTRACT_SENT", winProbability: 50, displayOrder: 1, }, { name: "Contract Sent", value: "CONTRACT_SENT", winProbability: 50, displayOrder: 1, }, ], 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", }, }, }, ], }, ], }, }); expect(result.httpMeta.response.status).toBe(201); expect(result.createPipelineResponse).toBeDefined(); expect(result.createPipelineResponse).toEqual({ statusCode: 200, status: "OK", service: "zoho-crm", resource: "pipelines", operation: "add", data: { id: "12345", }, }); }); test("Pipelines Crm Pipelines One", async () => { const testHttpClient = createTestHTTPClient("crm.pipelinesOne"); 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.pipelines.get({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", fields: "id,updated_at", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getPipelineResponse).toBeDefined(); expect(result.getPipelineResponse).toEqual({ statusCode: 200, status: "OK", service: "zoho-crm", resource: "pipelines", operation: "one", data: { id: "default", name: "Sales Pipeline", currency: "USD", archived: false, active: false, displayOrder: 1, winProbabilityEnabled: true, stages: [ { id: "contractsent", name: "Contract Sent", value: "CONTRACT_SENT", winProbability: 50, displayOrder: 1, }, { id: "contractsent", name: "Contract Sent", value: "CONTRACT_SENT", winProbability: 50, displayOrder: 1, }, { id: "contractsent", name: "Contract Sent", value: "CONTRACT_SENT", winProbability: 50, displayOrder: 1, }, ], 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", }, }, }, ], }, ], }, }); }); test("Pipelines Crm Pipelines Update", async () => { const testHttpClient = createTestHTTPClient("crm.pipelinesUpdate"); 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.pipelines.update({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", pipeline: { id: "default", name: "Sales Pipeline", currency: "USD", archived: false, active: false, displayOrder: 1, winProbabilityEnabled: true, stages: [ { name: "Contract Sent", value: "CONTRACT_SENT", winProbability: 50, displayOrder: 1, }, { name: "Contract Sent", value: "CONTRACT_SENT", winProbability: 50, displayOrder: 1, }, { name: "Contract Sent", value: "CONTRACT_SENT", winProbability: 50, displayOrder: 1, }, ], 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", }, }, }, ], }, ], }, }); expect(result.httpMeta.response.status).toBe(200); expect(result.updatePipelineResponse).toBeDefined(); expect(result.updatePipelineResponse).toEqual({ statusCode: 200, status: "OK", service: "zoho-crm", resource: "pipelines", operation: "update", data: { id: "12345", }, }); }); test("Pipelines Crm Pipelines Delete", async () => { const testHttpClient = createTestHTTPClient("crm.pipelinesDelete"); 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.pipelines.delete({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", }); expect(result.httpMeta.response.status).toBe(200); expect(result.deletePipelineResponse).toBeDefined(); expect(result.deletePipelineResponse).toEqual({ statusCode: 200, status: "OK", service: "zoho-crm", resource: "companies", operation: "delete", data: { id: "12345", }, }); });