All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.hyperchain.sdk.response.filemgr.FileExtraFromFileHashResponse Maven / Gradle / Ivy

There is a newer version: 1.4.3
Show newest version
package cn.hyperchain.sdk.response.filemgr;

import cn.hyperchain.sdk.common.utils.FileExtra;
import cn.hyperchain.sdk.response.PageResult;
import cn.hyperchain.sdk.response.Response;
import cn.hyperchain.sdk.response.tx.TxResponse;
import com.google.gson.annotations.Expose;

import java.util.List;

public class FileExtraFromFileHashResponse extends Response {
    @Expose
    private PageResult result;

    /**
     * parse fileExtra from result.
     *
     * @return file extra
     */
    public FileExtra getFileExtra() {
        List transactions = result.parseResult(TxResponse.Transaction.class);
        if (transactions.size() == 0) {
            throw new RuntimeException("can't get any transaction");
        }
        String extra = transactions.get(0).getExtra();
        return FileExtra.fromJson(extra);
    }

    @Override
    public String toString() {
        return "FileExtraFromFileHashResponse{" +
                "result=" + result +
                ", jsonrpc='" + jsonrpc + '\'' +
                ", id='" + id + '\'' +
                ", code=" + code +
                ", message='" + message + '\'' +
                ", namespace='" + namespace + '\'' +
                "}";
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy