org.testobject.rest.api.resource.ApiSessionReportResource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of testobject-java-api Show documentation
Show all versions of testobject-java-api Show documentation
java wrapper for testobject's java apis
package org.testobject.rest.api.resource;
import org.testobject.rest.api.model.PaginationObject;
import org.testobject.rest.api.model.SessionReport;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.MediaType;
import static java.util.Base64.getEncoder;
public class ApiSessionReportResource {
private final WebTarget target;
public ApiSessionReportResource(WebTarget target) {
this.target = target;
}
public PaginationObject getSessionReports(String userId, long offset, int limit, int lastDays, String apiKey) {
String apiKeyHeader = "Basic " + getEncoder().encodeToString((":" + apiKey).getBytes());
return target
.path("v1")
.path("devices")
.path("reports")
.queryParam("userId", userId)
.queryParam("offset", offset)
.queryParam("limit", limit)
.queryParam("lastDays", lastDays)
.request(MediaType.APPLICATION_JSON)
.header("Authorization", apiKeyHeader)
.get(new GenericType>() {
});
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy