zoho-inv-connect
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

zoho-inv-connect

Connect to zoho inventory

Only Zoho India API's are supported, because the API urls are hard coded 😴

Get all items

const REFRESH_TOKEN = 'Zoho refresh token'
const CLIENT_ID = 'Zoho client ID'
const CLIENT_SECRET = 'Zoho client secret'

const inventory = new ZohoInventory(
    {
        refreshToken: REFRESH_TOKEN,

        clientId: CLIENT_ID,

        clientSecret: CLIENT_SECRET
    }
);

(async () => {
    // Run init before calling other methods
    await inventory.init()
    
    // Get all items in inventory
    const data = await inventory.getItems()
})();

Add a stock adjustment

const REFRESH_TOKEN = 'Zoho refresh token'
const CLIENT_ID = 'Zoho client ID'
const CLIENT_SECRET = 'Zoho client secret'

const inventory = new ZohoInventory(
    {
        refreshToken: REFRESH_TOKEN,

        clientId: CLIENT_ID,

        clientSecret: CLIENT_SECRET
    }
);

(async () => {
    // Run init before calling other methods
    await inventory.init()
    
    // Add 100 units of an item to stock
    const data = await inventory.adjust({
        date: curDate, adjustment_type: 'quantity', reason: 'Store credit', line_items: [
            {
                item_id: 'PRODUCT_ID',
                quantity_adjusted: 100
            }
        ]
    })
})();

Readme

Keywords

Package Sidebar

Install

npm i zoho-inv-connect

Weekly Downloads

1

Version

0.1.0

License

ISC

Unpacked Size

29.2 kB

Total Files

11

Last publish

Collaborators

  • avastava