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

io.everitoken.sdk.java.apiResource.HistoryDomain Maven / Gradle / Ivy

There is a newer version: 1.4.6
Show newest version
package io.everitoken.sdk.java.apiResource;

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

import com.alibaba.fastjson.JSONArray;

import org.jetbrains.annotations.NotNull;

import io.everitoken.sdk.java.dto.NameableResource;
import io.everitoken.sdk.java.exceptions.ApiResponseException;
import io.everitoken.sdk.java.param.RequestParams;

public class HistoryDomain extends OkhttpApi {
    private static final String uri = "/v1/history/get_domains";

    public HistoryDomain() {
        super(uri);
    }

    public HistoryDomain(@NotNull ApiRequestConfig apiRequestConfig) {
        super(uri, apiRequestConfig);
    }

    public List request(RequestParams requestParams) throws ApiResponseException {
        String res = super.makeRequest(requestParams);
        JSONArray array =  JSONArray.parseArray(res);
        List list = new ArrayList<>(array.size());

        for (int i = 0; i < array.size(); i++) {
            list.add(NameableResource.create((String) array.get(i)));
        }

        return list;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy