Skip to content

Sourcewiz/typescript-sdk

Repository files navigation

WizCommerce SDK

WizCommerce SDK is a modular TypeScript/JavaScript client for the WizCommerce API, supporting all major resources (customers, products, orders, invoices, attributes, inventory, payment methods, price lists, product pricing, sales reps, shipments) with type-safe DTOs, pagination, and robust error handling.

Table of Contents

Installation

npm install wizcommerce

Usage

import { WizCommerce } from "wizcommerce";

const wiz = new WizCommerce(WizCommerce.PRODUCTION, "<API_KEY>");

// List customers with pagination
wiz.customer.list({ page: 1, page_size: 20 }).then(console.log);

// Create a customer
wiz.customer
  .create({
    companyName: "Acme Inc.",
    displayName: "Acme",
    referenceId: "ACME-001",
    email: "[email protected]",
    addresses: [
      /* ... */
    ],
    contacts: [
      /* ... */
    ],
    attributes: [
      /* ... */
    ],
  })
  .then(console.log);

// Error handling example
wiz.customer.get("bad-id").catch((err) => {
  console.error("API error:", err);
});

API

The WizCommerce SDK provides comprehensive access to all resources in the WizCommerce platform. Each resource has its own detailed documentation page with examples, parameter descriptions, and response formats.

Pagination

All list methods accept page and page_size parameters for paginated results. Example:

wiz.customer.list({ page: 2, page_size: 50 });

Error Handling

All SDK methods throw structured error objects with status codes and messages. Use .catch() or try/catch for async/await:

try {
  await wiz.customer.get("invalid-id");
} catch (error) {
  console.error(error.status, error.message);
}

Contributing & Support

Customer

For detailed documentation, see Customer API Documentation.

  • wiz.customer.list(params?)
  • wiz.customer.get(id)
  • wiz.customer.create(data)
  • wiz.customer.update(id, data)
  • wiz.customer.delete(id)

Customer Address

For detailed documentation, see Customer Address API Documentation.

  • wiz.customer.address.list(customerId, params?)
  • wiz.customer.address.get(customerId, addressId)
  • wiz.customer.address.create(customerId, data)
  • wiz.customer.address.update(customerId, addressId, data)
  • wiz.customer.address.delete(customerId, addressId)

Customer Contact

For detailed documentation, see Customer Contact API Documentation.

  • wiz.customer.contact.list(customerId, params?)
  • wiz.customer.contact.get(customerId, contactId)
  • wiz.customer.contact.create(customerId, data)
  • wiz.customer.contact.update(customerId, contactId, data)
  • wiz.customer.contact.delete(customerId, contactId)

Product

For detailed documentation, see Product API Documentation.

  • wiz.product.list(params?)
  • wiz.product.get(id)
  • wiz.product.create(data)
  • wiz.product.update(id, data)
  • wiz.product.delete(id)

Order

For detailed documentation, see Order API Documentation.

  • wiz.order.list(params?)
  • wiz.order.get(id)
  • wiz.order.create(data)
  • wiz.order.update(id, data)
  • wiz.order.delete(id)
  • wiz.order.patchStatus(id, data)

Invoice

For detailed documentation, see Invoice API Documentation.

  • wiz.invoice.list(params?)
  • wiz.invoice.get(id)
  • wiz.invoice.create(data)
  • wiz.invoice.update(id, data)
  • wiz.invoice.delete(id)

Attribute

For detailed documentation, see Attribute API Documentation.

  • wiz.attribute.list(params?)

Inventory

For detailed documentation, see Inventory API Documentation.

  • wiz.inventory.list(params?)
  • wiz.inventory.update(data)

Payment Method

For detailed documentation, see Payment Method API Documentation.

  • wiz.paymentmethod.list(params?)
  • wiz.paymentmethod.create(data)
  • wiz.paymentmethod.delete(id)

Price List

For detailed documentation, see Price List API Documentation.

  • wiz.pricelist.list(params?)
  • wiz.pricelist.get(id)
  • wiz.pricelist.create(data)
  • wiz.pricelist.update(id, data)
  • wiz.pricelist.delete(id)

Product Pricing

For detailed documentation, see Product Pricing API Documentation.

  • wiz.productpricing.list(params?)
  • wiz.productpricing.update(id, data)

Sales Rep (User)

For detailed documentation, see Sales Rep API Documentation.

  • wiz.salesrep.list(params?)

Shipment

For detailed documentation, see Shipment API Documentation.

  • wiz.shipment.list(params?)
  • wiz.shipment.get(params)
  • wiz.shipment.create(data)
  • wiz.shipment.update(id, data)
  • wiz.shipment.delete(params)

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •