EasySteem v1.1, come enjoy the new features!
EasySteem v1.1
After releasing the first version of EasySteem I've been asked to add a few features so I implemented them and they have been released today. (link to the GitHub release 1.1)
What features did you add?
There are four main features that have been added to this version 1.1:
- the calculation of the user's bandwidth
- the calculation of the user's reputation
- the sorting of the comments
- the sorting of the votes
Usage:
1- First thing first you still need to import the library in your project
<script src="https://cdn.jsdelivr.net/gh/harpagon210/[email protected]/dist/js/easysteem.min.js"></script>
2- instantiate the library
var easysteem = new EasySteem('my.app', 'mySuperApp', '1.0.0')
3- calculate the user's bandwidth information
easysteem.me()
.then(user => {
easysteem.calculateBandwidth(user.account, 3)
.then(result => console.log(result))
})
.catch(error => console.error(error.error, error.error_description))
or
easysteem.getUserAccount('harpagon')
.then(result => {
easysteem.calculateBandwidth(result[0], 3)
.then(result => console.log(result))
})
.catch(error => console.error(error.error, error.error_description))
the result will be this object
{
bytes: {
allocated: "8.106 MB",
remaining: "8.088 MB",
used: "18.421 KB"
},
percents: {
remaining: "99.778",
used: "0.222"
}
}
4- calculate the user's reputation
easysteem.me()
.then(user => {
console.log(easysteem.calculateReputation(user.account.reputation))
})
.catch(error => console.error(error.error, error.error_description))
the result will be
51.05
5- retrieve sorted comments
by reputation
easysteem.getContentReplies(
'harpagon',
'easysteem-la-librairie-javascript-qui-va-vous-simplifier-la-vie',
EasySteem.ORDER_OPTIONS.REPUTATION)
.then((postContentReplies) => console.log(postContentReplies))
.catch(error => console.error(error.error, error.error_description))
by payout
easysteem.getContentReplies(
'harpagon',
'easysteem-la-librairie-javascript-qui-va-vous-simplifier-la-vie',
EasySteem.ORDER_OPTIONS.PAYOUT)
.then((postContentReplies) => console.log(postContentReplies))
.catch(error => console.error(error.error, error.error_description))
6- retrieve sorted votes
by reputation
easysteem.getContent('harpagon', 'easysteem-a-library-that-makes-steem-javascript-developments-easy')
.then(postContent => {
easysteem.orderVotes(postContent.active_votes, EasySteem.ORDER_OPTIONS.REPUTATION)
.then(() => console.log(postContent.active_votes))
})
.catch(error => console.error(error.error, error.error_description))
by payout
easysteem.getContent('harpagon', 'easysteem-a-library-that-makes-steem-javascript-developments-easy')
.then(postContent => {
easysteem.orderVotes(postContent.active_votes, EasySteem.ORDER_OPTIONS.PAYOUT)
.then(() => console.log(postContent.active_votes))
})
.catch(error => console.error(error.error, error.error_description))
More
- Most of the methods that return a number can now receive a parameter to choose the number of decimals to retrieve (for example the method calculateVoteValue)
- the price values are based on the tickers available on Crypto Compare, same implementation as busy.org
Docs
Live docs available on GitHub
How to contribute?
This project is open source and is available at https://github.com/harpagon210/easysteem
link to the post of the previous release
Posted on Utopian.io - Rewarding Open Source Contributors
Hey @harpagon I am @utopian-io. I have just upvoted you!
Achievements
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
Congratulations @harpagon! You have completed some achievement on Steemit and have been rewarded with new badge(s) :
Award for the number of upvotes
Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here
If you no longer want to receive notifications, reply to this comment with the word
STOP
Congratulations @harpagon! You have completed some achievement on Steemit and have been rewarded with new badge(s) :
Award for the number of upvotes
Click on any badge to view your Board of Honor.
For more information about SteemitBoard, click here
If you no longer want to receive notifications, reply to this comment with the word
STOP
Do not miss the last announcement from @steemitboard!