1.0.46 • Published 2 years ago

enlite-client v1.0.46

Weekly downloads
77
License
ISC
Repository
-
Last release
2 years 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

2 years ago

1.0.45

2 years ago

1.0.44

3 years ago

1.0.43

3 years ago

1.0.42

3 years ago

1.0.40

3 years ago

1.0.41

3 years ago

1.0.39

3 years ago

1.0.38

3 years ago

1.0.37

4 years ago

1.0.36

4 years ago

1.0.35

4 years ago

1.0.34

4 years ago

1.0.33

4 years ago

1.0.32

4 years ago

1.0.31

4 years ago

1.0.29

4 years ago

1.0.30

4 years ago

1.0.28

4 years ago

1.0.27

5 years ago

1.0.26

5 years ago

1.0.25

5 years ago

1.0.24

5 years ago

1.0.23

5 years ago

1.0.22

5 years ago

1.0.21

5 years ago

1.0.20

5 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago