EasySteem v1.1, come enjoy the new features!

in #utopian-io6 years ago (edited)

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

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

Sort:  

Hey @harpagon I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

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

Upvote this notification to help all Steemit users. Learn why here!

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!

Do you like SteemitBoard's project? Vote for its witness and get one more award!

Coin Marketplace

STEEM 0.26
TRX 0.11
JST 0.032
BTC 63510.75
ETH 3065.54
USDT 1.00
SBD 3.82