@citybrewcoffee/toast-api-wrapper
v1.7.0
Published
NodeJS wrapper for Toast APIs
Downloads
22
Readme
Toast API Wrapper
Wraps a few Toast REST API endpoints for usage in NodeJS. It was built primarily for internal use at City Brew Coffee (https://citybrew.com), but if you find it useful feel free to contribute.
Features
- Written fully in Typescript and provides type definitions for all objects
- Very simple to use - no API clients to create
- Low overhead - uses node fetch for HTTP requests
Usage
If using typescript:
- Import the functions and objects you wish to use. Example:
import { getOrders, requestNewToken, getOrderDetails, Check, Selection } from 'toast-api-wrapper';
To generate a token, use the 'requestNewToken' function. Remember: never store your client secret in sourcecode!
For every function, the first paramter is a
FunctionParameters
object. This wraps the hostname, access token, and restaurant guid together and can be reused in multiple calls.Every function returns a promise with the function's payload. Chain with
.then((result) => /* do stuff */)
or useasync/await
.Just call functions and use their results. It's that easy!