npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

zecko

v0.0.15

Published

Zecko JS SDK

Downloads

25

Readme

Zecko TypeScript and JavaScript SDK

Official TypeScript and JavaScript SDK for Zecko API.

Installation

Yarn

yarn add zecko

NPM

npm install zecko

Documentation

Documentation of Zecko API and their usage is available here.

Detailed TypeScript and JavaScript docs are available here

Basic Usage

Instantiate the Zecko instance with accessToken. You can obtain the keys by contacting us at [email protected].

const zecko = new Zecko({ accessToken: 'YOUR_ACCESS_TOKEN' });

The resources can be accessed via the instance. All the methods invocations follows the namespaced signature:

{zeckoInstance}.{resourceName}.{methodName}([params])

// example
zecko.collectionClient.getById('YOUR_COLLECTION_ID');

Every resource method returns a promise. There is no callback support.

Usage examples

Collection

Get All Collections

return zecko.collectionClient.getAll();

Get Collection by ID

return zecko.collectionClient.getById('YOUR_COLLECTION_ID');

Product

Get products by collection ID

return zecko.productClient.getAllByCollectionId('YOUR_COLLECTION_ID');

Get product by ID

return zecko.productClient.getById('YOUR_PRODUCT_ID');

Cart

Get Cart by Customer ID

return zecko.cartClient.getByCustomerId('YOUR_CUSTOMER_ID');

Add to Cart

return zecko.cartClient.addToCart({
  customerId: 'YOUR_CUSTOMER_ID',
  variantId: 'YOUR_PRODUCT_VARIANT_ID',
  quantity: 'YOUR_PRODUCT_VARIANT_QUANTITY',
});

Update by ID

return zecko.cartClient.updateById('YOUR_CART_ID', {
  customer: {
    email: 'YOUR_CUSTOMER_EMAIL_ADDRESS',
  },
  shippingAddress: {
    address1: 'YOUR_CUSTOMER_ADDRESS', // For Street address or PO Box number
    address2: 'YOUR_CUSTOMER_ADDRESS', // Optional Field, For Apartment Details
    city: 'YOUR_CUSTOMER_CITY',
    country: 'YOUR_CUSTOMER_COUNTRY', // Optional Field
    countryCode: 'YOUR_CUSTOMER_COUNTRY_CODE', // Optional Field
    firstName: 'YOUR_CUSTOMER_FIRST_NAME',
    lastName: 'YOUR_CUSTOMER_LAST_NAME', // Optional Field
    phone: 'YOUR_CUSTOMER_PHONE_NUMBER',
    province: 'REGION_OF_ADDRESS', // State or district, country
    zip: 'YOUR_CUSTOMER_ZIP_CODE',
  },
  shippingLine: {
    price: {
      amount: 'PRICE_OF_SHIPPING_RATE';
    },
    title: 'TITLE_OF_SHIPPING_RATE',
  },
});

Add Discount by ID

return zecko.cartClient.addDiscountById('YOUR_CART_ID', {
  discounts: [
    {
      type: 'DISCOUNT_CODE_TYPE',
      code: 'DISCOUNT_CODE',
    },
  ],
});

Remove Discount by ID

return zecko.cartClient.removeDiscountById('YOUR_CART_ID', {
  discounts: [
    {
      type: 'DISCOUNT_CODE_TYPE',
      code: 'DISCOUNT_CODE',
    },
  ],
});

Complete Cart by ID

return zecko.cartClient.completeCartById('YOUR_CART_ID', {
  payment: {
    totalPrice: 'TOTAL_AMOUNT_OF_CART',
  },
});

Delete from Cart

return zecko.cartClient.deleteFromCart({
  customerId: 'YOUR_CUSTOMER_ID',
  variantId: 'YOUR_PRODUCT_VARIANT_ID',
  quantity: 'YOUR_PRODUCT_VARIANT_QUANTITY',
});

Delete Cart by Customer ID

return zecko.cartClient.deleteCartByCustomerId('YOUR_CUSTOMER_ID');

Order

Get Order by ID

return zecko.orderClient.getById('YOUR_ORDER_ID');

Get All Orders by Customer ID

return zecko.orderClient.getAllByCustomerId('YOUR_CUSTOMER_ID');

Inventory Unit

Cancel Inventory Unit by ID

return zecko.inventoryUnitClient.cancelById('YOUR_INVENTORY_UNIT_ID', {
  cancelReason: 'YOUR_REASON_FOR_CANCELLATION',
});

Return Inventory Unit by ID

return zecko.inventoryUnitClient.returnById('YOUR_INVENTORY_UNIT_ID', {
  returnReason: 'YOUR_REASON_FOR_RETURN',
});

Exchange Inventory Unit by ID

return zecko.inventoryUnitClient.exchangeById('YOUR_INVENTORY_UNIT_ID', {
  exchangeReason: 'YOUR_REASON_FOR_EXCHANGE',
});

Track Inventory Unit by ID

return zecko.inventoryUnitClient.trackById('YOUR_INVENTORY_UNIT_ID');
  • All examples available at https://github.com/zeckode/zecko-js-examples/tree/main/src/examples/js.
  • For detailed documentation, visit respective class docs.