SteemJ V0.3.3 has been released ~ Use the Steem API in your Java Project

in #steemdev7 years ago

SteemJ v0.3.3 is now able to handle callbacks for new blocks, can be used against the Steem test network and comes with further improvements and bug fixes.


SteemJV2Logo


Previous 0.3.x releases: v0.3.2 v0.3.1 v0.3.0

SteemJ v0.3.3 has been released

Hello Steemians!

I am pleased to announce the next release of SteemJ. This release adds the subscription feature to SteemJ that was already planned for a long time. It can be used to be automatically be informed about new, processed blocks. Beside that @ismelykh pointed out that SteemJ is not able to work against the Test-Network. This is now possible. Beside that, several improvements and bug fixes have been made.

Applied Block Callback

Sadly, using callbacks is a little bit more complicated than just using an Api method. That’s why we start with a first small how to.

A Steem Node provides a feature to notify you about every new block. This Wiki-Page describes how to setup those notifications in SteemJ.

The first thing you need is your own implementation of the BlockAppliedCallback class.

import eu.bittrade.libs.steemj.base.models.SignedBlockHeader;
import eu.bittrade.libs.steemj.communication.BlockAppliedCallback;

public class MyCustomCallback extends BlockAppliedCallback {

    @Override
    public void onNewBlock(SignedBlockHeader signedBlockHeader) {
        System.out.println(signedBlockHeader.toString());
    }

}

As you can see, extending the BlockAppliedCallback class forces you to implement the onNewBlock method. This method is automatically called by SteemJ if a notification is received from the Steem Node.

The last thing you need to do is to make the Steem Node and SteemJ aware of your implementation by passing it to the API.

MyCustomCallback myCallback = new MyCustomCallback();
steemApiWrapper.setBlockAppliedCallback(myCallback);

Code Quality


SonarQube

What is new?

Below you can find all changes made in this release.

Functional Updates

  • The following issues have been fixed:
    • #54 Implement the applied block callback.
    • #60 Enable Test-Network support.
    • #42 Implement core id types (e.g. block_id_type) to offer additional functionalities and a more accurate parsing.
    • Finally fix #36 Could not create a Post with SteemJ 0.3.2.
    • Finalize fix of #55 CustomOperation do not work.
      • CustomJsonOperation has been fixed so it is finally possible to follow/unfollow other accounts and to reblog posts with SteemJ.
      • CustomOperation fixed
      • CustomBinaryOperation fixed

Code Quality Improvements

  • Additional integration tests have been added.

Documentation

General information

What is SteemJ?

SteemJ is a project that allows you to communicate with a Steem node using Java. So far, the project supports most of the API calls and is also able to broadcast most of the common operation types. Further information can be found on GitHub.

https://github.com/marvin-we/steem-java-api-wrapper

How to add it to your project?

SteemJ binaries are pushed into the maven central repository and can be integrated with a bunch of build management tools like Maven. The Wiki provides a lot of examples for the most common build tools. If you do not use a build management tool you can download the binaries as described here.

Contribute

The project became quite big and there is still a lot to do. If you want to support the project simply clone the git repository and submit a pull request. I would really appreciate it =).

git clone https://github.com/marvin-we/steem-java-api-wrapper.git

Get in touch!

Most of my projects are pretty time consuming and I always try to provide some useful stuff to the community. What keeps me going for that is your feedback and your support. For that reason I would love to get some Feedback from you <3. Just contact me here on Steemit or ping me on GitHub.


If you want to stay up to date or just like the stuff I am doing it would be great if you could press the button below =).



follow me

Thanks for reading and best regards,
@dez1337

Sort:  

Do you know what I need to give as an argument for follow_type in follow_api get_followers()?

Hay @jbp,

Yes, you need to provide the account to get the followers for, a string describing for what you want to get the followers for and the number of results: "dez1137", "blog", 100

This will return the first 100 accounts of people following my blog :)

You can find a sample with SteemJ here at line 500.

Best regards!

Thanks alot!

Is there also a method to get all voters of a post? I don't see any.

Great job. Is it possible to create a post ? if yes, do you have example to provide ?

Hello @tyvain ,

yes, this is actually already possible :) Sadly, the documentation is not really ready, so you will need to put some pieces together:

  • Please have a look at this sample on GitHub
  • This sample shows how to work with Operations in general. Instead of VoteOperation, you want to use a CommentOperation like shown in this sample
  • To post a new comment, you need to set the parentAuthor to an empty account like discussed and shown in this GitHub issue

It is currently planned to improve this a lot with the upcoming versions.

Thank you for your interest in SteemJ and I hope that this answer helps you to implement your project ideas.

Best regards!

Thank you for the answer. I will test that. If it works, I can send you a sample code for the documentation.

I am almost there.
But there is still a bug.
-> I submit an issue: https://github.com/marvin-we/steem-java-api-wrapper/issues/67

Thank you for reporting the issue :) I've replied to the ticket.

Great stuff, thanks for the effort you put into making developing for Steem easier!

hi @dez1337,
great work, thank you very much for the effort you made in developing this API.
i am a Java developer, so i appreciate your work and your efforts.
i am new in the steem and steemit world, i currently trying to understand the crypto-currencies and block chain fundamentals and steem network working.
and when i get ready i will clone your github repo, and see if i can help and contribute in the project.
i will contact you soon (incha-allah)

Hay @alilosoft ,

Thank you for your nice words. Good luck for your learning process :) looking forward to see some pullrequests from you 😊😊

Thank you very much for work for the community.
Upvoted, repost and following.
Regards.

wow! this is a continuous improvement to the steemit community as a whole , steemj will certainly kick off fiverr and upwork #welovesteemj

Great!

informative post, thank you for sharing!

I don't know what this is by it sounds important so Ill upvote it!

Test 0.3.3 (bot)

This is a test

wow Very interesting . Upvoted and resteemed :-) plz give me upvote