diff --git a/src/clients/EcomTypes.ts b/src/clients/EcomTypes.ts index a2bb1f4..32837a0 100644 --- a/src/clients/EcomTypes.ts +++ b/src/clients/EcomTypes.ts @@ -33,6 +33,16 @@ export type ResourceLink = { }; }; +export type ImageResource = { + createdAt: string; + updatedAt: string; + extension: string; + size: number; + title: string; + thumb: string; + src: string; +}; + export type PaymentData = { method: string; }; @@ -239,3 +249,36 @@ export type ProductVariant = { weightUnit: string; weightValue: string; }; + + +export type Product = { + id: number; + createdAt: string; + updatedAt: string; + isVisible: boolean; + visibility: string; + hasMatrix: boolean; + data01: string; + data02: string; + data03: string; + url: string; + title: string; + fulltitle: string; + description: string; + content: string; + set: boolean; + brand: ResourceLink; + categories: ResourceLink; + deliverydate: boolean; + image: ImageResource; + images: ResourceLink; + relations: ResourceLink; + metafields: ResourceLink; + reviews: ResourceLink; + type: boolean; + attributes: ResourceLink; + supplier: ResourceLink; + tags: ResourceLink; + variants: ResourceLink; + movements: ResourceLink; +}; \ No newline at end of file diff --git a/src/clients/LightspeedEcomApi.ts b/src/clients/LightspeedEcomApi.ts index b3c334c..105687c 100644 --- a/src/clients/LightspeedEcomApi.ts +++ b/src/clients/LightspeedEcomApi.ts @@ -1,6 +1,6 @@ import axios, { AxiosInstance } from 'axios'; import EcomApiCursor from '../utils/EcomApiCursor'; -import { Account, Order, OrderProduct, ProductVariant } from './EcomTypes'; +import { Account, Order, OrderProduct, ProductVariant, Product } from './EcomTypes'; type ClusterId = 'eu1' | 'EU1' | 'us1' | 'US1'; @@ -88,6 +88,15 @@ class LightspeedEcomApi { const response = await this.axiosClient.get(`variants/${variantId}.json`); return response.data.variant as ProductVariant; } + + getVariantsAllProducts(): EcomApiCursor { + return new EcomApiCursor('variants', this.axiosClient, 'variants'); + } + + getProducts(): EcomApiCursor { + return new EcomApiCursor('products', this.axiosClient, 'products'); + } + } export default LightspeedEcomApi;