Skip to content

Commit

Permalink
Re-run code generator (#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldiamant authored Sep 23, 2022
1 parent b5425b7 commit d0f69df
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ public class AlgodClient extends Client {

/**
* Construct an AlgodClient for communicating with the REST API.
*
* @param host using a URI format. If the scheme is not supplied the client will use HTTP.
* @param port REST server port.
* @param host using a URI format. If the scheme is not supplied the client will use HTTP.
* @param port REST server port.
* @param token authentication token.
*/
public AlgodClient(String host, int port, String token) {
Expand All @@ -44,10 +43,9 @@ public AlgodClient(String host, int port, String token) {

/**
* Construct an AlgodClient with custom token key for communicating with the REST API.
*
* @param host using a URI format. If the scheme is not supplied the client will use HTTP.
* @param port REST server port.
* @param token authentication token.
* @param host using a URI format. If the scheme is not supplied the client will use HTTP.
* @param port REST server port.
* @param token authentication token.
* @param tokenKey authentication token key.
*/
public AlgodClient(String host, int port, String token, String tokenKey) {
Expand Down Expand Up @@ -111,7 +109,7 @@ public AccountInformation AccountInformation(Address address) {
* /v2/accounts/{address}/assets/{asset-id}
*/
public AccountAssetInformation AccountAssetInformation(Address address,
Long assetId) {
Long assetId) {
return new AccountAssetInformation((Client) this, address, assetId);
}

Expand All @@ -123,7 +121,7 @@ public AccountAssetInformation AccountAssetInformation(Address address,
* /v2/accounts/{address}/applications/{application-id}
*/
public AccountApplicationInformation AccountApplicationInformation(Address address,
Long applicationId) {
Long applicationId) {
return new AccountApplicationInformation((Client) this, address, applicationId);
}

Expand All @@ -150,7 +148,7 @@ public GetBlock GetBlock(Long round) {
* /v2/blocks/{round}/transactions/{txid}/proof
*/
public GetTransactionProof GetTransactionProof(Long round,
String txid) {
String txid) {
return new GetTransactionProof((Client) this, round, txid);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.algorand.algosdk.v2.client.indexer.SearchForApplications;
import com.algorand.algosdk.v2.client.indexer.LookupApplicationByID;
import com.algorand.algosdk.v2.client.indexer.SearchForApplicationBoxes;
import com.algorand.algosdk.v2.client.indexer.LookupApplicationBoxByIDandName;
import com.algorand.algosdk.v2.client.indexer.LookupApplicationBoxByIDAndName;
import com.algorand.algosdk.v2.client.indexer.LookupApplicationLogsByID;
import com.algorand.algosdk.v2.client.indexer.SearchForAssets;
import com.algorand.algosdk.v2.client.indexer.LookupAssetByID;
Expand Down Expand Up @@ -146,14 +146,14 @@ public SearchForApplicationBoxes searchForApplicationBoxes(Long applicationId) {

/**
* Given an application ID and box name, returns base64 encoded box name and value.
* Box names must be in the goal-arg form 'encoding:value'. For ints, use the form
* 'int:1234'. For raw bytes, encode base 64 and use 'b64' prefix as in 'b64:A=='.
* For printable strings, use the form 'str:hello'. For addresses, use the form
* 'addr:XYZ...'.
* Box names must be in the goal app call arg form 'encoding:value'. For ints, use
* the form 'int:1234'. For raw bytes, encode base 64 and use 'b64' prefix as in
* 'b64:A=='. For printable strings, use the form 'str:hello'. For addresses, use
* the form 'addr:XYZ...'.
* /v2/applications/{application-id}/box
*/
public LookupApplicationBoxByIDandName lookupApplicationBoxByIDandName(Long applicationId) {
return new LookupApplicationBoxByIDandName((Client) this, applicationId);
public LookupApplicationBoxByIDAndName lookupApplicationBoxByIDAndName(Long applicationId) {
return new LookupApplicationBoxByIDAndName((Client) this, applicationId);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@

/**
* Given an application ID and box name, returns base64 encoded box name and value.
* Box names must be in the goal-arg form 'encoding:value'. For ints, use the form
* 'int:1234'. For raw bytes, encode base 64 and use 'b64' prefix as in 'b64:A=='.
* For printable strings, use the form 'str:hello'. For addresses, use the form
* 'addr:XYZ...'.
* Box names must be in the goal app call arg form 'encoding:value'. For ints, use
* the form 'int:1234'. For raw bytes, encode base 64 and use 'b64' prefix as in
* 'b64:A=='. For printable strings, use the form 'str:hello'. For addresses, use
* the form 'addr:XYZ...'.
* /v2/applications/{application-id}/box
*/
public class LookupApplicationBoxByIDandName extends Query {
public class LookupApplicationBoxByIDAndName extends Query {

private Long applicationId;

/**
* @param applicationId
*/
public LookupApplicationBoxByIDandName(Client client, Long applicationId) {
public LookupApplicationBoxByIDAndName(Client client, Long applicationId) {
super(client, new HttpMethod("get"));
this.applicationId = applicationId;
}
Expand All @@ -33,7 +33,7 @@ public LookupApplicationBoxByIDandName(Client client, Long applicationId) {
* For raw bytes, use the form 'b64:A=='. For printable strings, use the form
* 'str:hello'. For addresses, use the form 'addr:XYZ...'.
*/
public LookupApplicationBoxByIDandName name(String name) {
public LookupApplicationBoxByIDAndName name(String name) {
addQuery("name", String.valueOf(name));
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ public SearchForAccounts next(String next) {

/**
* Include results for the specified round. For performance reasons, this parameter
* may be disabled on some configurations.
* 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.
*/
public SearchForAccounts round(Long round) {
addQuery("round", String.valueOf(round));
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/com/algorand/algosdk/v2/client/model/Block.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ public String genesisHash() {
@JsonProperty("genesis-id")
public String genesisId;

/**
* Participation account data that needs to be checked/acted on by the network.
*/
@JsonProperty("participation-updates")
public ParticipationUpdates participationUpdates;

/**
* (prev) Previous block hash.
*/
Expand Down Expand Up @@ -150,6 +156,7 @@ public boolean equals(Object o) {
Block other = (Block) o;
if (!Objects.deepEquals(this.genesisHash, other.genesisHash)) return false;
if (!Objects.deepEquals(this.genesisId, other.genesisId)) return false;
if (!Objects.deepEquals(this.participationUpdates, other.participationUpdates)) return false;
if (!Objects.deepEquals(this.previousBlockHash, other.previousBlockHash)) return false;
if (!Objects.deepEquals(this.rewards, other.rewards)) return false;
if (!Objects.deepEquals(this.round, other.round)) return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ public class BoxesResponse extends PathResponse {
@JsonProperty("boxes")
public List<BoxDescriptor> boxes = new ArrayList<BoxDescriptor>();

/**
* Used for pagination, when making another request provide this token with the
* next parameter.
*/
@JsonProperty("next-token")
public String nextToken;

@Override
public boolean equals(Object o) {

Expand All @@ -30,6 +37,7 @@ public boolean equals(Object o) {
BoxesResponse other = (BoxesResponse) o;
if (!Objects.deepEquals(this.applicationId, other.applicationId)) return false;
if (!Objects.deepEquals(this.boxes, other.boxes)) return false;
if (!Objects.deepEquals(this.nextToken, other.nextToken)) return false;

return true;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.algorand.algosdk.v2.client.model;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

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

/**
* Participation account data that needs to be checked/acted on by the network.
*/
public class ParticipationUpdates extends PathResponse {

/**
* (partupdrmv) a list of online accounts that needs to be converted to offline
* since their participation key expired.
*/
@JsonProperty("expired-participation-accounts")
public List<String> expiredParticipationAccounts = new ArrayList<String>();

@Override
public boolean equals(Object o) {

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

ParticipationUpdates other = (ParticipationUpdates) o;
if (!Objects.deepEquals(this.expiredParticipationAccounts, other.expiredParticipationAccounts)) return false;

return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public void contentsOfBoxShouldBe(String fromClient, String encodedBoxName, Stri
if (fromClient.equals("algod"))
boxResp = clients.v2Client.GetApplicationBoxByName(this.appId).name(encodedBoxName).execute();
else if (fromClient.equals("indexer"))
boxResp = clients.v2IndexerClient.lookupApplicationBoxByIDandName(this.appId).name(encodedBoxName).execute();
boxResp = clients.v2IndexerClient.lookupApplicationBoxByIDAndName(this.appId).name(encodedBoxName).execute();
else
throw new IllegalArgumentException("expecting algod or indexer, got " + fromClient);

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/algorand/algosdk/unit/IndexerPaths.java
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ public void searchForApplications(String string) {

@When("we make a LookupApplicationBoxByIDandName call with applicationID {long} with encoded box name {string}")
public void lookUpApplicationBox(Long appID, String boxName) {
ps.q = indexerClient.lookupApplicationBoxByIDandName(appID).name(boxName);
ps.q = indexerClient.lookupApplicationBoxByIDAndName(appID).name(boxName);
}

@When("we make a SearchForApplicationBoxes call with applicationID {long} with max {long} nextToken {string}")
Expand Down

0 comments on commit d0f69df

Please sign in to comment.