-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
api: Regenerate Client Interfaces and implement cucumber tests. (#555)
- Loading branch information
Showing
25 changed files
with
1,002 additions
and
9 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
src/main/java/com/algorand/algosdk/v2/client/algod/GetBlockTimeStampOffset.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.algorand.algosdk.v2.client.algod; | ||
|
||
import com.algorand.algosdk.v2.client.common.Client; | ||
import com.algorand.algosdk.v2.client.common.HttpMethod; | ||
import com.algorand.algosdk.v2.client.common.Query; | ||
import com.algorand.algosdk.v2.client.common.QueryData; | ||
import com.algorand.algosdk.v2.client.common.Response; | ||
import com.algorand.algosdk.v2.client.model.GetBlockTimeStampOffsetResponse; | ||
|
||
|
||
/** | ||
* Gets the current timestamp offset. | ||
* /v2/devmode/blocks/offset | ||
*/ | ||
public class GetBlockTimeStampOffset extends Query { | ||
|
||
public GetBlockTimeStampOffset(Client client) { | ||
super(client, new HttpMethod("get")); | ||
} | ||
|
||
/** | ||
* Execute the query. | ||
* @return the query response object. | ||
* @throws Exception | ||
*/ | ||
@Override | ||
public Response<GetBlockTimeStampOffsetResponse> execute() throws Exception { | ||
Response<GetBlockTimeStampOffsetResponse> resp = baseExecute(); | ||
resp.setValueType(GetBlockTimeStampOffsetResponse.class); | ||
return resp; | ||
} | ||
|
||
/** | ||
* Execute the query with custom headers, there must be an equal number of keys and values | ||
* or else an error will be generated. | ||
* @param headers an array of header keys | ||
* @param values an array of header values | ||
* @return the query response object. | ||
* @throws Exception | ||
*/ | ||
@Override | ||
public Response<GetBlockTimeStampOffsetResponse> execute(String[] headers, String[] values) throws Exception { | ||
Response<GetBlockTimeStampOffsetResponse> resp = baseExecute(headers, values); | ||
resp.setValueType(GetBlockTimeStampOffsetResponse.class); | ||
return resp; | ||
} | ||
|
||
protected QueryData getRequestString() { | ||
addPathSegment(String.valueOf("v2")); | ||
addPathSegment(String.valueOf("devmode")); | ||
addPathSegment(String.valueOf("blocks")); | ||
addPathSegment(String.valueOf("offset")); | ||
|
||
return qd; | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
src/main/java/com/algorand/algosdk/v2/client/algod/GetReady.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.algorand.algosdk.v2.client.algod; | ||
|
||
import com.algorand.algosdk.v2.client.common.Client; | ||
import com.algorand.algosdk.v2.client.common.HttpMethod; | ||
import com.algorand.algosdk.v2.client.common.Query; | ||
import com.algorand.algosdk.v2.client.common.QueryData; | ||
import com.algorand.algosdk.v2.client.common.Response; | ||
|
||
|
||
/** | ||
* Returns OK if healthy and fully caught up. | ||
* /ready | ||
*/ | ||
public class GetReady extends Query { | ||
|
||
public GetReady(Client client) { | ||
super(client, new HttpMethod("get")); | ||
} | ||
|
||
/** | ||
* Execute the query. | ||
* @return the query response object. | ||
* @throws Exception | ||
*/ | ||
@Override | ||
public Response<String> execute() throws Exception { | ||
Response<String> resp = baseExecute(); | ||
resp.setValueType(String.class); | ||
return resp; | ||
} | ||
|
||
/** | ||
* Execute the query with custom headers, there must be an equal number of keys and values | ||
* or else an error will be generated. | ||
* @param headers an array of header keys | ||
* @param values an array of header values | ||
* @return the query response object. | ||
* @throws Exception | ||
*/ | ||
@Override | ||
public Response<String> execute(String[] headers, String[] values) throws Exception { | ||
Response<String> resp = baseExecute(headers, values); | ||
resp.setValueType(String.class); | ||
return resp; | ||
} | ||
|
||
protected QueryData getRequestString() { | ||
addPathSegment(String.valueOf("ready")); | ||
|
||
return qd; | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
src/main/java/com/algorand/algosdk/v2/client/algod/GetSyncRound.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.algorand.algosdk.v2.client.algod; | ||
|
||
import com.algorand.algosdk.v2.client.common.Client; | ||
import com.algorand.algosdk.v2.client.common.HttpMethod; | ||
import com.algorand.algosdk.v2.client.common.Query; | ||
import com.algorand.algosdk.v2.client.common.QueryData; | ||
import com.algorand.algosdk.v2.client.common.Response; | ||
import com.algorand.algosdk.v2.client.model.GetSyncRoundResponse; | ||
|
||
|
||
/** | ||
* Gets the minimum sync round for the ledger. | ||
* /v2/ledger/sync | ||
*/ | ||
public class GetSyncRound extends Query { | ||
|
||
public GetSyncRound(Client client) { | ||
super(client, new HttpMethod("get")); | ||
} | ||
|
||
/** | ||
* Execute the query. | ||
* @return the query response object. | ||
* @throws Exception | ||
*/ | ||
@Override | ||
public Response<GetSyncRoundResponse> execute() throws Exception { | ||
Response<GetSyncRoundResponse> resp = baseExecute(); | ||
resp.setValueType(GetSyncRoundResponse.class); | ||
return resp; | ||
} | ||
|
||
/** | ||
* Execute the query with custom headers, there must be an equal number of keys and values | ||
* or else an error will be generated. | ||
* @param headers an array of header keys | ||
* @param values an array of header values | ||
* @return the query response object. | ||
* @throws Exception | ||
*/ | ||
@Override | ||
public Response<GetSyncRoundResponse> execute(String[] headers, String[] values) throws Exception { | ||
Response<GetSyncRoundResponse> resp = baseExecute(headers, values); | ||
resp.setValueType(GetSyncRoundResponse.class); | ||
return resp; | ||
} | ||
|
||
protected QueryData getRequestString() { | ||
addPathSegment(String.valueOf("v2")); | ||
addPathSegment(String.valueOf("ledger")); | ||
addPathSegment(String.valueOf("sync")); | ||
|
||
return qd; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
src/main/java/com/algorand/algosdk/v2/client/algod/SetBlockTimeStampOffset.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package com.algorand.algosdk.v2.client.algod; | ||
|
||
import com.algorand.algosdk.v2.client.common.Client; | ||
import com.algorand.algosdk.v2.client.common.HttpMethod; | ||
import com.algorand.algosdk.v2.client.common.Query; | ||
import com.algorand.algosdk.v2.client.common.QueryData; | ||
import com.algorand.algosdk.v2.client.common.Response; | ||
|
||
|
||
/** | ||
* Sets the timestamp offset (seconds) for blocks in dev mode. Providing an offset | ||
* of 0 will unset this value and try to use the real clock for the timestamp. | ||
* /v2/devmode/blocks/offset/{offset} | ||
*/ | ||
public class SetBlockTimeStampOffset extends Query { | ||
|
||
private Long offset; | ||
|
||
/** | ||
* @param offset The timestamp offset for blocks in dev mode. | ||
*/ | ||
public SetBlockTimeStampOffset(Client client, Long offset) { | ||
super(client, new HttpMethod("post")); | ||
this.offset = offset; | ||
} | ||
|
||
/** | ||
* Execute the query. | ||
* @return the query response object. | ||
* @throws Exception | ||
*/ | ||
@Override | ||
public Response<String> execute() throws Exception { | ||
Response<String> resp = baseExecute(); | ||
resp.setValueType(String.class); | ||
return resp; | ||
} | ||
|
||
/** | ||
* Execute the query with custom headers, there must be an equal number of keys and values | ||
* or else an error will be generated. | ||
* @param headers an array of header keys | ||
* @param values an array of header values | ||
* @return the query response object. | ||
* @throws Exception | ||
*/ | ||
@Override | ||
public Response<String> execute(String[] headers, String[] values) throws Exception { | ||
Response<String> resp = baseExecute(headers, values); | ||
resp.setValueType(String.class); | ||
return resp; | ||
} | ||
|
||
protected QueryData getRequestString() { | ||
if (this.offset == null) { | ||
throw new RuntimeException("offset is not set. It is a required parameter."); | ||
} | ||
addPathSegment(String.valueOf("v2")); | ||
addPathSegment(String.valueOf("devmode")); | ||
addPathSegment(String.valueOf("blocks")); | ||
addPathSegment(String.valueOf("offset")); | ||
addPathSegment(String.valueOf(offset)); | ||
|
||
return qd; | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
src/main/java/com/algorand/algosdk/v2/client/algod/SetSyncRound.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package com.algorand.algosdk.v2.client.algod; | ||
|
||
import com.algorand.algosdk.v2.client.common.Client; | ||
import com.algorand.algosdk.v2.client.common.HttpMethod; | ||
import com.algorand.algosdk.v2.client.common.Query; | ||
import com.algorand.algosdk.v2.client.common.QueryData; | ||
import com.algorand.algosdk.v2.client.common.Response; | ||
|
||
|
||
/** | ||
* Sets the minimum sync round on the ledger. | ||
* /v2/ledger/sync/{round} | ||
*/ | ||
public class SetSyncRound extends Query { | ||
|
||
private Long round; | ||
|
||
/** | ||
* @param round The round for which the deltas are desired. | ||
*/ | ||
public SetSyncRound(Client client, Long round) { | ||
super(client, new HttpMethod("post")); | ||
this.round = round; | ||
} | ||
|
||
/** | ||
* Execute the query. | ||
* @return the query response object. | ||
* @throws Exception | ||
*/ | ||
@Override | ||
public Response<String> execute() throws Exception { | ||
Response<String> resp = baseExecute(); | ||
resp.setValueType(String.class); | ||
return resp; | ||
} | ||
|
||
/** | ||
* Execute the query with custom headers, there must be an equal number of keys and values | ||
* or else an error will be generated. | ||
* @param headers an array of header keys | ||
* @param values an array of header values | ||
* @return the query response object. | ||
* @throws Exception | ||
*/ | ||
@Override | ||
public Response<String> execute(String[] headers, String[] values) throws Exception { | ||
Response<String> resp = baseExecute(headers, values); | ||
resp.setValueType(String.class); | ||
return resp; | ||
} | ||
|
||
protected QueryData getRequestString() { | ||
if (this.round == null) { | ||
throw new RuntimeException("round is not set. It is a required parameter."); | ||
} | ||
addPathSegment(String.valueOf("v2")); | ||
addPathSegment(String.valueOf("ledger")); | ||
addPathSegment(String.valueOf("sync")); | ||
addPathSegment(String.valueOf(round)); | ||
|
||
return qd; | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
src/main/java/com/algorand/algosdk/v2/client/algod/SimulateTransaction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package com.algorand.algosdk.v2.client.algod; | ||
|
||
import com.algorand.algosdk.v2.client.common.Client; | ||
import com.algorand.algosdk.v2.client.common.HttpMethod; | ||
import com.algorand.algosdk.v2.client.common.Query; | ||
import com.algorand.algosdk.v2.client.common.QueryData; | ||
import com.algorand.algosdk.v2.client.common.Response; | ||
import com.algorand.algosdk.v2.client.model.SimulateRequest; | ||
import com.algorand.algosdk.v2.client.model.SimulateResponse; | ||
|
||
|
||
/** | ||
* Simulates a raw transaction or transaction group as it would be evaluated on the | ||
* network. The simulation will use blockchain state from the latest committed | ||
* round. | ||
* /v2/transactions/simulate | ||
*/ | ||
public class SimulateTransaction extends Query { | ||
|
||
public SimulateTransaction(Client client) { | ||
super(client, new HttpMethod("post")); | ||
addQuery("format", "msgpack"); | ||
} | ||
|
||
/** | ||
* The transactions to simulate, along with any other inputs. | ||
*/ | ||
public SimulateTransaction request(SimulateRequest request) { | ||
addToBody(request); | ||
return this; | ||
} | ||
|
||
/** | ||
* Execute the query. | ||
* @return the query response object. | ||
* @throws Exception | ||
*/ | ||
@Override | ||
public Response<SimulateResponse> execute() throws Exception { | ||
Response<SimulateResponse> resp = baseExecute(); | ||
resp.setValueType(SimulateResponse.class); | ||
return resp; | ||
} | ||
|
||
/** | ||
* Execute the query with custom headers, there must be an equal number of keys and values | ||
* or else an error will be generated. | ||
* @param headers an array of header keys | ||
* @param values an array of header values | ||
* @return the query response object. | ||
* @throws Exception | ||
*/ | ||
@Override | ||
public Response<SimulateResponse> execute(String[] headers, String[] values) throws Exception { | ||
Response<SimulateResponse> resp = baseExecute(headers, values); | ||
resp.setValueType(SimulateResponse.class); | ||
return resp; | ||
} | ||
|
||
protected QueryData getRequestString() { | ||
addPathSegment(String.valueOf("v2")); | ||
addPathSegment(String.valueOf("transactions")); | ||
addPathSegment(String.valueOf("simulate")); | ||
|
||
return qd; | ||
} | ||
} |
Oops, something went wrong.