Skip to content

Latest commit

 

History

History
46 lines (32 loc) · 1.62 KB

README.md

File metadata and controls

46 lines (32 loc) · 1.62 KB

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