/* * 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("Projects Accounting Projects All", async () => { const testHttpClient = createTestHTTPClient("accounting.projectsAll"); 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.projects.list({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", companyId: "12345", filter: { name: "Website Redesign", status: "active", customerId: "12345", updatedSince: new Date("2020-09-30T07:43:32.000Z"), }, sort: { by: "name", }, passThrough: { "search": "San Francisco", }, fields: "id,updated_at", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getProjectsResponse).toBeDefined(); expect(result.getProjectsResponse).toEqual({ statusCode: 200, status: "OK", service: "quickbooks", resource: "Projects", operation: "all", data: [], meta: { itemsOnPage: 50, cursors: { previous: "em9oby1jcm06OnBhZ2U6OjE=", current: "em9oby1jcm06OnBhZ2U6OjI=", next: "em9oby1jcm06OnBhZ2U6OjM=", }, totalCount: 1, warnings: null, }, 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("Projects Accounting Projects Add", async () => { const testHttpClient = createTestHTTPClient("accounting.projectsAdd"); 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.projects.create({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", companyId: "12345", project: { name: "Website Redesign Project", displayId: "PROJ-001", referenceId: "WD-REF-2024-001", description: "Complete redesign of the company website including new branding and improved user experience", status: "active", active: true, projectType: "client_project", priority: "high", completionPercentage: 75.5, startDate: new Date("2024-01-15"), endDate: new Date("2024-06-30"), completionDate: new Date("2024-08-06"), customer: { id: "12345", displayName: "Windsurf Shop", email: "boring@boring.com", }, department: { id: "DEPT-001", name: "Marketing", }, companyId: "12345", ownerId: "12345", parentProject: { id: "PROJ-PARENT-001", name: "Company Website Overhaul", }, currency: "USD", budgetAmount: 50000, approvedAmount: 48000, budgetHours: 400, hourlyRate: 125, billingMethod: "time_and_materials", phase: "execution", taxRate: { id: "123456", code: "N-T", rate: 10, }, trackingCategories: [ { id: "123456", name: "New York", parentId: "123456", parentName: "New York", }, ], tags: [ "website", "redesign", "urgent", ], notes: "Client has requested modern design with mobile-first approach", contractNumber: "CNT-2024-001", profitMargin: 15.5, scheduleStatus: "on_schedule", 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", line5: "Attention: Finance Dept", 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", }, ], teamSize: 8, customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: "Uses Salesforce and Marketo", }, ], rowVersion: "1-12345", }, }); expect(result.httpMeta.response.status).toBe(201); expect(result.createProjectResponse).toBeDefined(); expect(result.createProjectResponse).toEqual({ statusCode: 200, status: "OK", service: "quickbooks", resource: "Projects", operation: "add", data: { id: "12345", }, }); }); test("Projects Accounting Projects One", async () => { const testHttpClient = createTestHTTPClient("accounting.projectsOne"); 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.projects.get({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", companyId: "12345", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getProjectResponse).toBeDefined(); expect(result.getProjectResponse).toEqual({ statusCode: 200, status: "OK", service: "quickbooks", resource: "Projects", operation: "one", data: { id: "12345", downstreamId: "12345", name: "Website Redesign Project", displayId: "PROJ-001", referenceId: "WD-REF-2024-001", description: "Complete redesign of the company website including new branding and improved user experience", status: "active", active: true, projectType: "client_project", priority: "high", completionPercentage: 75.5, startDate: new Date("2024-01-15"), endDate: new Date("2024-06-30"), completionDate: new Date("2024-08-06"), customer: { id: "12345", displayId: "CUST00101", displayName: "Windsurf Shop", companyName: "The boring company", email: "boring@boring.com", }, department: { id: "DEPT-001", name: "Marketing", }, companyId: "12345", ownerId: "12345", parentProject: { id: "PROJ-PARENT-001", name: "Company Website Overhaul", }, currency: "USD", budgetAmount: 50000, approvedAmount: 48000, actualAmount: 45250.75, budgetHours: 400, actualHours: 385.5, hourlyRate: 125, billingMethod: "time_and_materials", isBillable: true, phase: "execution", taxRate: { id: "123456", code: "N-T", name: "GST on Purchases", rate: 10, }, trackingCategories: [ { id: "123456", name: "New York", parentId: "123456", parentName: "New York", }, ], tags: [ "website", "redesign", "urgent", ], notes: "Client has requested modern design with mobile-first approach", contractNumber: "CNT-2024-001", profitMargin: 15.5, scheduleStatus: "on_schedule", 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", line5: "Attention: Finance Dept", 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", }, ], teamSize: 8, customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: "Uses Salesforce and Marketo", }, ], rowVersion: "1-12345", updatedBy: "12345", createdBy: "12345", createdAt: new Date("2020-09-30T07:43:32.000Z"), updatedAt: new Date("2020-09-30T07:43:32.000Z"), }, meta: { itemsOnPage: 50, cursors: { previous: "em9oby1jcm06OnBhZ2U6OjE=", current: "em9oby1jcm06OnBhZ2U6OjI=", next: "em9oby1jcm06OnBhZ2U6OjM=", }, totalCount: 1, warnings: [ { type: "downstream_request_failed", statusCode: 429, operation: "getManager", }, ], }, }); }); test("Projects Accounting Projects Update", async () => { const testHttpClient = createTestHTTPClient("accounting.projectsUpdate"); 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.projects.update({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", companyId: "12345", projectUpdateInput: { name: "Website Redesign Project", displayId: "PROJ-001", referenceId: "WD-REF-2024-001", description: "Complete redesign of the company website including new branding and improved user experience", status: "active", active: true, projectType: "client_project", priority: "high", completionPercentage: 75.5, startDate: new Date("2024-01-15"), endDate: new Date("2024-06-30"), completionDate: new Date("2024-08-06"), customer: null, department: { id: "DEPT-001", name: "Marketing", }, companyId: "12345", ownerId: "12345", parentProject: { id: "PROJ-PARENT-001", name: "Company Website Overhaul", }, currency: "USD", budgetAmount: 50000, approvedAmount: 48000, budgetHours: 400, hourlyRate: 125, billingMethod: "time_and_materials", phase: "execution", taxRate: { id: "123456", code: "N-T", rate: 10, }, trackingCategories: [ { id: "123456", name: "New York", parentId: "123456", parentName: "New York", }, ], tags: [ "website", "redesign", "urgent", ], notes: "Client has requested modern design with mobile-first approach", contractNumber: "CNT-2024-001", profitMargin: 15.5, scheduleStatus: "on_schedule", 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", line5: "Attention: Finance Dept", 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", }, ], teamSize: 8, customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: "Uses Salesforce and Marketo", }, ], rowVersion: "1-12345", }, }); expect(result.httpMeta.response.status).toBe(200); expect(result.updateProjectResponse).toBeDefined(); expect(result.updateProjectResponse).toEqual({ statusCode: 200, status: "OK", service: "quickbooks", resource: "Projects", operation: "update", data: { id: "12345", }, }); }); test("Projects Accounting Projects Delete", async () => { const testHttpClient = createTestHTTPClient("accounting.projectsDelete"); 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.projects.delete({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", companyId: "12345", }); expect(result.httpMeta.response.status).toBe(200); expect(result.deleteProjectResponse).toBeDefined(); expect(result.deleteProjectResponse).toEqual({ statusCode: 200, status: "OK", service: "quickbooks", resource: "Projects", operation: "delete", data: { id: "12345", }, }); });