Disclaimer: Fryd is in Beta and we can not guarantee everything working. We appreciate any feedback and bug reports a lot.
This library is meant to help you implement the Fryd gamification platform into your Javascript project.
You can find an API description in german here: http://publicwiki.fryd.zone/index.php?title=Schnittstellen_Beschreibung
To use it you have to create a developer account on https://www.fryd.zone/register
Install with yarn or npm install
.
The Fryd API is limited to 10 requests per second and a burst of 20 requests right now which are defaulted to if you instantiate a Fryd class without parameters.
It is promised based and based on the request
library.
Basically you use it like this:
var Fryd = require('fryd');
var fryd = new Fryd(20, 10);
fryd.getTrophiesFromList('<token>', '<id>')
.then((r) => console.log(r))
.catch((e) => console.log(e));
Returns all trophies provided a valid trophy list id.
Returns all trophy lists provided a valid location id.
Returns the location info from a valid location id.
Returns the info provided a valid trophy id.
As the token has the user information encoded you can call this method to get all public info.
Method to post a successfull achievment. Find the trophy information in the developer dashboard.
Get all trophies a user achieved.
You can find Info to the OAuth2 implementation on Fryd here http://publicwiki.fryd.zone/index.php?title=OAuth2
Use the passport-fryd library for easy authentication in every middleware based framework like express. https://www.npmjs.com/package/passport-fryd
Use to request an access token from client credentials that you can find in the developer dashboard.
You get a code from the first OAuth2 callback if you need access to a user method (For example for authentification with Fryd directly from your application). With that code and a redirection url you can call this method to be granted an access token and refresh token.
Get a new access token from a refresh token. Access token expire after 24h and refresh token expire after 72h.