A node.js wrapper for the New Zealand based Hell Pizza API.
Note: I am not in anyway affiliated with hell pizza, this was created just for fun.
npm install --save hell-pizza-api
Run npm test
 Â
var hellPizza = require('hell-pizza-api')
var store_id = 1
hellPizza.Menu.getPizzas(store_id, function (err, response) {
if (err) //handle err
//response is an array, contains items in the pizza menu
})
callback
takes err
and response
arguments.
Response gives menu items and store_info on the menu specified by store_id.
Gets all items for a store.
Gets all pizzas for a store.
Gets all sides for a store.
Gets all soft drinks for a store.
Gets all desserts for a store.
Gets all.. ick.. salads.. for a store.
Gets all alcoholic drinks for a store.
hellPizza.User.login(email, password, function (err, response) {
if (err) //handle err
//response contains auth token and other login/auth info
})
callback
takes err
and response
arguments.
Check if a user exists in database by provided email string.
Login as a user with provided email and password. Response includes auth token and other user details.
Register as a user with provided string parameters.
Gets all formatted addresses for an address query. Formatted addresses contain location_hash that can be used to easily find nearby stores.
hellPizza.User.findAddress(address_query, function (err, response) {
if (err) //handle err
//response contains valid addresses that match query
var address_response = response[0]
hellPizza.Store.getServiceableStores(address_response.location_hash, function (err, response) {
if (err) //handle err
//response contains nearby available stores. Max limit 4.
})
})
callback
takes err
and response
arguments.
Gets all stores in the database.
Gets all stores for a provided region.
Access region list through Store.region_list
"region_list": {
"AUCKLAND": "auckland",
"NORTHLAND": "northland",
"BAY_OF_PLENTY": "bay-of-plenty",
"WAIKATO": "waikato",
"TAUPO": "taupo",
"TARANAKI": "taranaki",
"HAWKES_BAY": "hawkes-bay",
"MANAWATU": "manawatu",
"WAIRAPA": "wairapa",
"WELLINGTON": "wellington",
"NELSON": "nelson",
"CANTERBURY": "canterbury",
"TIMARU": "timaru",
"QUEENSTOWN": "queenstown",
"OTAGO": "otago",
"SOUTHLAND": "southland"
}
Gets all stores in service from provided location_hash.
Gets nearest store from provided lat lng location.
hellPizza.Order.initOrder(order_type_id, store_id, function (err, response) {
if (err) //handle err
//response contains order_id and order token.
})
hellPizza.Order.addItem(order_token, item_id, item_size_id, item_quantity, modifiers, notes, function (err, response) {
if (err) //handle err
//response contains your updated order
})
callback
takes err
and response
arguments.
Instantiates an order on the API, taking an order_type_id and a store ID. Response contains generated order_id and order token.
"order_type": {
"PICKUP": 1,
"DELIVERY": 2
},
Gets your current order with provided (order) token string
Order.addItem(token, item_id, item_size_id, item_quantity, modifiers, notes, callback) (token, callback)
Adds an item to an existing order. Takes as parameters the order token, the id of the item you wish to add, the applicable size of the item, quantity, and any modifiers or notes.
Removes an item in your order. Takes the order token and order_item_id as parameters.
Updates the designated store_id for an order. Takes the order token, order_id, and new store_id as parameters.
Updates the designated collection time for an order. Takes the order token, order_id, and new_time as parameters.
Updates the designated collection time for an order. Takes the order token, order_id, and type as parameters. Type integer value of pickup or delivery.
"order_type": {
"PICKUP": 1,
"DELIVERY": 2
},
Applies provided voucher_code to an order. Takes the order token, voucher_code string as parameters.
Clears the voucher_code of an order. Takes the order token as a parameter.
Places your order. Takes the order token, and store_payment_id as parameters. Currently only supports non virtual card orders (Cash on delivery or pay on pickup)