/* * 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("Sharedlinks File Storage Shared Links All", async () => { const testHttpClient = createTestHTTPClient("fileStorage.sharedLinksAll"); 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.fileStorage.sharedLinks.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.getSharedLinksResponse).toBeDefined(); expect(result.getSharedLinksResponse).toEqual({ statusCode: 200, status: "OK", service: "dropbox", resource: "Shared Links", operation: "all", data: [ { url: "https://www.box.com/s/vspke7y05sb214wjokpk", downloadUrl: "https://www.box.com/shared/static/rh935iit6ewrmw0unyul.jpeg", target: { id: "12345", name: "sample.jpg", type: "file", }, scope: "company", expiresAt: new Date("2022-09-30T07:43:32.000Z"), 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", }, }, }, ], }, { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, ], }, { url: "https://www.box.com/s/vspke7y05sb214wjokpk", downloadUrl: "https://www.box.com/shared/static/rh935iit6ewrmw0unyul.jpeg", target: { id: "12345", name: "sample.jpg", type: "file", }, scope: "company", expiresAt: new Date("2022-09-30T07:43:32.000Z"), 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", }, }, }, ], }, ], }, { url: "https://www.box.com/s/vspke7y05sb214wjokpk", downloadUrl: "https://www.box.com/shared/static/rh935iit6ewrmw0unyul.jpeg", target: { id: "12345", name: "sample.jpg", type: "file", }, scope: "company", expiresAt: new Date("2022-09-30T07:43:32.000Z"), 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", }, }, }, ], }, ], }, ], 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("Sharedlinks File Storage Shared Links Add", async () => { const testHttpClient = createTestHTTPClient("fileStorage.sharedLinksAdd"); 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.fileStorage.sharedLinks.create({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", sharedLink: { downloadUrl: "https://www.box.com/shared/static/rh935iit6ewrmw0unyul.jpeg", targetId: "", scope: "company", 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.createSharedLinkResponse).toBeDefined(); expect(result.createSharedLinkResponse).toEqual({ statusCode: 200, status: "OK", service: "dropbox", resource: "Shared Links", operation: "add", data: { id: "12345", }, }); }); test("Sharedlinks File Storage Shared Links One", async () => { const testHttpClient = createTestHTTPClient("fileStorage.sharedLinksOne"); 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.fileStorage.sharedLinks.get({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", fields: "id,updated_at", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getSharedLinkResponse).toBeDefined(); expect(result.getSharedLinkResponse).toEqual({ statusCode: 200, status: "OK", service: "dropbox", resource: "Shared Links", operation: "one", data: { url: "https://www.box.com/s/vspke7y05sb214wjokpk", downloadUrl: "https://www.box.com/shared/static/rh935iit6ewrmw0unyul.jpeg", target: { id: "12345", name: "sample.jpg", type: "file", }, scope: "company", expiresAt: new Date("2022-09-30T07:43:32.000Z"), 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", }, }, }, ], }, { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, ], }, }); }); test("Sharedlinks File Storage Shared Links Update", async () => { const testHttpClient = createTestHTTPClient("fileStorage.sharedLinksUpdate"); 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.fileStorage.sharedLinks.update({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", sharedLink: { downloadUrl: "https://www.box.com/shared/static/rh935iit6ewrmw0unyul.jpeg", targetId: "", scope: "company", 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.updateSharedLinkResponse).toBeDefined(); expect(result.updateSharedLinkResponse).toEqual({ statusCode: 200, status: "OK", service: "dropbox", resource: "Shared Links", operation: "update", data: { id: "12345", }, }); }); test("Sharedlinks File Storage Shared Links Delete", async () => { const testHttpClient = createTestHTTPClient("fileStorage.sharedLinksDelete"); 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.fileStorage.sharedLinks.delete({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", }); expect(result.httpMeta.response.status).toBe(200); expect(result.deleteSharedLinkResponse).toBeDefined(); expect(result.deleteSharedLinkResponse).toEqual({ statusCode: 200, status: "OK", service: "dropbox", resource: "Shared Links", operation: "delete", data: { id: "12345", }, }); });