edu.ksu.canvas.impl.AccountReportSummaryImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of canvas-api Show documentation
Show all versions of canvas-api Show documentation
A native Java library to talk to the Canvas REST API
package edu.ksu.canvas.impl;
import com.google.gson.reflect.TypeToken;
import edu.ksu.canvas.interfaces.AccountReportSummaryReader;
import edu.ksu.canvas.interfaces.AccountReportSummaryWriter;
import edu.ksu.canvas.model.report.AccountReportSummary;
import edu.ksu.canvas.net.RestClient;
import edu.ksu.canvas.oauth.OauthToken;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.Collections;
import java.util.List;
public class AccountReportSummaryImpl extends BaseImpl implements AccountReportSummaryReader, AccountReportSummaryWriter {
private static final Logger LOG = LoggerFactory.getLogger(AccountReportSummaryImpl.class);
public AccountReportSummaryImpl(String canvasBaseUrl, Integer apiVersion, OauthToken oauthToken, RestClient restClient,
int connectTimeout, int readTimeout, Integer paginationPageSize, Boolean serializeNulls) {
super(canvasBaseUrl, apiVersion, oauthToken, restClient, connectTimeout, readTimeout, paginationPageSize, serializeNulls);
}
@Override
public List listAvailableReports(String accountId) throws IOException {
LOG.debug("Retrieving available reports for account " + accountId);
String url = buildCanvasUrl("accounts/" + accountId + "/reports", Collections.emptyMap());
return getListFromCanvas(url);
}
@Override
protected Type listType() {
return new TypeToken>() {
}.getType();
}
@Override
protected Class objectType() {
return AccountReportSummary.class;
}
}