updated dto

This commit is contained in:
pinpong
2016-11-13 22:28:59 +01:00
parent 87bbf9c474
commit 5c74733584
7 changed files with 93 additions and 73 deletions
+15 -14
View File
@@ -1,25 +1,22 @@
package jota;
import java.io.BufferedReader;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Collection;
import java.util.Optional;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
import jota.dto.request.*;
import jota.dto.response.*;
import okhttp3.OkHttpClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import retrofit2.Call;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Collection;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
/**
* IotaAPIProxy Builder. Usage:
*
@@ -93,12 +90,12 @@ public class IotaAPIProxy {
return wrapCheckedException(res).body();
}
public FindTransactionResponse findTransactions(String [] addresses, String [] digests, String [] approvees, String [] bundles ) {
public FindTransactionResponse findTransactions(String[] addresses, String[] tags, String[] approvees, String[] bundles) {
final IotaFindTransactionsRequest findTransRequest = IotaFindTransactionsRequest
.createFindTransactionRequest()
.byAddresses(addresses)
.byDigests(digests)
.byTags(tags)
.byApprovees(approvees)
.byBundles(bundles);
@@ -224,9 +221,13 @@ public class IotaAPIProxy {
private boolean checkPropertiesFiles() {
try (BufferedReader reader = Files.newBufferedReader(Paths.get("node_config.properties"))) {
try {
FileReader fileReader = new FileReader("node_config.properties");
BufferedReader bufferedReader = new BufferedReader(fileReader);
final Properties nodeConfig = new Properties();
nodeConfig.load(reader);
nodeConfig.load(bufferedReader);
if (nodeConfig.getProperty("iota.node.protocol") != null) {
protocol = nodeConfig.getProperty("iota.node.protocol");
@@ -10,8 +10,8 @@ public class IotaFindTransactionsRequest extends IotaCommandRequest {
private String[] bundles; // List of bundle hashes. The hashes need to be extended to 81chars by padding the hash with 9's.
private String[] addresses;
private String[] digests;
private String[] approvees;
private String[] tags;
private String[] approvees;
public static IotaFindTransactionsRequest createFindTransactionRequest() {
return new IotaFindTransactionsRequest();
@@ -27,8 +27,8 @@ public class IotaFindTransactionsRequest extends IotaCommandRequest {
return this;
}
public IotaFindTransactionsRequest byDigests(String ... digests) {
this.digests = digests;
public IotaFindTransactionsRequest byTags(String ... tags) {
this.tags = tags;
return this;
}
@@ -3,7 +3,6 @@ package jota.dto.request;
import jota.IotaAPICommands;
import java.util.Collection;
import java.util.stream.Collectors;
public class IotaGetInclusionStateRequest extends IotaCommandRequest {
@@ -1,10 +1,10 @@
package jota.dto.response;
public class FindTransactionResponse extends AbstractResponse {
String [] addresses;
public String[] getAddresses() {
return addresses;
}
String[] hashes;
public String[] getHashes() {
return hashes;
}
}
@@ -10,8 +10,9 @@ public class GetNeighborsResponse extends AbstractResponse {
static class Neighbors {
private String numberOfAllTransactions;
private String address;
private String numberOfAllTransactions;
private String numberOfInvalidTransactions;
private String numberOfNewTransactions;
public String getAddress() {
@@ -20,6 +21,10 @@ public class GetNeighborsResponse extends AbstractResponse {
public String getNumberOfAllTransactions() {
return numberOfAllTransactions;
}
public String getNumberOfInvalidTransactions() {
return numberOfInvalidTransactions;
}
public String getNumberOfNewTransactions() {
return numberOfNewTransactions;
}
@@ -2,65 +2,80 @@ package jota.dto.response;
public class GetNodeInfoResponse extends AbstractResponse {
private String incomingPacketsBacklog;
private String appName;
private String transactionsToRequest;
private String jreTotalMemory;
private String time;
private String neighbors;
private String milestoneIndex;
private String appVersion;
private String jreAvailableProcessors;
private String jreMaxMemory;
private String tips;
private String jreFreeMemory;
public String getIncomingPacketsBacklog() {
return incomingPacketsBacklog;
}
private Integer jreAvailableProcessors;
private Integer jreFreeMemory;
private float jreMaxMemory;
private float jreTotalMemory;
private String latestMilestone;
private Integer latestMilestoneIndex;
private String latestSolidSubtangleMilestone;
private Integer latestSolidSubtangleMilestoneIndex;
private Integer neighbors;
private Integer packetsQueueSize;
private long time;
private Integer tips;
private Integer transactionsToRequest;
public String getAppName() {
return appName;
}
public String getTransactionsToRequest() {
return transactionsToRequest;
}
public String getJreTotalMemory() {
return jreTotalMemory;
}
public String getTime() {
return time;
}
public String getNeighbors() {
return neighbors;
}
public String getMilestoneIndex() {
return milestoneIndex;
}
public String getAppVersion() {
return appVersion;
}
public String getJreAvailableProcessors() {
public Integer getJreAvailableProcessors() {
return jreAvailableProcessors;
}
public String getJreMaxMemory() {
return jreMaxMemory;
}
public String getTips() {
return tips;
}
public String getJreFreeMemory() {
public Integer getJreFreeMemory() {
return jreFreeMemory;
}
}
public float getJreMaxMemory() {
return jreMaxMemory;
}
public float getJreTotalMemory() {
return jreTotalMemory;
}
public String getLatestMilestone() {
return latestMilestone;
}
public Integer getLatestMilestoneIndex() {
return latestMilestoneIndex;
}
public String getLatestSolidSubtangleMilestone() {
return latestSolidSubtangleMilestone;
}
public Integer getLatestSolidSubtangleMilestoneIndex() {
return latestSolidSubtangleMilestoneIndex;
}
public Integer getNeighbors() {
return neighbors;
}
public Integer getPacketsQueueSize() {
return packetsQueueSize;
}
public long getTime() {
return time;
}
public Integer getTips() {
return tips;
}
public Integer getTransactionsToRequest() {
return transactionsToRequest;
}
}
@@ -2,9 +2,9 @@ package jota.dto.response;
public class GetTrytesResponse extends AbstractResponse {
private String [] trites;
private String[] trytes;
public String[] getTrites() {
return trites;
public String[] getTrytes() {
return trytes;
}
}