node-posrocket
v0.5.2
Published
Node.js wrapper for POSRocket API
Downloads
3
Readme
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*
- me.listEmployees(ordering, page, page_size) // Employee List*
- me.getEmployee(id) // Employee Details*
- me.listPaymentMethods(ordering, page, page_size) // Payment Method List*
- me.getPaymentMethod(id) // Payment Method Details*
catalog
- catalog.listCategories(ordering, page, page_size) // Category List*
- catalog.getCategory(id) // Category Detail*
- catalog.listItems(ordering, page, page_size) // Item List*
- catalog.getItem(id) // Item Detail*
- catalog.listModifierLists(name, ordering, page, page_size) // Item List*
- catalog.getModifierList(id) // Item Detail*
- catalog.listTags(name, ordering, page, page_size) // Item List*
- catalog.getTag(id) // Item Detail*
- catalog.listTaxes(name, ordering, page, page_size) // Item List*
- catalog.getTax(id) // Item Detail*
countries
- countries.list(ordering, page, page_size) // Country List*
- countries.get(id) // Country Detail*
- 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*
- directory.customers.get(id) // Customer Detail*
- directory.customers.create(payload) // Customer Create*
locations
- locations.list(ordering) // Location List*
- locations.get(id) // Location Detail*
- locations.listDiscounts(location_id, ordering, page, page_size) // Discount List*
- locations.getDiscount(location_id, discount_id) // Discount Detail*
- locations.listDrawers(location_id, ordering, page, page_size) // Drawer List*
- locations.getDrawer(location_id, drawer_id) // Drawer Detail*
- locations.listExtraCharges(location_id, name, ordering, page, page_size, type) // Extra Charge List*
- locations.getExtraCharge(location_id, extra_charge_id) // Extra Charge Detail*
- locations.listItems(location_id, name, ordering, category_id, tag_id, tax_id) // Location Item List*
- locations.getItem(location_id, item_id) // Location Item Detail*
- locations.listOrderOptions(location_id, name, ordering, page, page_size) // Order Option List*
- locations.getOrderOptions(location_id, order_option_id) // Order Option Detail*
- locations.listRegisters(location_id, ordering, page, page_size) // Register List*
- locations.getRegister(location_id, register_id) // Register Detail*
- locations.listRegisters(location_id, ordering, page, page_size) // Register List*
- locations.getRegister(location_id, register_id) // Register Detail*
- 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.listRefunds(location_id, sale_id) // Sale Refund List*
- 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.getTabTemplate(location_id, tab_temp_id) // Tab Template Detail*
- locations.getTabCategory(location_id, tab_cat_id) // Tab Category Detail*
- locations.previewTab(location_id, payload) // Tab Preview*
- locations.createTab(location_id, payload) // Tab / Order Create*
- locations.assignTabPickup(location_id, tab_id, payload) // Tab Assign Pickup*
- locations.unassignTabPickup(location_id, tab_id, payload) // Tab Unassign Pickup*
- 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.