Frontend Bulk
Module for working with frontend bulk Zengine API requests and avoiding API
rate limits.
About
The methods included in this module are wrappers around the znData service,
which provides a convenient means of communication with the Zengine API.
For clarification on the znData service please refer to https://zenginehq.github.io/developers/plugins/api/services/
Installation
npm install @zenginehq/frontend-bulk --save
Usage
plugin.controller('Controller', ['$scope', 'wgnBulk', function ($scope, wgnBulk) {
$scope.deleteRecords = function deleteRecords(records) {
var delay = 1500,
params = {};
params.formId = 12345;
wgnBulk.deleteAll('FormRecords', params, records, delay)
.then(function(response) {
})
.catch(function(err) {
})
};
$scope.getAllRecords = function getAllRecords() {
var delay = 5000,
params = {
filter: JSON.stringify({ and: [{ prefix: '', attribute: 'isComplete', value: 1 }] })
};
params.formId = 12345;
wgnBulk.getAll('FormRecords', params, delay)
.then(function(response) {
})
.catch(function(err) {
})
};
$scope.updateRecords = function updateRecords(updates) {
var delay = 10000,
params = {};
params.formId = 12345;
wgnBulk.saveAll('FormRecords', params, updates, delay)
.then(function(response) {
})
.catch(function(err) {
});
};
}]);