This commit enforces proper SKU validation, uses the SKU as the Shopify handle, and implements ID-based product updates to allow renaming. It also extracts the IShop interface for TDD.
14 lines
810 B
TypeScript
14 lines
810 B
TypeScript
import * as shopify from "shopify-admin-api-typings";
|
|
import { Config } from "../config";
|
|
|
|
export interface IShop {
|
|
GetProductBySku(sku: string): any; // Return type is inferred as product node
|
|
GetProductById(id: string): any; // New method
|
|
GetInventoryItemBySku(sku: string): shopify.InventoryItem;
|
|
UpdateInventoryItemQuantity(item: shopify.InventoryItem, delta: number, config: Config): shopify.InventoryItem;
|
|
SetInventoryItemQuantity(item: shopify.InventoryItem, quantity: number, config: Config): any;
|
|
SetInventoryItemDefaults(item: shopify.InventoryItem, config: Config): shopify.InventoryItem;
|
|
SetInventoryItemWeight(item: shopify.InventoryItem, config: Config, weight: number, weight_unit: shopify.WeightUnit): shopify.InventoryItem;
|
|
shopifyGraphQLAPI(payload: any): any;
|
|
}
|