@dotdev/harmony-sdk
v1.10.0
Published
Harmony API SDK
Downloads
610
Readme
Harmony SDK
Harmony SDK is a TypeScript library for interacting with the Harmony API. It provides a set of modules to perform various operations such as authentication, stock lookup, stock level lookup, point of sale operations, carrier management, diary management, and gift voucher handling.
Table of Contents
Installation
To install the Harmony SDK, use the following command:
npm install @dotdev/harmony-sdk
or if you're using pnpm:
pnpm add @dotdev/harmony-sdk
Usage
Here's a basic example of how to use the Harmony SDK:
import { HarmonyAPI, AuthenticationToken } from "@dotdev/harmony-sdk";
const api = new HarmonyAPI("https://your-harmony-api-url.com");
async function main() {
const authToken: AuthenticationToken = {
// Fill in your authentication details
};
try {
const sessionId = await api.authenticate(authToken);
console.log("Authenticated successfully. Session ID:", sessionId);
// Example: Perform a stock lookup
const stockLookupParams = {
// Fill in your stock lookup parameters
};
const stockResults = await api.stockLookup(stockLookupParams, sessionId);
console.log("Stock lookup results:", stockResults);
// Use other methods as needed...
} catch (error) {
console.error("Error:", error);
}
}
main();
Development
To set up the development environment:
Clone the repository:
git clone [email protected]:dotcollectiveanz/harmony-sdk.git cd harmony-sdk
Install dependencies:
pnpm install
Build the project:
pnpm run build
Run tests:
pnpm test
To watch for changes during development:
pnpm run watch
Implemented Endpoints
The Harmony SDK implements the following endpoints:
Authentication
authenticate(authToken: AuthenticationToken): Promise<string>
Stock Lookup Module
stockLookup(params: StockLookupRequestParams, sessionId: string): Promise<Stock[]>
stockCategoryLookup(sessionId: string): Promise<StockCategory[]>
stockBarcodeLookup(params: StockLookupRequestParams, sessionId: string): Promise<StockBarcode[]>
stockColorLookup(sessionId: string): Promise<StockColor[]>
sizeGridLookup(sessionId: string): Promise<SizeGrid[]>
stockClassificationLookup(sessionId: string, searchType?: StockClassificationType): Promise<StockClassification[]>
Stock Level Lookup Module
warehouseLookup(sessionId: string): Promise<Warehouse[]>
stockLevelLookup(params: StockLevelLookupQueryParams, sessionId: string): Promise<StockLevel[]>
stockLevelLookupByWarehouseQuickView(params: StockLevelLookupQueryParams, sessionId: string): Promise<StockLevel[]>
Point of Sale Module
processSalesOrder(params: ProcessSaleOrderQueryParams, sessionId: string): Promise<boolean>
Carrier Module
getCarrier(sessionId: string): Promise<Carrier[]>
getCarrierShipmentByOrderNo(orderNo: string, sessionId: string): Promise<CarrierShipment[]>
getCarrierBySysTime(params: GetCarrierShipmentByTimeQueryParams, sessionId: string): Promise<CarrierShipment[]>
Diary Module
getDiaryBy(params: GetDiaryQueryParams, sessionId: string): Promise<Diary[]>
createDiary(params: CreateDiaryQueryParams, sessionId: string): Promise<boolean>
Gift Voucher Module
giftVoucherLookup(params: GiftVoucherLookupQueryParams, sessionId: string): Promise<GiftVoucher[]>
giftVoucherVerificationKey(params: GiftVoucherVerificationKeyQueryParams, sessionId: string): Promise<string>
giftVoucherReservation(params: GiftVoucherReservationQueryParams, sessionId: string): Promise<string>
giftVoucherUsed(params: GiftVoucherUsedQueryParams, sessionId: string): Promise<number>
For detailed information on each endpoint and its parameters, please refer to the source code and type definitions.