🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

enlite-client

Package Overview
Dependencies
Maintainers
2
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

enlite-client

darkpos enlite client

latest
npmnpm
Version
1.0.46
Version published
Maintainers
2
Created
Source

Dark Enlite Client Library

Use this package to access Dark Enlite services.

Example

const Enlite = require('enlite-client');

async function test() {
  const enlite = new Enlite({
    url: `https://enlite-service-broker.darkpos.io`
  })

  // session
  console.log(`>> SESSION >>`);
  const session = await enlite.session.login('employee@domain.com', 'mypassword');
  console.log(`User Id: ${session.data.user.user_id}`);

  // store
  console.log(`\n>> STORE >>`);
  const store = await enlite.store.getStore(session.data.user.firm_id, session.data.user.store_id);
  console.log(`Store Name: ${store.data.store.name}`);

  // customer
  console.log(`\n>> CUSTOMER >>`);
  console.log(`\n>> Create Customer >>`);
  const created = await enlite.customer.createCustomer(session.data.user.store_id, {
    first_name: "Clark",
    last_name: "Kent"
  }, session.data.user.user_id);
  console.log(`Id: ${created.data.id}`);
  console.log(`Name: ${created.data.first_name} ${created.data.last_name}`);

  console.log(`\n>> Update Customer >>`);
  const updated = await enlite.customer.updateCustomer(session.data.user.store_id, created.data.id, {
    last_name: "Kent II"
  }, session.data.user.user_id);
  console.log(`Id: ${updated.data.id}`);

  console.log(`\n>> Get Customer >>`);
  const customer = await enlite.customer.getCustomer(session.data.user.store_id, updated.data.id);
  console.log(`Id: ${customer.data.info.id}`);
  console.log(`Name: ${customer.data.info.first_name} ${customer.data.info.last_name}`);
  console.log(`Tickets: ${customer.data.tickets.length}`);

  console.log(`\n>> Search Customer >>`);
  const customers = await enlite.customer.searchCustomer(session.data.user.store_id, 'kent');
  console.log(`Matches: ${customers.data.length}`);
}

test()

FAQs

Package last updated on 25 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts