All Projects → SidLeeParis → sidLeeAgenceConnectee

SidLeeParis / sidLeeAgenceConnectee

Licence: other
sidlee.herokuapp.com/

Programming Languages

HTML
75241 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects
ApacheConf
554 projects
Makefile
30231 projects

Build Status Test Coverage

Using the JS api

Connect a client:

var client = new SidLeeClient('http://dashboard.sidlee.com/', function(data) {
	console.log(data);
});

The function passed as a callback will be called each time a new event is received.

Request the events of the day

client.today().exec(function(data) {
	console.log(data);
});

data returns an aggregated view of the events of the current day (6am to 6am):

[
	{
		"_id": "visits",
		"value": 2
	},
	{
		"_id": "likes",
		"value": 86818
	},
	{
		"_id": "undo",
		"value": 160,
		"date": "DATE_OF_LAST_EVENT",
		"app": "my app",
		"user": "user"
	}
]

For each sensors, and APIs, the client returns an object containing the name of the event and a value, which can be a sum or an average, according to the sensor configuration. The undo event is a particular one since it also returns the last undo event (date, app and user).

The list of the sensors and APIs is available here.

Request the events of the last 24h

client.last24().exec(function(data) {
	console.log(data);
});

data returns an object containing an aggregated view of the events that happened during the last 24h. The events are sorted by hour ranges.

[
	{
		"_id": "red",
		"values": [
			{
				"hourAgo": 0,
				"value": 1
			},
			{
				"hourAgo": 12,
				"value": 5
			},
			{
				"hourAgo": 17,
				"value": 14
			},
			{
				"hourAgo": 18,
				"value": 2
			},
			{
				"hourAgo": 21,
				"value": 12
			},
			{
				"hourAgo": 22,
				"value": 2
			}
		]
	},
	...
]

It returns a sum or an average, hour by hour. In the example, 1 "red" event happened in the running hour, 5 "red" event happened 12h ago, and so on.

Request the events of the last 30 days

client.last30().exec(function(data) {
	console.log(data);
});

Similar to last 24, but the sum or average is a daily one: hourAgo becomes dayAgo.

It' a fluent interface API, so don't forget to call exec in order to execute the request!

A jsfiddle: http://jsfiddle.net/07acad0b/6/

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].