diff --git a/src/main/java/org/arkecosystem/client/api/Api.java b/src/main/java/org/arkecosystem/client/api/Api.java index 7186164..d78083e 100644 --- a/src/main/java/org/arkecosystem/client/api/Api.java +++ b/src/main/java/org/arkecosystem/client/api/Api.java @@ -3,8 +3,13 @@ import org.arkecosystem.client.http.Client; public class Api { + + public Blockchain blockchain; public Blocks blocks; + public Bridgechains bridgechains; + public Businesses businesses; public Delegates delegates; + public Locks locks; public Node node; public Peers peers; public Rounds rounds; @@ -13,8 +18,12 @@ public class Api { public Wallets wallets; public Api(Client client) { + this.blockchain = new Blockchain(client); this.blocks = new Blocks(client); + this.bridgechains = new Bridgechains(client); + this.businesses = new Businesses(client); this.delegates = new Delegates(client); + this.locks = new Locks(client); this.node = new Node(client); this.peers = new Peers(client); this.rounds = new Rounds(client); diff --git a/src/main/java/org/arkecosystem/client/api/Blockchain.java b/src/main/java/org/arkecosystem/client/api/Blockchain.java new file mode 100644 index 0000000..1f234d2 --- /dev/null +++ b/src/main/java/org/arkecosystem/client/api/Blockchain.java @@ -0,0 +1,18 @@ +package org.arkecosystem.client.api; + +import com.google.gson.internal.LinkedTreeMap; +import java.io.IOException; +import org.arkecosystem.client.http.Client; + +public class Blockchain { + + private Client client; + + public Blockchain(Client client) { + this.client = client; + } + + public LinkedTreeMap all() throws IOException { + return this.client.get("blockchain"); + } +} diff --git a/src/main/java/org/arkecosystem/client/api/Blocks.java b/src/main/java/org/arkecosystem/client/api/Blocks.java index cf9a013..7fd4fb1 100644 --- a/src/main/java/org/arkecosystem/client/api/Blocks.java +++ b/src/main/java/org/arkecosystem/client/api/Blocks.java @@ -6,7 +6,7 @@ import org.arkecosystem.client.http.Client; public class Blocks { - Client client; + private Client client; public Blocks(Client client) { this.client = client; @@ -16,6 +16,14 @@ public LinkedTreeMap all() throws IOException { return this.client.get("blocks"); } + public LinkedTreeMap first() throws IOException { + return this.client.get("blocks/first"); + } + + public LinkedTreeMap last() throws IOException { + return this.client.get("blocks/last"); + } + public LinkedTreeMap show(String id) throws IOException { return this.client.get("blocks/" + id); } diff --git a/src/main/java/org/arkecosystem/client/api/Bridgechains.java b/src/main/java/org/arkecosystem/client/api/Bridgechains.java new file mode 100644 index 0000000..5cb5fd8 --- /dev/null +++ b/src/main/java/org/arkecosystem/client/api/Bridgechains.java @@ -0,0 +1,26 @@ +package org.arkecosystem.client.api; + +import com.google.gson.internal.LinkedTreeMap; +import java.io.IOException; +import java.util.Map; +import org.arkecosystem.client.http.Client; + +public class Bridgechains { + private Client client; + + public Bridgechains(Client client) { + this.client = client; + } + + public LinkedTreeMap all() throws IOException { + return this.client.get("bridgechains"); + } + + public LinkedTreeMap show(String id) throws IOException { + return this.client.get("bridgechains/" + id); + } + + public LinkedTreeMap search(Map parameters) throws IOException { + return this.client.post("bridgechains/search", parameters); + } +} diff --git a/src/main/java/org/arkecosystem/client/api/Businesses.java b/src/main/java/org/arkecosystem/client/api/Businesses.java new file mode 100644 index 0000000..934d5b1 --- /dev/null +++ b/src/main/java/org/arkecosystem/client/api/Businesses.java @@ -0,0 +1,30 @@ +package org.arkecosystem.client.api; + +import com.google.gson.internal.LinkedTreeMap; +import java.io.IOException; +import java.util.Map; +import org.arkecosystem.client.http.Client; + +public class Businesses { + private Client client; + + public Businesses(Client client) { + this.client = client; + } + + public LinkedTreeMap all() throws IOException { + return this.client.get("businesses"); + } + + public LinkedTreeMap show(String id) throws IOException { + return this.client.get("businesses/" + id); + } + + public LinkedTreeMap showBridgechains(String id) throws IOException { + return this.client.get("businesses/" + id + "/bridgechains"); + } + + public LinkedTreeMap search(Map parameters) throws IOException { + return this.client.post("businesses/search", parameters); + } +} diff --git a/src/main/java/org/arkecosystem/client/api/Delegates.java b/src/main/java/org/arkecosystem/client/api/Delegates.java index 534e2f0..3629b3b 100644 --- a/src/main/java/org/arkecosystem/client/api/Delegates.java +++ b/src/main/java/org/arkecosystem/client/api/Delegates.java @@ -2,10 +2,11 @@ import com.google.gson.internal.LinkedTreeMap; import java.io.IOException; +import java.util.Map; import org.arkecosystem.client.http.Client; public class Delegates { - Client client; + private Client client; public Delegates(Client client) { this.client = client; @@ -26,4 +27,8 @@ public LinkedTreeMap blocks(String id) throws IOException { public LinkedTreeMap voters(String id) throws IOException { return this.client.get("delegates/" + id + "/voters"); } + + public LinkedTreeMap search(Map parameters) throws IOException { + return this.client.post("delegates/search", parameters); + } } diff --git a/src/main/java/org/arkecosystem/client/api/Locks.java b/src/main/java/org/arkecosystem/client/api/Locks.java new file mode 100644 index 0000000..914cfe6 --- /dev/null +++ b/src/main/java/org/arkecosystem/client/api/Locks.java @@ -0,0 +1,31 @@ +package org.arkecosystem.client.api; + +import com.google.gson.internal.LinkedTreeMap; +import java.io.IOException; +import java.util.Map; +import org.arkecosystem.client.http.Client; + +public class Locks { + private Client client; + + public Locks(Client client) { + this.client = client; + } + + public LinkedTreeMap all() throws IOException { + return this.client.get("all"); + } + + public LinkedTreeMap show(String id) throws IOException { + return this.client.get("locks/" + id); + } + + public LinkedTreeMap search(Map parameters) throws IOException { + return this.client.post("locks/search", parameters); + } + + public LinkedTreeMap searchUnlocked(Map parameters) + throws IOException { + return this.client.post("locks/unlocked", parameters); + } +} diff --git a/src/main/java/org/arkecosystem/client/api/Node.java b/src/main/java/org/arkecosystem/client/api/Node.java index da16efc..2132ebd 100644 --- a/src/main/java/org/arkecosystem/client/api/Node.java +++ b/src/main/java/org/arkecosystem/client/api/Node.java @@ -6,18 +6,12 @@ import org.arkecosystem.client.http.Client; public class Node { - Client client; + private Client client; public Node(Client client) { this.client = client; } - public LinkedTreeMap fees(Integer... days) throws IOException { - HashMap parameters = new HashMap<>(); - parameters.put("days", days.length > 0 ? days[0] : null); - return this.client.get("node/fees", parameters); - } - public LinkedTreeMap status() throws IOException { return this.client.get("node/status"); } @@ -33,4 +27,14 @@ public LinkedTreeMap configuration() throws IOException { public LinkedTreeMap crypto() throws IOException { return this.client.get("node/configuration/crypto"); } + + public LinkedTreeMap fees(Integer... days) throws IOException { + HashMap parameters = new HashMap<>(); + parameters.put("days", days.length > 0 ? days[0] : null); + return this.client.get("node/fees"); + } + + public LinkedTreeMap debug() throws IOException { + return this.client.get("node/debug"); + } } diff --git a/src/main/java/org/arkecosystem/client/api/Peers.java b/src/main/java/org/arkecosystem/client/api/Peers.java index 0599505..784c364 100644 --- a/src/main/java/org/arkecosystem/client/api/Peers.java +++ b/src/main/java/org/arkecosystem/client/api/Peers.java @@ -5,7 +5,7 @@ import org.arkecosystem.client.http.Client; public class Peers { - Client client; + private Client client; public Peers(Client client) { this.client = client; diff --git a/src/main/java/org/arkecosystem/client/api/Rounds.java b/src/main/java/org/arkecosystem/client/api/Rounds.java index ea07ce1..ab9fa3b 100644 --- a/src/main/java/org/arkecosystem/client/api/Rounds.java +++ b/src/main/java/org/arkecosystem/client/api/Rounds.java @@ -5,7 +5,7 @@ import org.arkecosystem.client.http.Client; public class Rounds { - Client client; + private Client client; public Rounds(Client client) { this.client = client; diff --git a/src/main/java/org/arkecosystem/client/api/Transactions.java b/src/main/java/org/arkecosystem/client/api/Transactions.java index 3109a5b..9640766 100644 --- a/src/main/java/org/arkecosystem/client/api/Transactions.java +++ b/src/main/java/org/arkecosystem/client/api/Transactions.java @@ -8,7 +8,7 @@ import org.arkecosystem.client.http.Client; public class Transactions { - Client client; + private Client client; public Transactions(Client client) { this.client = client; @@ -44,6 +44,10 @@ public LinkedTreeMap types() throws IOException { return this.client.get("transactions/types"); } + public LinkedTreeMap schemas() throws IOException { + return this.client.get("transactions/schemas"); + } + public LinkedTreeMap fees() throws IOException { return this.client.get("transactions/fees"); } diff --git a/src/main/java/org/arkecosystem/client/api/Votes.java b/src/main/java/org/arkecosystem/client/api/Votes.java index 8ca6c94..9cc0cbc 100644 --- a/src/main/java/org/arkecosystem/client/api/Votes.java +++ b/src/main/java/org/arkecosystem/client/api/Votes.java @@ -5,7 +5,7 @@ import org.arkecosystem.client.http.Client; public class Votes { - Client client; + private Client client; public Votes(Client client) { this.client = client; diff --git a/src/main/java/org/arkecosystem/client/api/Wallets.java b/src/main/java/org/arkecosystem/client/api/Wallets.java index 341f6ef..2a77de8 100644 --- a/src/main/java/org/arkecosystem/client/api/Wallets.java +++ b/src/main/java/org/arkecosystem/client/api/Wallets.java @@ -6,7 +6,7 @@ import org.arkecosystem.client.http.Client; public class Wallets { - Client client; + private Client client; public Wallets(Client client) { this.client = client; @@ -16,6 +16,10 @@ public LinkedTreeMap all() throws IOException { return this.client.get("wallets"); } + public LinkedTreeMap top() throws IOException { + return this.client.get("wallets/top"); + } + public LinkedTreeMap show(String id) throws IOException { return this.client.get("wallets/" + id); } @@ -36,11 +40,11 @@ public LinkedTreeMap votes(String id) throws IOException { return this.client.get("wallets/" + id + "/votes"); } - public LinkedTreeMap search(Map parameters) throws IOException { - return this.client.post("wallets/search", parameters); + public LinkedTreeMap locks(String id) throws IOException { + return this.client.get("wallets/" + id + "/locks"); } - public LinkedTreeMap top() throws IOException { - return this.client.get("wallets/top"); + public LinkedTreeMap search(Map parameters) throws IOException { + return this.client.post("wallets/search", parameters); } } diff --git a/src/test/java/org/arkecosystem/client/api/BlockchainTest.java b/src/test/java/org/arkecosystem/client/api/BlockchainTest.java new file mode 100644 index 0000000..3e56453 --- /dev/null +++ b/src/test/java/org/arkecosystem/client/api/BlockchainTest.java @@ -0,0 +1,20 @@ +package org.arkecosystem.client.api; + +import com.google.gson.internal.LinkedTreeMap; +import org.arkecosystem.client.Connection; +import org.arkecosystem.client.MockHelper; +import org.junit.jupiter.api.Test; + +import java.io.IOException; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class BlockchainTest { + + @Test + void all() throws IOException { + Connection connection = MockHelper.connection(); + LinkedTreeMap actual = connection.api().blockchain.all(); + assertTrue((boolean) actual.get("success")); + } +} diff --git a/src/test/java/org/arkecosystem/client/api/BlocksTest.java b/src/test/java/org/arkecosystem/client/api/BlocksTest.java index ddca1af..fc8fa70 100644 --- a/src/test/java/org/arkecosystem/client/api/BlocksTest.java +++ b/src/test/java/org/arkecosystem/client/api/BlocksTest.java @@ -19,6 +19,20 @@ void all() throws IOException { assertTrue((boolean) actual.get("success")); } + @Test + void first() throws IOException { + Connection connection = MockHelper.connection(); + LinkedTreeMap actual = connection.api().blocks.first(); + assertTrue((boolean) actual.get("success")); + } + + @Test + void last() throws IOException { + Connection connection = MockHelper.connection(); + LinkedTreeMap actual = connection.api().blocks.last(); + assertTrue((boolean) actual.get("success")); + } + @Test void show() throws IOException { Connection connection = MockHelper.connection(); diff --git a/src/test/java/org/arkecosystem/client/api/BridgechainsTest.java b/src/test/java/org/arkecosystem/client/api/BridgechainsTest.java new file mode 100644 index 0000000..aa018b8 --- /dev/null +++ b/src/test/java/org/arkecosystem/client/api/BridgechainsTest.java @@ -0,0 +1,35 @@ +package org.arkecosystem.client.api; + +import com.google.gson.internal.LinkedTreeMap; +import org.arkecosystem.client.Connection; +import org.arkecosystem.client.MockHelper; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.util.HashMap; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class BridgechainsTest { + + @Test + void all() throws IOException { + Connection connection = MockHelper.connection(); + LinkedTreeMap actual = connection.api().bridgechains.all(); + assertTrue((boolean) actual.get("success")); + } + + @Test + void show() throws IOException { + Connection connection = MockHelper.connection(); + LinkedTreeMap actual = connection.api().bridgechains.show("dummy"); + assertTrue((boolean) actual.get("success")); + } + + @Test + void search() throws IOException { + Connection connection = MockHelper.connection(); + LinkedTreeMap actual = connection.api().bridgechains.search(new HashMap<>()); + assertTrue((boolean) actual.get("success")); + } +} diff --git a/src/test/java/org/arkecosystem/client/api/BusinessesTest.java b/src/test/java/org/arkecosystem/client/api/BusinessesTest.java new file mode 100644 index 0000000..6eff298 --- /dev/null +++ b/src/test/java/org/arkecosystem/client/api/BusinessesTest.java @@ -0,0 +1,43 @@ +package org.arkecosystem.client.api; + +import com.google.gson.internal.LinkedTreeMap; +import org.arkecosystem.client.Connection; +import org.arkecosystem.client.MockHelper; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.util.HashMap; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class BusinessesTest { + + @Test + void all() throws IOException { + Connection connection = MockHelper.connection(); + LinkedTreeMap actual = connection.api().businesses.all(); + assertTrue((boolean) actual.get("success")); + } + + @Test + void show() throws IOException { + Connection connection = MockHelper.connection(); + LinkedTreeMap actual = connection.api().businesses.show("dummy"); + assertTrue((boolean) actual.get("success")); + } + + @Test + void showBridgechains() throws IOException { + Connection connection = MockHelper.connection(); + LinkedTreeMap actual = connection.api().businesses.showBridgechains("dummy"); + assertTrue((boolean) actual.get("success")); + } + + @Test + void search() throws IOException { + Connection connection = MockHelper.connection(); + LinkedTreeMap actual = connection.api().businesses.search(new HashMap<>()); + assertTrue((boolean) actual.get("success")); + } + +} diff --git a/src/test/java/org/arkecosystem/client/api/DelegatesTest.java b/src/test/java/org/arkecosystem/client/api/DelegatesTest.java index 35c2a69..452f67c 100644 --- a/src/test/java/org/arkecosystem/client/api/DelegatesTest.java +++ b/src/test/java/org/arkecosystem/client/api/DelegatesTest.java @@ -6,6 +6,7 @@ import org.junit.jupiter.api.Test; import java.io.IOException; +import java.util.HashMap; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -39,4 +40,11 @@ void voters() throws IOException { assertTrue((boolean) actual.get("success")); } + @Test + void search() throws IOException { + Connection connection = MockHelper.connection(); + LinkedTreeMap actual = connection.api().delegates.search(new HashMap<>()); + assertTrue((boolean) actual.get("success")); + } + } diff --git a/src/test/java/org/arkecosystem/client/api/LocksTest.java b/src/test/java/org/arkecosystem/client/api/LocksTest.java new file mode 100644 index 0000000..7307cfc --- /dev/null +++ b/src/test/java/org/arkecosystem/client/api/LocksTest.java @@ -0,0 +1,42 @@ +package org.arkecosystem.client.api; + +import com.google.gson.internal.LinkedTreeMap; +import org.arkecosystem.client.Connection; +import org.arkecosystem.client.MockHelper; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.util.HashMap; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class LocksTest { + + @Test + void all() throws IOException { + Connection connection = MockHelper.connection(); + LinkedTreeMap actual = connection.api().locks.all(); + assertTrue((boolean) actual.get("success")); + } + + @Test + void show() throws IOException { + Connection connection = MockHelper.connection(); + LinkedTreeMap actual = connection.api().locks.show("dummy"); + assertTrue((boolean) actual.get("success")); + } + + @Test + void search() throws IOException { + Connection connection = MockHelper.connection(); + LinkedTreeMap actual = connection.api().locks.search(new HashMap<>()); + assertTrue((boolean) actual.get("success")); + } + + @Test + void searchUnlocked() throws IOException { + Connection connection = MockHelper.connection(); + LinkedTreeMap actual = connection.api().locks.searchUnlocked(new HashMap<>()); + assertTrue((boolean) actual.get("success")); + } +} diff --git a/src/test/java/org/arkecosystem/client/api/NodeTest.java b/src/test/java/org/arkecosystem/client/api/NodeTest.java index 1a1cb81..5269c9a 100644 --- a/src/test/java/org/arkecosystem/client/api/NodeTest.java +++ b/src/test/java/org/arkecosystem/client/api/NodeTest.java @@ -45,4 +45,11 @@ void crypto() throws IOException { LinkedTreeMap actual = connection.api().node.crypto(); assertTrue((boolean) actual.get("success")); } + + @Test + void debug() throws IOException { + Connection connection = MockHelper.connection(); + LinkedTreeMap actual = connection.api().node.debug(); + assertTrue((boolean) actual.get("success")); + } } diff --git a/src/test/java/org/arkecosystem/client/api/TransactionsTest.java b/src/test/java/org/arkecosystem/client/api/TransactionsTest.java index 802c457..c1e98ad 100644 --- a/src/test/java/org/arkecosystem/client/api/TransactionsTest.java +++ b/src/test/java/org/arkecosystem/client/api/TransactionsTest.java @@ -68,4 +68,11 @@ void fees() throws IOException { LinkedTreeMap actual = connection.api().transactions.fees(); assertTrue((boolean) actual.get("success")); } + + @Test + void schemas() throws IOException { + Connection connection = MockHelper.connection(); + LinkedTreeMap actual = connection.api().transactions.schemas(); + assertTrue((boolean) actual.get("success")); + } } diff --git a/src/test/java/org/arkecosystem/client/api/WalletsTest.java b/src/test/java/org/arkecosystem/client/api/WalletsTest.java index c5228a2..bb86f55 100644 --- a/src/test/java/org/arkecosystem/client/api/WalletsTest.java +++ b/src/test/java/org/arkecosystem/client/api/WalletsTest.java @@ -61,6 +61,13 @@ void search() throws IOException { assertTrue((boolean) actual.get("success")); } + @Test + void locks() throws IOException { + Connection connection = MockHelper.connection(); + LinkedTreeMap actual = connection.api().wallets.locks("dummy"); + assertTrue((boolean) actual.get("success")); + } + @Test void top() throws IOException { Connection connection = MockHelper.connection();