/* * 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("Notes Crm Notes All", async () => { const testHttpClient = createTestHTTPClient("crm.notesAll"); 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.notes.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.getNotesResponse).toBeDefined(); expect(result.getNotesResponse).toEqual({ statusCode: 200, status: "OK", service: "zoho-crm", resource: "notes", operation: "all", data: [ { id: "12345", title: "Meeting Notes", content: "Office hours are 9AM-6PM", ownerId: "12345", contactId: "12345", companyId: "12345", opportunityId: "12345", leadId: "12345", active: true, updatedBy: "12345", createdBy: "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", }, }, }, ], }, ], }, { id: "12345", title: "Meeting Notes", content: "Office hours are 9AM-6PM", ownerId: "12345", contactId: "12345", companyId: "12345", opportunityId: "12345", leadId: "12345", active: true, updatedBy: "12345", createdBy: "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: "12345", title: "Meeting Notes", content: "Office hours are 9AM-6PM", ownerId: "12345", contactId: "12345", companyId: "12345", opportunityId: "12345", leadId: "12345", active: true, updatedBy: "12345", createdBy: "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", }, }, }, ], }, { 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("Notes Crm Notes Add", async () => { const testHttpClient = createTestHTTPClient("crm.notesAdd"); 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.notes.create({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", note: { title: "Meeting Notes", content: "Office hours are 9AM-6PM", ownerId: "12345", contactId: "12345", companyId: "12345", opportunityId: "12345", leadId: "12345", 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", }, }, }, ], }, { 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(201); expect(result.createNoteResponse).toBeDefined(); expect(result.createNoteResponse).toEqual({ statusCode: 200, status: "OK", service: "zoho-crm", resource: "notes", operation: "add", data: { id: "12345", }, }); }); test("Notes Crm Notes One", async () => { const testHttpClient = createTestHTTPClient("crm.notesOne"); 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.notes.get({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", fields: "id,updated_at", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getNoteResponse).toBeDefined(); expect(result.getNoteResponse).toEqual({ statusCode: 200, status: "OK", service: "zoho-crm", resource: "notes", operation: "one", data: { id: "12345", title: "Meeting Notes", content: "Office hours are 9AM-6PM", ownerId: "12345", contactId: "12345", companyId: "12345", opportunityId: "12345", leadId: "12345", active: true, updatedBy: "12345", createdBy: "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", }, }, }, ], }, { 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("Notes Crm Notes Update", async () => { const testHttpClient = createTestHTTPClient("crm.notesUpdate"); 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.notes.update({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", note: { title: "Meeting Notes", content: "Office hours are 9AM-6PM", ownerId: "12345", contactId: "12345", companyId: "12345", opportunityId: "12345", leadId: "12345", 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", }, }, }, ], }, { 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.updateNoteResponse).toBeDefined(); expect(result.updateNoteResponse).toEqual({ statusCode: 200, status: "OK", service: "zoho-crm", resource: "notes", operation: "update", data: { id: "12345", }, }); }); test("Notes Crm Notes Delete", async () => { const testHttpClient = createTestHTTPClient("crm.notesDelete"); 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.notes.delete({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", }); expect(result.httpMeta.response.status).toBe(200); expect(result.deleteNoteResponse).toBeDefined(); expect(result.deleteNoteResponse).toEqual({ statusCode: 200, status: "OK", service: "zoho-crm", resource: "notes", operation: "delete", data: { id: "12345", }, }); });