/* * 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("Collectiontickets Issue Tracking Collection Tickets All", async () => { const testHttpClient = createTestHTTPClient( "issueTracking.collectionTicketsAll", ); 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.issueTracking.collectionTickets.list({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", collectionId: "apideck-io", sort: { by: "created_at", direction: "desc", }, filter: { status: [ "open", ], }, passThrough: { "search": "San Francisco", }, fields: "id,updated_at", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getTicketsResponse).toBeDefined(); expect(result.getTicketsResponse).toEqual({ statusCode: 200, status: "OK", service: "jira", resource: "Tickets", operation: "all", data: [ { id: "12345", parentId: "12345", collectionId: "12345", type: "Technical", subject: "Technical Support Request", description: "I am facing issues with my internet connection", status: "open", priority: "high", assignees: [ { id: "12345", username: "Cocoa", }, { id: "12345", username: "Cocoa", }, ], updatedAt: new Date("2020-09-30T07:43:32.000Z"), createdAt: new Date("2020-09-30T07:43:32.000Z"), createdBy: "12345", dueDate: new Date("2020-09-30T07:43:32.000Z"), completedAt: new Date("2020-09-30T07:43:32.000Z"), tags: [ { id: "12345", name: "User Experience", }, { id: "12345", name: "User Experience", }, { id: "12345", name: "User Experience", }, ], passThrough: [ { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, ], }, { id: "12345", parentId: "12345", collectionId: "12345", type: "Technical", subject: "Technical Support Request", description: "I am facing issues with my internet connection", status: "open", priority: "high", assignees: [ { id: "12345", username: "Cocoa", }, ], updatedAt: new Date("2020-09-30T07:43:32.000Z"), createdAt: new Date("2020-09-30T07:43:32.000Z"), createdBy: "12345", dueDate: new Date("2020-09-30T07:43:32.000Z"), completedAt: new Date("2020-09-30T07:43:32.000Z"), tags: [ { id: "12345", name: "User Experience", }, { id: "12345", name: "User Experience", }, ], 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: "12345", parentId: "12345", collectionId: "12345", type: "Technical", subject: "Technical Support Request", description: "I am facing issues with my internet connection", status: "open", priority: "high", assignees: [ { id: "12345", username: "Cocoa", }, ], updatedAt: new Date("2020-09-30T07:43:32.000Z"), createdAt: new Date("2020-09-30T07:43:32.000Z"), createdBy: "12345", dueDate: new Date("2020-09-30T07:43:32.000Z"), completedAt: new Date("2020-09-30T07:43:32.000Z"), tags: [ { id: "12345", name: "User Experience", }, ], 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", }, }, }, ], }, ], }, ], 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("Collectiontickets Issue Tracking Collection Tickets Add", async () => { const testHttpClient = createTestHTTPClient( "issueTracking.collectionTicketsAdd", ); 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.issueTracking.collectionTickets.create({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", collectionId: "apideck-io", ticket: { parentId: "12345", type: "Technical", subject: "Technical Support Request", description: "I am facing issues with my internet connection", status: "open", priority: "high", assignees: [ { id: "12345", }, { id: "12345", }, ], dueDate: new Date("2020-09-30T07:43:32.000Z"), tags: [ { id: "12345", }, { id: "12345", }, ], 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.createTicketResponse).toBeDefined(); expect(result.createTicketResponse).toEqual({ statusCode: 200, status: "OK", service: "jira", resource: "Tickets", operation: "add", data: { id: "12345", }, }); }); test("Collectiontickets Issue Tracking Collection Tickets One", async () => { const testHttpClient = createTestHTTPClient( "issueTracking.collectionTicketsOne", ); 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.issueTracking.collectionTickets.get({ ticketId: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", collectionId: "apideck-io", fields: "id,updated_at", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getTicketResponse).toBeDefined(); expect(result.getTicketResponse).toEqual({ statusCode: 200, status: "OK", service: "sage-hr", resource: "Tickets", operation: "one", data: { id: "12345", parentId: "12345", collectionId: "12345", type: "Technical", subject: "Technical Support Request", description: "I am facing issues with my internet connection", status: "open", priority: "high", assignees: [ { id: "12345", username: "Cocoa", }, { id: "12345", username: "Cocoa", }, { id: "12345", username: "Cocoa", }, ], updatedAt: new Date("2020-09-30T07:43:32.000Z"), createdAt: new Date("2020-09-30T07:43:32.000Z"), createdBy: "12345", dueDate: new Date("2020-09-30T07:43:32.000Z"), completedAt: new Date("2020-09-30T07:43:32.000Z"), tags: [ { id: "12345", name: "User Experience", }, { id: "12345", name: "User Experience", }, ], 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", }, }, }, ], }, ], }, }); }); test("Collectiontickets Issue Tracking Collection Tickets Update", async () => { const testHttpClient = createTestHTTPClient( "issueTracking.collectionTicketsUpdate", ); 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.issueTracking.collectionTickets.update({ ticketId: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", collectionId: "apideck-io", ticket: { parentId: "12345", type: "Technical", subject: "Technical Support Request", description: "I am facing issues with my internet connection", status: "open", priority: "high", assignees: [ { id: "12345", }, { id: "12345", }, { id: "12345", }, ], dueDate: new Date("2020-09-30T07:43:32.000Z"), tags: [ { id: "12345", }, { id: "12345", }, ], 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", }, }, }, ], }, ], }, }); expect(result.httpMeta.response.status).toBe(200); expect(result.updateTicketResponse).toBeDefined(); expect(result.updateTicketResponse).toEqual({ statusCode: 200, status: "OK", service: "github", resource: "Tickets", operation: "update", data: { id: "12345", }, }); }); test("Collectiontickets Issue Tracking Collection Tickets Delete", async () => { const testHttpClient = createTestHTTPClient( "issueTracking.collectionTicketsDelete", ); 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.issueTracking.collectionTickets.delete({ ticketId: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", collectionId: "apideck-io", }); expect(result.httpMeta.response.status).toBe(200); expect(result.deleteTicketResponse).toBeDefined(); expect(result.deleteTicketResponse).toEqual({ statusCode: 200, status: "OK", service: "jira", resource: "Tickets", operation: "add", data: { id: "12345", }, }); });