1.0.46 • Published 1 year ago

enlite-client v1.0.46

Weekly downloads
77
License
ISC
Repository
-
Last release
1 year ago

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()
1.0.46

1 year ago

1.0.45

1 year ago

1.0.44

1 year ago

1.0.43

1 year ago

1.0.42

2 years ago

1.0.40

2 years ago

1.0.41

2 years ago

1.0.39

2 years ago

1.0.38

2 years ago

1.0.37

3 years ago

1.0.36

3 years ago

1.0.35

3 years ago

1.0.34

3 years ago

1.0.33

3 years ago

1.0.32

3 years ago

1.0.31

3 years ago

1.0.29

3 years ago

1.0.30

3 years ago

1.0.28

3 years ago

1.0.27

4 years ago

1.0.26

4 years ago

1.0.25

4 years ago

1.0.24

4 years ago

1.0.23

4 years ago

1.0.22

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago