agent-stats

0.0.3 • Public • Published

agent-stats

Fetch stats from the agent-stats.com API.

See api-docs for response details.

Requires nodejs 8.x

Usage

Install

npm i agent-stats

Initialize.

const AgentStats = require('agent-stats');
var agentStats = new AgentStats(apikey);

Change api-key or api-base-uri.

agentStats.apiKey = 'new-key';
agentStats.apiBase = 'https://example.com/agentstats';

Example: Retrieve groups associated with API-key's user

agentStats.getGroups().then(function (result) {
	console.log(result);
}).catch((err) => {
	console.error(err);
});

Available methods. Each method returns a promise.

Returns Method API call
Promise getGroups() #api-Groups-listGroups
Promise getPending(group_id) #api-Groups-getPendingUsers
Promise getGroupProgress(group_id, type?) #api-Groups-showGroup
Promise getShares() #api-Medals-share
Promise getShare(username, startdate?) #api-Medals-sharedProgress
Promise requestGroupRefresh(group_id) #api-Groups-requestRefresh
Promise getMedals() #api-Medals-medals
Promise getProgress(startdate?) #api-Medals-progress

Readme

Keywords

none

Package Sidebar

Install

npm i agent-stats

Weekly Downloads

4

Version

0.0.3

License

ISC

Unpacked Size

4.66 kB

Total Files

4

Last publish

Collaborators

  • eisfrei