Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regenerate code with the latest specification file (92e0e6a8) #750

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
import com.algorand.algosdk.v2.client.model.BlockHeaderResponse;


/**
* Get the block header for the block on the given round.
* /v2/blocks/{round}/header
*/
public class GetBlockHeader extends Query {

private Long round;

/**
* @param round The round from which to fetch block header information.
*/
public GetBlockHeader(Client client, Long round) {
super(client, new HttpMethod("get"));
addQuery("format", "msgpack");
this.round = round;
}

/**
* Execute the query.
* @return the query response object.
* @throws Exception
*/
@Override
public Response<BlockHeaderResponse> execute() throws Exception {
Response<BlockHeaderResponse> resp = baseExecute();
resp.setValueType(BlockHeaderResponse.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<BlockHeaderResponse> execute(String[] headers, String[] values) throws Exception {
Response<BlockHeaderResponse> resp = baseExecute(headers, values);
resp.setValueType(BlockHeaderResponse.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("blocks"));
addPathSegment(String.valueOf(round));
addPathSegment(String.valueOf("header"));

return qd;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.algorand.algosdk.v2.client.algod.GetBlock;
import com.algorand.algosdk.v2.client.algod.GetBlockTxids;
import com.algorand.algosdk.v2.client.algod.GetBlockHash;
import com.algorand.algosdk.v2.client.algod.GetBlockHeader;
import com.algorand.algosdk.v2.client.algod.GetTransactionProof;
import com.algorand.algosdk.v2.client.algod.GetBlockLogs;
import com.algorand.algosdk.v2.client.algod.GetSupply;
Expand Down Expand Up @@ -180,6 +181,14 @@ public GetBlockHash GetBlockHash(Long round) {
return new GetBlockHash((Client) this, round);
}

/**
* Get the block header for the block on the given round.
* /v2/blocks/{round}/header
*/
public GetBlockHeader GetBlockHeader(Long round) {
return new GetBlockHeader((Client) this, round);
}

/**
* Get a proof for a transaction in a block.
* /v2/blocks/{round}/transactions/{txid}/proof
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public LookupAccountByID includeAll(Boolean includeAll) {
}

/**
* Include results for the specified round.
* Deprecated and disallowed. This parameter used to include results for a
* specified round. Requests with this parameter set are now rejected.
*/
public LookupAccountByID round(Long round) {
addQuery("round", String.valueOf(round));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,8 @@ public SearchForAccounts next(String next) {
}

/**
* Include results for the specified round. For performance reasons, this parameter
* may be disabled on some configurations. Using application-id or asset-id filters
* will return both creator and opt-in accounts. Filtering by include-all will
* return creator and opt-in accounts for deleted assets and accounts. Non-opt-in
* managers are not included in the results when asset-id is used.
* Deprecated and disallowed. This parameter used to include results for a
* specified round. Requests with this parameter set are now rejected.
*/
public SearchForAccounts round(Long round) {
addQuery("round", String.valueOf(round));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.algorand.algosdk.v2.client.model;

import java.util.HashMap;
import java.util.Objects;

import com.algorand.algosdk.v2.client.common.PathResponse;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
* Block header.
*/
public class BlockHeaderResponse extends PathResponse {

/**
* Block header data.
*/
@JsonProperty("blockHeader")
public HashMap<String,Object> blockHeader;

@Override
public boolean equals(Object o) {

if (this == o) return true;
if (o == null) return false;

BlockHeaderResponse other = (BlockHeaderResponse) o;
if (!Objects.deepEquals(this.blockHeader, other.blockHeader)) return false;

return true;
}
}