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 (e6f39565) #419

Closed
wants to merge 1 commit into from
Closed
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,82 @@
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.Box;


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

private Long applicationId;

/**
* @param applicationId An application identifier
*/
public GetApplicationBoxByName(Client client, Long applicationId) {
super(client, new HttpMethod("get"));
this.applicationId = applicationId;
}

/**
* A box name, in the goal app call arg form 'encoding:value'. For ints, use the
* form 'int:1234'. For raw bytes, use the form 'b64:A=='. For printable strings,
* use the form 'str:hello'. For addresses, use the form 'addr:XYZ...'.
*/
public GetApplicationBoxByName name(String name) {
addQuery("name", String.valueOf(name));
return this;
}

/**
* Execute the query.
* @return the query response object.
* @throws Exception
*/
@Override
public Response<Box> execute() throws Exception {
Response<Box> resp = baseExecute();
resp.setValueType(Box.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<Box> execute(String[] headers, String[] values) throws Exception {
Response<Box> resp = baseExecute(headers, values);
resp.setValueType(Box.class);
return resp;
}

protected QueryData getRequestString() {
if (this.applicationId == null) {
throw new RuntimeException("application-id is not set. It is a required parameter.");
}
if (!qd.queries.containsKey("name")) {
throw new RuntimeException("name is not set. It is a required parameter.");
}
addPathSegment(String.valueOf("v2"));
addPathSegment(String.valueOf("applications"));
addPathSegment(String.valueOf(applicationId));
addPathSegment(String.valueOf("box"));

return qd;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
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.BoxesResponse;


/**
* Given an application ID, return all Box names. No particular ordering is
* guaranteed. Request fails when client or server-side configured limits prevent
* returning all Box names.
* /v2/applications/{application-id}/boxes
*/
public class GetApplicationBoxes extends Query {

private Long applicationId;

/**
* @param applicationId An application identifier
*/
public GetApplicationBoxes(Client client, Long applicationId) {
super(client, new HttpMethod("get"));
this.applicationId = applicationId;
}

/**
* Max number of box names to return. If max is not set, or max == 0, returns all
* box-names.
*/
public GetApplicationBoxes max(Long max) {
addQuery("max", String.valueOf(max));
return this;
}

/**
* Execute the query.
* @return the query response object.
* @throws Exception
*/
@Override
public Response<BoxesResponse> execute() throws Exception {
Response<BoxesResponse> resp = baseExecute();
resp.setValueType(BoxesResponse.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<BoxesResponse> execute(String[] headers, String[] values) throws Exception {
Response<BoxesResponse> resp = baseExecute(headers, values);
resp.setValueType(BoxesResponse.class);
return resp;
}

protected QueryData getRequestString() {
if (this.applicationId == null) {
throw new RuntimeException("application-id is not set. It is a required parameter.");
}
addPathSegment(String.valueOf("v2"));
addPathSegment(String.valueOf("applications"));
addPathSegment(String.valueOf(applicationId));
addPathSegment(String.valueOf("boxes"));

return qd;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import com.algorand.algosdk.v2.client.algod.GetStateProof;
import com.algorand.algosdk.v2.client.algod.GetLightBlockHeaderProof;
import com.algorand.algosdk.v2.client.algod.GetApplicationByID;
import com.algorand.algosdk.v2.client.algod.GetApplicationBoxes;
import com.algorand.algosdk.v2.client.algod.GetApplicationBoxByName;
import com.algorand.algosdk.v2.client.algod.GetAssetByID;
import com.algorand.algosdk.v2.client.algod.TealCompile;
import com.algorand.algosdk.v2.client.algod.TealDisassemble;
Expand Down Expand Up @@ -249,6 +251,28 @@ public GetApplicationByID GetApplicationByID(Long applicationId) {
return new GetApplicationByID((Client) this, applicationId);
}

/**
* Given an application ID, return all Box names. No particular ordering is
* guaranteed. Request fails when client or server-side configured limits prevent
* returning all Box names.
* /v2/applications/{application-id}/boxes
*/
public GetApplicationBoxes GetApplicationBoxes(Long applicationId) {
return new GetApplicationBoxes((Client) this, applicationId);
}

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

/**
* Given a asset ID, it returns asset information including creator, name, total
* supply and special addresses.
Expand Down
50 changes: 50 additions & 0 deletions src/main/java/com/algorand/algosdk/v2/client/model/Box.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.algorand.algosdk.v2.client.model;

import java.util.Objects;

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

/**
* Box name and its content.
*/
public class Box extends PathResponse {

/**
* (name) box name, base64 encoded
*/
@JsonProperty("name")
public void name(String base64Encoded) {
this.name = Encoder.decodeFromBase64(base64Encoded);
}
public String name() {
return Encoder.encodeToBase64(this.name);
}
public byte[] name;

/**
* (value) box value, base64 encoded.
*/
@JsonProperty("value")
public void value(String base64Encoded) {
this.value = Encoder.decodeFromBase64(base64Encoded);
}
public String value() {
return Encoder.encodeToBase64(this.value);
}
public byte[] value;

@Override
public boolean equals(Object o) {

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

Box other = (Box) o;
if (!Objects.deepEquals(this.name, other.name)) return false;
if (!Objects.deepEquals(this.value, other.value)) return false;

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

import java.util.Objects;

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

/**
* Box descriptor describes a Box.
*/
public class BoxDescriptor extends PathResponse {

/**
* Base64 encoded box name
*/
@JsonProperty("name")
public void name(String base64Encoded) {
this.name = Encoder.decodeFromBase64(base64Encoded);
}
public String name() {
return Encoder.encodeToBase64(this.name);
}
public byte[] name;

@Override
public boolean equals(Object o) {

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

BoxDescriptor other = (BoxDescriptor) o;
if (!Objects.deepEquals(this.name, other.name)) return false;

return true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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;

/**
* Box names of an application
*/
public class BoxesResponse extends PathResponse {

@JsonProperty("boxes")
public List<BoxDescriptor> boxes = new ArrayList<BoxDescriptor>();

@Override
public boolean equals(Object o) {

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

BoxesResponse other = (BoxesResponse) o;
if (!Objects.deepEquals(this.boxes, other.boxes)) return false;

return true;
}
}