usergrid-counters

A Node.js package to work with usergrid counter/events.

Usage no npm install needed!

<script type="module">
  import usergridCounters from 'https://cdn.skypack.dev/usergrid-counters';
</script>

README

usergrid-counters

A Node.js package to work with usergrid counter/events.

Version

0.0.1

Installation

npm i usergrid-counter

Methods

Create an event

You can create an event by setting the counter's name or an array to create multiple at the same time ('counterName' or ['counterName1', 'counterName2', ...]).

createEvent(counterName)

Get counter

getCounter(counterName)

Get counter by time interval

interval = {
  start_time: timeStamp,
  end_time: timeStamp,
  resolution: 'all'|'minute'|'five_minutes'|'half_hour'|'hour'|'six_day'|'day'|'week'|'month'
}

getCounterInterval(counterName, interval)

Increment/Decrease counter

increment could be positive (to increment), negative (to decrease) or 0 to reset counter

incrementCounter(counterName, increment)

Reset counter

Short method for incrementCounter(counterName, 0)

resetCounter(counterName)