node-nextengine
A Nodejs wrapper for the Next Engine API http://api.next-e.jp
Installation
npm i -S next-engine
Usage
please read API Document.
Authorize
See passport-nextengine source and demo application
Basic request
const Nextengine = const client = clientId: 'XXXXXXXXXX' clientSecret: 'XXXXXXXXXX' accessToken: 'XXXXXXXXXX' refreshToken: 'XXXXXXXXXX' client
Note
We strongly recommended that you don't use request
method.
Because it depends strongly on v1 specification.
Utility methods (query -> get|count|getInBatches
, create
, update
, upload
, waitFor
and uploadAndWaitFor
) are To reduce the dependency of v1.
So please use utility methods as far as possible.
Query utility
// Query by path string(ex. /api_v1_receiveorder_base/count)client // Query by Entity objectconst ReceiveOrder = client // Get recordsconst Goods = client // Get all records in batchconst ReceiveOrder = client
Create / Update utility
// Create shopconst Shop = const opts = data: ` <?xml version="1.0" encoding="utf-8"?> <root> <shop> <shop_mall_id>1</shop_mall_id> <shop_name>楽天店</shop_name> <shop_abbreviated_name>raku</shop_abbreviated_name> <shop_tax_id>1</shop_tax_id> <shop_tax_calculation_sequence_id>1</shop_tax_calculation_sequence_id> <shop_currency_unit_id>1</shop_currency_unit_id> </shop> </root> ` client // Update shopconst Shop = const opts = receive_order_id: 1 receive_order_last_modified_date: '2016/01/01 00:00:00' data: ` <?xml version="1.0" encoding="utf-8"?> <root> <receiveorder_base> <receive_order_shop_cut_form_id>12345-6789</receive_order_shop_cut_form_id> <receive_order_date>2014-05-01 00:00:00</receive_order_date> </receiveorder_base> <receiveorder_row> <receive_order_row_no value="1"> <receive_order_row_goods_name>テスト商品</receive_order_row_goods_name> <receive_order_row_cancel_flag>1</receive_order_row_cancel_flag> </receive_order_row_no> <receive_order_row_no value="2"> <receive_order_row_goods_name>テスト商品2</receive_order_row_goods_name> </receive_order_row_no> <receive_order_row_no value="3"> <receive_order_row_quantity>3</receive_order_row_quantity> </receive_order_row_no> </receiveorder_row> </root> ` client
Upload / Queue utility
const zlib = const promisify = const stringify = const deflate = const UploadQueue = input = 'syohin_code' 'jan_code' 'abc' '1234567890' // Orinput = 'syohin_code' 'jan_code' 'abc' '1234567890'
Contributing
- Fork this repository
- Create your feature branch & commit
- Create a new pull request
License
MIT