// Path: query/src/main/java/io/keen/client/java/result/IntervalResultValue.java
// public class IntervalResultValue {
//     private final AbsoluteTimeframe timeframe;
//     private final QueryResult result;
// 
//     public IntervalResultValue(AbsoluteTimeframe timeframe, QueryResult result) {
//         this.timeframe = timeframe;
//         this.result = result;
//     }
// 
//     public AbsoluteTimeframe getTimeframe() {
//         return timeframe;
//     }
// 
//     public QueryResult getResult() {
//         return result;
//     }
// 
//     @Override
//     public String toString() {
//         return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         return EqualsBuilder.reflectionEquals(this, obj);
//     }
// 
//     @Override
//     public int hashCode() {
//         return HashCodeBuilder.reflectionHashCode(this);
//     }
// }


import io.keen.client.java.result.IntervalResultValue;
import org.apache.commons.lang3.Validate;
import java.io.IOException;
import java.util.*;
package io.keen.client.java;



class CachedDatasetsClient implements CachedDatasets {

    private KeenQueryClient keenQueryClient;

    CachedDatasetsClient(KeenQueryClient keenQueryClient) {
        this.keenQueryClient = keenQueryClient;
    }

    @Override
    public DatasetDefinition create(String datasetName, String displayName, DatasetQuery query, Collection<String> indexBy) throws IOException {
        Validate.notBlank(datasetName, "Dataset name cannot be blank");
        Validate.notBlank(displayName, "Display name cannot be blank");
        Validate.notNull(query, "Dataset query is required");
        Validate.notEmpty(indexBy, "At least one index property is required");

        KeenQueryRequest request = CachedDatasetRequest.creationRequest(datasetName, displayName, query, indexBy);
        return DatasetDefinition.fromMap(keenQueryClient.getMapResponse(request));
    }

    @Override
    public DatasetDefinition getDefinition(String datasetName) throws IOException {
        Validate.notBlank(datasetName, "Dataset name cannot be blank");

        KeenQueryRequest request = CachedDatasetRequest.definitionRequest(datasetName);
        return DatasetDefinition.fromMap(keenQueryClient.getMapResponse(request));
    }

    @Override
// Path: query/src/main/java/io/keen/client/java/result/IntervalResultValue.java
// public class IntervalResultValue {
//     private final AbsoluteTimeframe timeframe;
//     private final QueryResult result;
// 
//     public IntervalResultValue(AbsoluteTimeframe timeframe, QueryResult result) {
//         this.timeframe = timeframe;
//         this.result = result;
//     }
// 
//     public AbsoluteTimeframe getTimeframe() {
//         return timeframe;
//     }
// 
//     public QueryResult getResult() {
//         return result;
//     }
// 
//     @Override
//     public String toString() {
//         return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         return EqualsBuilder.reflectionEquals(this, obj);
//     }
// 
//     @Override
//     public int hashCode() {
//         return HashCodeBuilder.reflectionHashCode(this);
//     }
// }


// Path: query/src/main/java/io/keen/client/java/CachedDatasetsClient.java
import io.keen.client.java.result.IntervalResultValue;
import org.apache.commons.lang3.Validate;
import java.io.IOException;
import java.util.*;

package io.keen.client.java;



class CachedDatasetsClient implements CachedDatasets {

    private KeenQueryClient keenQueryClient;

    CachedDatasetsClient(KeenQueryClient keenQueryClient) {
        this.keenQueryClient = keenQueryClient;
    }

    @Override
    public DatasetDefinition create(String datasetName, String displayName, DatasetQuery query, Collection<String> indexBy) throws IOException {
        Validate.notBlank(datasetName, "Dataset name cannot be blank");
        Validate.notBlank(displayName, "Display name cannot be blank");
        Validate.notNull(query, "Dataset query is required");
        Validate.notEmpty(indexBy, "At least one index property is required");

        KeenQueryRequest request = CachedDatasetRequest.creationRequest(datasetName, displayName, query, indexBy);
        return DatasetDefinition.fromMap(keenQueryClient.getMapResponse(request));
    }

    @Override
    public DatasetDefinition getDefinition(String datasetName) throws IOException {
        Validate.notBlank(datasetName, "Dataset name cannot be blank");

        KeenQueryRequest request = CachedDatasetRequest.definitionRequest(datasetName);
        return DatasetDefinition.fromMap(keenQueryClient.getMapResponse(request));
    }

    @Override
    public List<IntervalResultValue> getResults(DatasetDefinition datasetDefinition, Map<String, ?> indexByValues, Timeframe timeframe) throws IOException {