1.0.4 • Published 5 years ago

arcdynamic-request v1.0.4

Weekly downloads
35
License
MIT
Repository
github
Last release
5 years ago

Network request wrapper for ArcDynamic services

This function handles batching & caching of ArcDynamic requests. It will can return a promise (default) or invoke a callback, depending on the import.

Example (promise):

import request from 'arcdynamic-request'

request(PATH_TO_API, {
	service: 'cart',
	action: 'store.product.get',
	schema: '[name,sku,price]',
	options: {
		limit: {
			count: 10,
			offset: 0,
		},
	},
}, {
	expires: 1000*60*60,
})
.then(res => /* do something */)
.catch(err => /* handle network error */);

Example (callback):

import request from 'arcdynamic-request/request'

request(PATH_TO_API, {
	service: 'cart',
	action: 'store.product.get',
	schema: '[name,sku,price]',
	options: {
		limit: {
			count: 10,
			offset: 0,
		},
	},
}, {
	expires: 1000*60*60,
}, function(err, res){
	if (err) {
		/* handle network error */
	} else {
		/* do something */
	}
})
1.0.4

5 years ago

1.0.3

7 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago