/* * 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("Apideck Customers Ecommerce Customers All", async () => { const testHttpClient = createTestHTTPClient("ecommerce.customersAll"); 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.ecommerce.customers.list({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", filter: { email: "elon@musk.com", phoneNumber: "111-111-1111", }, passThrough: { "search": "San Francisco", }, fields: "id,updated_at", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getEcommerceCustomersResponse).toBeDefined(); expect(result.getEcommerceCustomersResponse).toEqual({ statusCode: 200, status: "OK", service: "shopify", resource: "customers", operation: "all", data: [ { id: "12345", name: "John Doe", firstName: "John", lastName: "Doe", companyName: "Acme Inc.", status: "active", currency: "USD", emails: [ { id: "123", email: "elon@musk.com", type: "primary", }, { id: "123", email: "elon@musk.com", type: "primary", }, ], phoneNumbers: [ { id: "12345", countryCode: "1", areaCode: "323", number: "111-111-1111", extension: "105", type: "primary", }, { id: "12345", countryCode: "1", areaCode: "323", number: "111-111-1111", extension: "105", type: "primary", }, { id: "12345", countryCode: "1", areaCode: "323", number: "111-111-1111", extension: "105", type: "primary", }, ], addresses: [ { type: "billing", id: "12345", line1: "Main street", line2: "apt #", city: "Anytown", state: "Ohio", postalCode: "12345", country: "US", }, ], orders: [ { id: "12345", total: "199.99", status: "active", }, ], createdAt: new Date("2020-09-30T07:43:32.000Z"), updatedAt: new Date("2020-09-30T07:43:32.000Z"), }, { id: "12345", name: "John Doe", firstName: "John", lastName: "Doe", companyName: "Acme Inc.", status: "active", currency: "USD", emails: [ { id: "123", email: "elon@musk.com", type: "primary", }, ], phoneNumbers: [ { id: "12345", countryCode: "1", areaCode: "323", number: "111-111-1111", extension: "105", type: "primary", }, { id: "12345", countryCode: "1", areaCode: "323", number: "111-111-1111", extension: "105", type: "primary", }, ], addresses: [ { type: "billing", id: "12345", line1: "Main street", line2: "apt #", city: "Anytown", state: "Ohio", postalCode: "12345", country: "US", }, { type: "billing", id: "12345", line1: "Main street", line2: "apt #", city: "Anytown", state: "Ohio", postalCode: "12345", country: "US", }, ], orders: [ { id: "12345", total: "199.99", status: "active", }, ], createdAt: new Date("2020-09-30T07:43:32.000Z"), updatedAt: new Date("2020-09-30T07:43:32.000Z"), }, { id: "12345", name: "John Doe", firstName: "John", lastName: "Doe", companyName: "Acme Inc.", status: "active", currency: "USD", emails: [ { id: "123", email: "elon@musk.com", type: "primary", }, { id: "123", email: "elon@musk.com", type: "primary", }, { id: "123", email: "elon@musk.com", type: "primary", }, ], phoneNumbers: [ { id: "12345", countryCode: "1", areaCode: "323", number: "111-111-1111", extension: "105", type: "primary", }, ], addresses: [ { type: "billing", id: "12345", line1: "Main street", line2: "apt #", city: "Anytown", state: "Ohio", postalCode: "12345", country: "US", }, ], orders: [ { id: "12345", total: "199.99", status: "active", }, { id: "12345", total: "199.99", status: "active", }, { id: "12345", total: "199.99", status: "active", }, ], 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=", }, }, 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("Apideck Customers Ecommerce Customers One", async () => { const testHttpClient = createTestHTTPClient("ecommerce.customersOne"); 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.ecommerce.customers.get({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", fields: "id,updated_at", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getEcommerceCustomerResponse).toBeDefined(); expect(result.getEcommerceCustomerResponse).toEqual({ statusCode: 200, status: "OK", service: "shopify", resource: "customers", operation: "one", data: { id: "12345", name: "John Doe", firstName: "John", lastName: "Doe", companyName: "Acme Inc.", status: "active", currency: "USD", emails: [ { id: "123", email: "elon@musk.com", type: "primary", }, { id: "123", email: "elon@musk.com", type: "primary", }, { id: "123", email: "elon@musk.com", type: "primary", }, ], phoneNumbers: [ { id: "12345", countryCode: "1", areaCode: "323", number: "111-111-1111", extension: "105", type: "primary", }, { id: "12345", countryCode: "1", areaCode: "323", number: "111-111-1111", extension: "105", type: "primary", }, ], addresses: [ { type: "billing", id: "12345", line1: "Main street", line2: "apt #", city: "Anytown", state: "Ohio", postalCode: "12345", country: "US", }, { type: "billing", id: "12345", line1: "Main street", line2: "apt #", city: "Anytown", state: "Ohio", postalCode: "12345", country: "US", }, ], orders: [ { id: "12345", total: "199.99", status: "active", }, { id: "12345", total: "199.99", status: "active", }, ], createdAt: new Date("2020-09-30T07:43:32.000Z"), updatedAt: new Date("2020-09-30T07:43:32.000Z"), }, }); });