![JAR search and dependency download from the Maven repository](/logo.png)
io.blockfrost.sdk.impl.MetricsServiceImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of blockfrost-java Show documentation
Show all versions of blockfrost-java Show documentation
Java SDK for the Blockfrost.io API
package io.blockfrost.sdk.impl;
import io.blockfrost.sdk.api.MetricsService;
import io.blockfrost.sdk.api.exception.APIException;
import io.blockfrost.sdk.api.model.EndpointUsageMetric;
import io.blockfrost.sdk.api.model.UsageMetric;
import io.blockfrost.sdk.impl.retrofit.MetricsApi;
import retrofit2.Call;
import retrofit2.Response;
import java.io.IOException;
import java.util.List;
public class MetricsServiceImpl extends BaseService implements MetricsService {
private MetricsApi metricsApi;
public MetricsServiceImpl(String baseUrl, String projectId) {
super(baseUrl, projectId);
metricsApi = getRetrofit().create(MetricsApi.class);
}
@Override
public List getUsageMetrics() throws APIException {
Call> usageMetricsCall = metricsApi.metricsGet(getProjectId());
try {
Response> usageMetricsResponse = usageMetricsCall.execute();
return processResponse(usageMetricsResponse);
} catch (IOException exp) {
throw new APIException("Exception while fetching usage metrics", exp);
}
}
@Override
public List getEndpointUsageMetrics() throws APIException {
Call> endpointUsageMetricsCall = metricsApi.metricsEndpointsGet(getProjectId());
try {
Response> endpointUsageMetricsResponse = endpointUsageMetricsCall.execute();
return processResponse(endpointUsageMetricsResponse);
} catch (IOException exp) {
throw new APIException("Exception while fetching endpoint usage metrics", exp);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy