package nft.info;

import common.Resp;
import config.Config;
import exception.ZXChainException;
import util.HttpUtil;
import util.Tools;
import util.ZxlSDKUtil;

public class QueryTradeAllList {
    String addr;
    long offset;
    long limit;

    public QueryTradeAllList() {
    }

    public QueryTradeAllList(String addr, long offset, long limit) {
        this.addr = addr;
        this.offset = offset;
        this.limit = limit;
    }

    public TradeList query() throws Exception {
        // todo 参数校验
        Resp resp = HttpUtil.apiGetJsonX(Config.baseUrl + "/api/v1/nft/trade/all/list", Tools.getJson(this), ZxlSDKUtil.generateApiSign());
        if (resp.getRetCode() != 0) {
            throw new ZXChainException(resp.getRetMsg());
        }

        return resp.getData(TradeList.class);
    }

    public String getAddr() {
        return addr;
    }

    public void setAddr(String addr) {
        this.addr = addr;
    }

    public long getOffset() {
        return offset;
    }

    public void setOffset(long offset) {
        this.offset = offset;
    }

    public long getLimit() {
        return limit;
    }

    public void setLimit(long limit) {
        this.limit = limit;
    }
}
