Hay Steemers,
I hope that everyone of you has/had some nice Christmas days. Between visiting friends and the family, I‘ve spend my time on starting the work on a Steem-API-Wrapper for Java. I had the idea for several weeks now and also did a small prove of concept in the last week, which you can find here. In this week, the project size increased from 1 single class to 19 classes and today, I want to share the progress with you.
Git Repository
The first thing that happened is, that I’ve created repository for the project on GitHub, which you can find under the following URI:
The project is a bunch of work, so if you are already thinking „Hey dez1337, this is pretty cool – I want to help you“, feel free to fork this project directly on GitHub.
If this API-Project seems to complex, but you still want to help, you may just start to use it for your own projects and provide some feedback to me! :)
The concept
I also had to spend some thoughts about how to design this project, to make it easy to use for everybody. I ended up with a single Class called “SteemApiWrapper” who accepts a Configuration object.
The Configuration object creates the most common defaults when created, but also allows to define custom things like the websocket-Endpoint-URI if needed.
Due to this approach, the project is used like this:
package dez.steemit.com;
import dez.steemit.com.configuration.SteemApiWrapperConfig;
import dez.steemit.com.exceptions.SteemConnectionException;
import dez.steemit.com.exceptions.SteemTimeoutException;
import dez.steemit.com.exceptions.SteemTransformationException;
import dez.steemit.com.models.AccountCount;
import dez.steemit.com.models.AccountVotes;
public class SteemAPIUsageExample {
public static void main(String args[]) {
// Use the default settings
SteemApiWrapperConfig myConfig = new SteemApiWrapperConfig();
try {
SteemApiWrapper saw = new SteemApiWrapper(myConfig);
AccountVotes av = saw.getAccountVotes("dez1337");
AccountCount ac = saw.getAccountCount();
System.out.println("The user dez1337 is one of " + ac.getCount() + " users and has done " + av.getVotes().length + " votes so far.");
} catch (SteemConnectionException | SteemTimeoutException | SteemTransformationException e) {
System.out.println("An error occured!");
e.printStackTrace();
}
}
}
The example above returns the following output:
The user dez1337 is one of 122276 users and has done 151 votes so far.
Supported methods
So far, I’ve focused on the code quality and the project structure. Due to that, the project currently only supports the two methods shown above, but can now be extended very easily.
Future plans
For the next update I would like to finish the following things:
- Increase code quality
- Interpret errors of the websocket Server
- Add more methods
- Add Unit and Integration tests to the project
- Deploy the project to the Maven-Central-Repo
The last point may be the most important one to allow people to use this project. I hope that I can manage it in the upcoming days to push this project forward.
To make sure I’ll never miss one of those updates, you should press the button below.
Thank you and best regards.
that's awesome... so how much you done so far?
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Thanks for the feedback :) Have a look at the latest update post here.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Oh, you beat me to it. Nice.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit