Skip to content

Commit bf0de9f

Browse files
committed
- Fix #139
- Work on #34 - Work on #101
1 parent 26856b7 commit bf0de9f

File tree

58 files changed

+1196
-977
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1196
-977
lines changed

core/src/main/java/eu/bittrade/libs/steemj/SteemJ.java

Lines changed: 241 additions & 239 deletions
Large diffs are not rendered by default.

core/src/main/java/eu/bittrade/libs/steemj/apis/follow/FollowApi.java

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414
import eu.bittrade.libs.steemj.base.models.AccountName;
1515
import eu.bittrade.libs.steemj.base.models.Permlink;
1616
import eu.bittrade.libs.steemj.communication.CommunicationHandler;
17-
import eu.bittrade.libs.steemj.communication.dto.RequestWrapperDTO;
17+
import eu.bittrade.libs.steemj.communication.dto.JsonRPCRequest;
1818
import eu.bittrade.libs.steemj.enums.RequestMethods;
19-
import eu.bittrade.libs.steemj.enums.SteemApis;
19+
import eu.bittrade.libs.steemj.enums.SteemApiType;
2020
import eu.bittrade.libs.steemj.exceptions.SteemCommunicationException;
21+
import eu.bittrade.libs.steemj.exceptions.SteemResponseError;
2122

2223
/**
2324
* This class implements the follow api.
@@ -55,19 +56,20 @@ private FollowApi() {
5556
* <ul>
5657
* <li>If the server was not able to answer the request in the
5758
* given time (see
58-
* {@link eu.bittrade.libs.steemj.configuration.SteemJConfig#setResponseTimeout(long)
59+
* {@link eu.bittrade.libs.steemj.configuration.SteemJConfig#setResponseTimeout(int)
5960
* setResponseTimeout})</li>
6061
* <li>If there is a connection problem.</li>
6162
* <li>If the SteemJ is unable to transform the JSON response
6263
* into a Java object.</li>
6364
* <li>If the Server returned an error object.</li>
6465
* </ul>
66+
* @throws SteemResponseError
6567
*/
6668
public static List<FollowApiObject> getFollowers(CommunicationHandler communicationHandler, AccountName following,
67-
AccountName startFollower, FollowType type, short limit) throws SteemCommunicationException {
68-
RequestWrapperDTO requestObject = new RequestWrapperDTO();
69+
AccountName startFollower, FollowType type, short limit) throws SteemCommunicationException, SteemResponseError {
70+
JsonRPCRequest requestObject = new JsonRPCRequest();
6971
requestObject.setApiMethod(RequestMethods.GET_FOLLOWERS);
70-
requestObject.setSteemApi(SteemApis.FOLLOW_API);
72+
requestObject.setSteemApi(SteemApiType.FOLLOW_API);
7173

7274
Object[] parameters = { following.getName(), startFollower.getName(), type.toString().toLowerCase(), limit };
7375
requestObject.setAdditionalParameters(parameters);
@@ -102,7 +104,7 @@ public static List<FollowApiObject> getFollowers(CommunicationHandler communicat
102104
* <ul>
103105
* <li>If the server was not able to answer the request in the
104106
* given time (see
105-
* {@link eu.bittrade.libs.steemj.configuration.SteemJConfig#setResponseTimeout(long)
107+
* {@link eu.bittrade.libs.steemj.configuration.SteemJConfig#setResponseTimeout(int)
106108
* setResponseTimeout})</li>
107109
* <li>If there is a connection problem.</li>
108110
* <li>If the SteemJ is unable to transform the JSON response
@@ -111,10 +113,10 @@ public static List<FollowApiObject> getFollowers(CommunicationHandler communicat
111113
* </ul>
112114
*/
113115
public static List<FollowApiObject> getFollowing(CommunicationHandler communicationHandler, AccountName follower,
114-
AccountName startFollowing, FollowType type, short limit) throws SteemCommunicationException {
115-
RequestWrapperDTO requestObject = new RequestWrapperDTO();
116+
AccountName startFollowing, FollowType type, short limit) throws SteemCommunicationException, SteemResponseError {
117+
JsonRPCRequest requestObject = new JsonRPCRequest();
116118
requestObject.setApiMethod(RequestMethods.GET_FOLLOWING);
117-
requestObject.setSteemApi(SteemApis.FOLLOW_API);
119+
requestObject.setSteemApi(SteemApiType.FOLLOW_API);
118120

119121
Object[] parameters = { follower.getName(), startFollowing.getName(), type.toString().toLowerCase(), limit };
120122
requestObject.setAdditionalParameters(parameters);
@@ -140,7 +142,7 @@ public static List<FollowApiObject> getFollowing(CommunicationHandler communicat
140142
* <ul>
141143
* <li>If the server was not able to answer the request in the
142144
* given time (see
143-
* {@link eu.bittrade.libs.steemj.configuration.SteemJConfig#setResponseTimeout(long)
145+
* {@link eu.bittrade.libs.steemj.configuration.SteemJConfig#setResponseTimeout(int)
144146
* setResponseTimeout})</li>
145147
* <li>If there is a connection problem.</li>
146148
* <li>If the SteemJ is unable to transform the JSON response
@@ -149,10 +151,10 @@ public static List<FollowApiObject> getFollowing(CommunicationHandler communicat
149151
* </ul>
150152
*/
151153
public static FollowCountApiObject getFollowCount(CommunicationHandler communicationHandler, AccountName account)
152-
throws SteemCommunicationException {
153-
RequestWrapperDTO requestObject = new RequestWrapperDTO();
154+
throws SteemCommunicationException, SteemResponseError {
155+
JsonRPCRequest requestObject = new JsonRPCRequest();
154156
requestObject.setApiMethod(RequestMethods.GET_FOLLOW_COUNT);
155-
requestObject.setSteemApi(SteemApis.FOLLOW_API);
157+
requestObject.setSteemApi(SteemApiType.FOLLOW_API);
156158

157159
Object[] parameters = { account.getName() };
158160
requestObject.setAdditionalParameters(parameters);
@@ -185,7 +187,7 @@ public static FollowCountApiObject getFollowCount(CommunicationHandler communica
185187
* <ul>
186188
* <li>If the server was not able to answer the request in the
187189
* given time (see
188-
* {@link eu.bittrade.libs.steemj.configuration.SteemJConfig#setResponseTimeout(long)
190+
* {@link eu.bittrade.libs.steemj.configuration.SteemJConfig#setResponseTimeout(int)
189191
* setResponseTimeout})</li>
190192
* <li>If there is a connection problem.</li>
191193
* <li>If the SteemJ is unable to transform the JSON response
@@ -194,10 +196,10 @@ public static FollowCountApiObject getFollowCount(CommunicationHandler communica
194196
* </ul>
195197
*/
196198
public static List<FeedEntry> getFeedEntries(CommunicationHandler communicationHandler, AccountName account,
197-
int entryId, short limit) throws SteemCommunicationException {
198-
RequestWrapperDTO requestObject = new RequestWrapperDTO();
199+
int entryId, short limit) throws SteemCommunicationException, SteemResponseError {
200+
JsonRPCRequest requestObject = new JsonRPCRequest();
199201
requestObject.setApiMethod(RequestMethods.GET_FEED_ENTRIES);
200-
requestObject.setSteemApi(SteemApis.FOLLOW_API);
202+
requestObject.setSteemApi(SteemApiType.FOLLOW_API);
201203

202204
Object[] parameters = { account.getName(), entryId, limit };
203205
requestObject.setAdditionalParameters(parameters);
@@ -230,7 +232,7 @@ public static List<FeedEntry> getFeedEntries(CommunicationHandler communicationH
230232
* <ul>
231233
* <li>If the server was not able to answer the request in the
232234
* given time (see
233-
* {@link eu.bittrade.libs.steemj.configuration.SteemJConfig#setResponseTimeout(long)
235+
* {@link eu.bittrade.libs.steemj.configuration.SteemJConfig#setResponseTimeout(int)
234236
* setResponseTimeout})</li>
235237
* <li>If there is a connection problem.</li>
236238
* <li>If the SteemJ is unable to transform the JSON response
@@ -239,10 +241,10 @@ public static List<FeedEntry> getFeedEntries(CommunicationHandler communicationH
239241
* </ul>
240242
*/
241243
public static List<CommentFeedEntry> getFeed(CommunicationHandler communicationHandler, AccountName account,
242-
int entryId, short limit) throws SteemCommunicationException {
243-
RequestWrapperDTO requestObject = new RequestWrapperDTO();
244+
int entryId, short limit) throws SteemCommunicationException, SteemResponseError {
245+
JsonRPCRequest requestObject = new JsonRPCRequest();
244246
requestObject.setApiMethod(RequestMethods.GET_FEED);
245-
requestObject.setSteemApi(SteemApis.FOLLOW_API);
247+
requestObject.setSteemApi(SteemApiType.FOLLOW_API);
246248

247249
Object[] parameters = { account.getName(), entryId, limit };
248250
requestObject.setAdditionalParameters(parameters);
@@ -295,7 +297,7 @@ public static List<CommentFeedEntry> getFeed(CommunicationHandler communicationH
295297
* <ul>
296298
* <li>If the server was not able to answer the request in the
297299
* given time (see
298-
* {@link eu.bittrade.libs.steemj.configuration.SteemJConfig#setResponseTimeout(long)
300+
* {@link eu.bittrade.libs.steemj.configuration.SteemJConfig#setResponseTimeout(int)
299301
* setResponseTimeout})</li>
300302
* <li>If there is a connection problem.</li>
301303
* <li>If the SteemJ is unable to transform the JSON response
@@ -304,10 +306,10 @@ public static List<CommentFeedEntry> getFeed(CommunicationHandler communicationH
304306
* </ul>
305307
*/
306308
public static List<BlogEntry> getBlogEntries(CommunicationHandler communicationHandler, AccountName account,
307-
int entryId, short limit) throws SteemCommunicationException {
308-
RequestWrapperDTO requestObject = new RequestWrapperDTO();
309+
int entryId, short limit) throws SteemCommunicationException, SteemResponseError {
310+
JsonRPCRequest requestObject = new JsonRPCRequest();
309311
requestObject.setApiMethod(RequestMethods.GET_BLOG_ENTRIES);
310-
requestObject.setSteemApi(SteemApis.FOLLOW_API);
312+
requestObject.setSteemApi(SteemApiType.FOLLOW_API);
311313

312314
Object[] parameters = { account.getName(), entryId, limit };
313315
requestObject.setAdditionalParameters(parameters);
@@ -340,7 +342,7 @@ public static List<BlogEntry> getBlogEntries(CommunicationHandler communicationH
340342
* <ul>
341343
* <li>If the server was not able to answer the request in the
342344
* given time (see
343-
* {@link eu.bittrade.libs.steemj.configuration.SteemJConfig#setResponseTimeout(long)
345+
* {@link eu.bittrade.libs.steemj.configuration.SteemJConfig#setResponseTimeout(int)
344346
* setResponseTimeout})</li>
345347
* <li>If there is a connection problem.</li>
346348
* <li>If the SteemJ is unable to transform the JSON response
@@ -349,10 +351,10 @@ public static List<BlogEntry> getBlogEntries(CommunicationHandler communicationH
349351
* </ul>
350352
*/
351353
public static List<CommentBlogEntry> getBlog(CommunicationHandler communicationHandler, AccountName account,
352-
int entryId, short limit) throws SteemCommunicationException {
353-
RequestWrapperDTO requestObject = new RequestWrapperDTO();
354+
int entryId, short limit) throws SteemCommunicationException, SteemResponseError {
355+
JsonRPCRequest requestObject = new JsonRPCRequest();
354356
requestObject.setApiMethod(RequestMethods.GET_BLOG);
355-
requestObject.setSteemApi(SteemApis.FOLLOW_API);
357+
requestObject.setSteemApi(SteemApiType.FOLLOW_API);
356358

357359
Object[] parameters = { account.getName(), entryId, limit };
358360
requestObject.setAdditionalParameters(parameters);
@@ -398,7 +400,7 @@ public static List<CommentBlogEntry> getBlog(CommunicationHandler communicationH
398400
* <ul>
399401
* <li>If the server was not able to answer the request in the
400402
* given time (see
401-
* {@link eu.bittrade.libs.steemj.configuration.SteemJConfig#setResponseTimeout(long)
403+
* {@link eu.bittrade.libs.steemj.configuration.SteemJConfig#setResponseTimeout(int)
402404
* setResponseTimeout})</li>
403405
* <li>If there is a connection problem.</li>
404406
* <li>If the SteemJ is unable to transform the JSON response
@@ -407,10 +409,10 @@ public static List<CommentBlogEntry> getBlog(CommunicationHandler communicationH
407409
* </ul>
408410
*/
409411
public static List<AccountReputation> getAccountReputations(CommunicationHandler communicationHandler,
410-
AccountName accountName, int limit) throws SteemCommunicationException {
411-
RequestWrapperDTO requestObject = new RequestWrapperDTO();
412+
AccountName accountName, int limit) throws SteemCommunicationException, SteemResponseError {
413+
JsonRPCRequest requestObject = new JsonRPCRequest();
412414
requestObject.setApiMethod(RequestMethods.GET_ACCOUNT_REPUTATIONS);
413-
requestObject.setSteemApi(SteemApis.FOLLOW_API);
415+
requestObject.setSteemApi(SteemApiType.FOLLOW_API);
414416

415417
Object[] parameters = { accountName.getName(), limit };
416418
requestObject.setAdditionalParameters(parameters);
@@ -435,7 +437,7 @@ public static List<AccountReputation> getAccountReputations(CommunicationHandler
435437
* <ul>
436438
* <li>If the server was not able to answer the request in the
437439
* given time (see
438-
* {@link eu.bittrade.libs.steemj.configuration.SteemJConfig#setResponseTimeout(long)
440+
* {@link eu.bittrade.libs.steemj.configuration.SteemJConfig#setResponseTimeout(int)
439441
* setResponseTimeout})</li>
440442
* <li>If there is a connection problem.</li>
441443
* <li>If the SteemJ is unable to transform the JSON response
@@ -444,10 +446,10 @@ public static List<AccountReputation> getAccountReputations(CommunicationHandler
444446
* </ul>
445447
*/
446448
public static List<AccountName> getRebloggedBy(CommunicationHandler communicationHandler, AccountName author,
447-
Permlink permlink) throws SteemCommunicationException {
448-
RequestWrapperDTO requestObject = new RequestWrapperDTO();
449+
Permlink permlink) throws SteemCommunicationException, SteemResponseError {
450+
JsonRPCRequest requestObject = new JsonRPCRequest();
449451
requestObject.setApiMethod(RequestMethods.GET_REBLOGGED_BY);
450-
requestObject.setSteemApi(SteemApis.FOLLOW_API);
452+
requestObject.setSteemApi(SteemApiType.FOLLOW_API);
451453

452454
Object[] parameters = { author.getName(), permlink.getLink() };
453455
requestObject.setAdditionalParameters(parameters);
@@ -473,7 +475,7 @@ public static List<AccountName> getRebloggedBy(CommunicationHandler communicatio
473475
* <ul>
474476
* <li>If the server was not able to answer the request in the
475477
* given time (see
476-
* {@link eu.bittrade.libs.steemj.configuration.SteemJConfig#setResponseTimeout(long)
478+
* {@link eu.bittrade.libs.steemj.configuration.SteemJConfig#setResponseTimeout(int)
477479
* setResponseTimeout})</li>
478480
* <li>If there is a connection problem.</li>
479481
* <li>If the SteemJ is unable to transform the JSON response
@@ -482,10 +484,10 @@ public static List<AccountName> getRebloggedBy(CommunicationHandler communicatio
482484
* </ul>
483485
*/
484486
public static List<PostsPerAuthorPair> getBlogAuthors(CommunicationHandler communicationHandler,
485-
AccountName blogAccount) throws SteemCommunicationException {
486-
RequestWrapperDTO requestObject = new RequestWrapperDTO();
487+
AccountName blogAccount) throws SteemCommunicationException, SteemResponseError {
488+
JsonRPCRequest requestObject = new JsonRPCRequest();
487489
requestObject.setApiMethod(RequestMethods.GET_BLOG_AUTHORS);
488-
requestObject.setSteemApi(SteemApis.FOLLOW_API);
490+
requestObject.setSteemApi(SteemApiType.FOLLOW_API);
489491

490492
Object[] parameters = { blogAccount.getName() };
491493
requestObject.setAdditionalParameters(parameters);

0 commit comments

Comments
 (0)