npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

doshii-sdk

v1.0.11

Published

A NodeJS wrapper for the Doshii Partner API

Downloads

62

Readme

Doshii Partner SDK NPM version Build Status Dependency Status

A wrapper for the Doshii Partner API

Our API has been designed specifically to provide seamless integration into any POS, whether cloud or legacy. Built on the cloud, our SSL-secure API provides two-way communication between the POS and any app integrated with Doshii. Simply put, we're connecting hospitality.

Looking to integrate? Check us out at Doshii.io and one of our awesome staff will hook you up with an API key.

A breakdown of all the methods available are available on the wiki page

Installation

$ npm install --save doshii-sdk
# or
$ yarn add doshii-sdk

Usage

Your clientId and clientSecret will be picked up by default if they're set in your environment variables as 'DOSHII_CLIENT_ID' and 'DOSHII_CLIENT_SECRET', both or none must be set.

I would suggest only using the default 'v3' for version. Specifying 'v2' will work for some of these methods, but reliability may be lacking.

// Initialize the library
const Doshii = require('doshii-sdk')({
  clientId: 'YOUR_DOSHII_CLIENT_ID',
  clientSecret: 'YOUR_DOSHII_CLIENT_SECRET',
  env: 'sandbox',
  version: 'v3',
  silent: false
})

// The above settings would result in a base path of https://sandbox.doshii.co/partner/v3
// The silent flag enables/disables the heartbeat console output

Both promises and callbacks are supported by this library

Doshii.Locations.retrieveAll()
  .then((result) => {
    // Do awesome stuff here
  }).catch((err) => {
    // Manage any errors here
  })

Doshii.Locations.findMenu({
  locationId: 'HASHED_LOCATION_ID' // Required
}, (err, result) => {
  if (err) // Manage any errors here
  // Do awesome stuff here
})

A breakdown of the methods available are available on the wiki page

Doshii WebSocket

This library also includes a wrapper for Doshii WebSocket events. While WebSockets aren't mandatory to make your project work and gain certification, they will make development vastly simpler. Instead of manually polling Doshii, the WebSocket will send you exactly what you're after. All you need to is listen.

// Establish a connection to the Doshii WebSocket
const DoshiiSocket = Doshii.WebSocket()
// Your authKey and environment will be generated in the same manner as you initialize the library
// It will also automatically ping the server and send a heartbeat, just to make sure it knows you're listening

// And add an error catcher in case there are any surprises
DoshiiSocket.on('error', (error) => {
  console.log(error)
})

There are a number of events which are handled by the Doshii WebSocket. A complete list can be found in the Doshii WebSocket documentation, while examples of all the methods can be found in the wiki. The underlying library is ws, more information about this lib can be found here

Here's a quick example of a socket event listener.

// Listen for the generic 'message' event. You should receive a 'pong' every 15 seconds.
DoshiiSocket.on('message', (data) => {
  console.log('message', data)
})
// Listen for the 'order_updated' event and then do stuff with it
DoshiiSocket.on('order_updated', (data) => {
  console.log('order_updated', data)
})

Contributing

We LOVE PRs. Contribution is the foundation of open source and what makes the development community so great.

In saying that, it would really help out a bunch if you follow a few guidelines before submitting a PR for this repo.

  • Please update/create then run tests (check out the /test folder). You'll need a DOSHII_CLIENT_ID and DOSHII_CLIENT_SECRET set as environment variables.
  • Please keep the coding style consistent. If you use eslint, the standard babel config is being used and will be applied when installing dependencies for this repo. Simply put, we use spaces, no trailing semi-colons and prefer nice thin functions/conditionals where reasonable.

More generic points about contributing to this repo can be found in CONTRIBUTING.md

License

© MIT

Developed by Jimmy Cann and maintained by the Doshii Team.