node-posrocket

0.5.2 • Public • Published

NPM version

node-posrocket

Simple NodeJS wrapper for POSRocket API v1.

Getting Started

Installation

npm install node-posrocket

Setup

Basically require node-posrocket and create a token with getToken(code, client_id, client_secret, redirect_uri) function to initialize wrapper.

Example

const PR = require("node-posrocket");
const accessToken = PR.getToken(base_url, code, client_id, client_secret, redirect_uri); // to create an Access Token
const accessToken = PR.refreshToken(base_url, client_id, client_secret, refresh_token); // to refresh an expired Access Token
const posRocket = PR.initialize(base_url, accessToken); // initialize the wrapper with a created Access Token

try {
    const me = await posRocket.me.get(); // This will return the response body if the request is successful.
} catch (error) {
    // All functions throw an error if they encounter with an error.
}

Available Functions

  • getToken(base_url, code, client_id, client_secret, redirect_uri) // OAuth2*

  • refreshToken(base_url, client_id, client_secret, refresh_token) // OAuth2*

  • me

    • me.get() // ME*
  • catalog

    • catalog.listCategories(ordering, page, page_size) // Category List*
    • catalog.listItems(ordering, page, page_size) // Item List*
    • catalog.listModifierLists(name, ordering, page, page_size) // Item List*
    • catalog.listTags(name, ordering, page, page_size) // Item List*
    • catalog.listTaxes(name, ordering, page, page_size) // Item List*
  • countries

    • countries.list(ordering, page, page_size) // Country List*
    • countries.listCities(country_id, ordering, page, page_size) // City List*
    • countries.getCity(country_id, city_id) // City Detail*
  • customers

    • directory.customers.list(ordering, page, page_size) // Customer List*
  • locations

    • locations.listDiscounts(location_id, ordering, page, page_size) // Discount List*
    • locations.listDrawers(location_id, ordering, page, page_size) // Drawer List*
    • locations.listExtraCharges(location_id, name, ordering, page, page_size, type) // Extra Charge List*
    • locations.listItems(location_id, name, ordering, category_id, tag_id, tax_id) // Location Item List*
    • locations.listOrderOptions(location_id, name, ordering, page, page_size) // Order Option List*
    • locations.listRegisters(location_id, ordering, page, page_size) // Register List*
    • locations.listRegisters(location_id, ordering, page, page_size) // Register List*
    • locations.listSales(location_id, ordering, page, page_size, begin_time, end_time, creator_id, customer_id, payment_method) // Sale List*
    • locations.getSale(location_id, sale_id) // Sale Detail*
    • locations.listTabs(location_id, ordering, page, page_size, status, sequence_number) // Tab List*
    • locations.getTab(location_id, tab_id) // Tab Detail*
    • locations.listTabCategories(location_id, ordering, page, page_size) // Tab Category List*
    • locations.listTabTemplates(location_id, ordering, page, page_size) // Tab Template List*
    • locations.previewTab(location_id, payload) // Tab Preview*
    • locations.cancelTab(location_id, tab_id, payload) // Tab Cancel*
  • reports

    • reports.endOfDay(id, begin_time, end_time) // End of Day*
    • reports.summary(id, begin_time, end_time) // Summary*

Contributing

If you want to contribute to a project and make it better, your help is very welcome.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Package Sidebar

Install

npm i node-posrocket

Weekly Downloads

1

Version

0.5.2

License

MIT

Unpacked Size

53 kB

Total Files

13

Last publish

Collaborators

  • utku-fd
  • burakkilic
  • emre.alparslan