@zenginehq/frontend-bulk

1.0.4 • Public • Published

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) {
        //do something with the response
      })
      .catch(function(err) {
        //handle the error
      })
  };

  $scope.getAllRecords = function getAllRecords() {
    var delay = 5000,
        params = {
          // Note that filters should be stringified
          filter: JSON.stringify({ and: [{ prefix: '', attribute: 'isComplete', value: 1 }] })
        };

    params.formId = 12345;
    
    wgnBulk.getAll('FormRecords', params, delay)
      .then(function(response) {
        //do something with the response
      })
      .catch(function(err) {
        //handle the error
      })
  };

  $scope.updateRecords = function updateRecords(updates) {
    var delay = 10000,
        params = {};

    params.formId = 12345;

    wgnBulk.saveAll('FormRecords', params, updates, delay)
      .then(function(response) {
        //do something with the response
      })
      .catch(function(err) {
        //handle the error
      });
  };
}]);

Package Sidebar

Install

npm i @zenginehq/frontend-bulk

Weekly Downloads

6

Version

1.0.4

License

MIT

Unpacked Size

8.29 kB

Total Files

5

Last publish

Collaborators

  • chris.manjoine
  • dwmcnelis-wizehive
  • wizehive-jeremyf