// Path: core/src/main/java/io/keen/client/java/http/HttpMethods.java
// public final class HttpMethods {
//     private HttpMethods() {}
// 
//     public final static String GET = "GET";
//     public final static String POST = "POST";
//     public final static String PUT = "PUT";
//     public final static String DELETE = "DELETE";
// }
// 
// Path: query/src/main/java/io/keen/client/java/result/QueryResult.java
// public abstract class QueryResult {
//     /**
//      * @return {@code false}
//      */
//     public boolean isDouble() {
//         return false;
//     }
// 
//     /**
//      * @return {@code false}
//      */
//     public boolean isLong() {
//         return false;
//     }
// 
//     /**
//      * @return {@code false}
//      */
//     public boolean isString() {
//         return false;
//     }
// 
//     /**
//      * @return {@code false}
//      */
//     public boolean isListResult() {
//         return false;
//     }
// 
//     /**
//      * @return {@code false}
//      */
//     public boolean isIntervalResult() {
//         return false;
//     }
// 
//     /**
//      * @return {@code false}
//      */
//     public boolean isGroupResult() { return false; }
// 
//     /**
//      * @return doubleValue, which is IllegalStateException in abstract class.
//      */
//     public double doubleValue() {
//         throw new IllegalStateException();
//     }
// 
//     /**
//      * @return longValue, which is IllegalStateException in abstract class.
//      */
//     public long longValue() {
//         throw new IllegalStateException();
//     }
// 
//     /**
//      * @return stringValue, which is IllegalStateException in abstract class.
//      */
//     public String stringValue() {
//         throw new IllegalStateException();
//     }
// 
//     /**
//      * @return list results, which is IllegalStateException in abstract class.
//      */
//     public List<QueryResult> getListResults() {
//         throw new IllegalStateException();
//     }
// 
//     /**
//      * @return map of AbsoluteTimeframe to QueryResult's, which is IllegalStateException in
//      * abstract class.
//      */
//     public List<IntervalResultValue> getIntervalResults() { throw new IllegalStateException(); }
// 
//     /**
//      * @return map of Group to QueryResult's, which is IllegalStateException in abstract class.
//      */
//     public Map<Group, QueryResult> getGroupResults() { throw new IllegalStateException(); }
// 
//     @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 java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import io.keen.client.java.exceptions.ServerException;
import io.keen.client.java.http.HttpMethods;
import io.keen.client.java.result.QueryResult;
    public Map<String, Object> createCachedQuery(String queryName,
                                                 KeenQueryRequest query,
                                                 int refreshRate) throws IOException {
        PersistentAnalysis newCachedQueryRequest =
                new SavedQueryPut(queryName,
                                  null /* displayName */,
                                  query,
                                  refreshRate,
                                  null /* miscProperties */);

        return queryClient.getMapResponse(newCachedQueryRequest);
    }

    @Override
    public Map<String, Object> createCachedQuery(String queryName,
                                                 KeenQueryRequest query,
                                                 String displayName,
                                                 int refreshRate) throws IOException {
        PersistentAnalysis newCachedQueryRequest =
                new SavedQueryPut(queryName,
                                  displayName,
                                  query,
                                  refreshRate,
                                  null /* miscProperties */);

        return queryClient.getMapResponse(newCachedQueryRequest);
    }

    @Override
    public Map<String, Object> getDefinition(String queryName) throws IOException {
// Path: core/src/main/java/io/keen/client/java/http/HttpMethods.java
// public final class HttpMethods {
//     private HttpMethods() {}
// 
//     public final static String GET = "GET";
//     public final static String POST = "POST";
//     public final static String PUT = "PUT";
//     public final static String DELETE = "DELETE";
// }
// 
// Path: query/src/main/java/io/keen/client/java/result/QueryResult.java
// public abstract class QueryResult {
//     /**
//      * @return {@code false}
//      */
//     public boolean isDouble() {
//         return false;
//     }
// 
//     /**
//      * @return {@code false}
//      */
//     public boolean isLong() {
//         return false;
//     }
// 
//     /**
//      * @return {@code false}
//      */
//     public boolean isString() {
//         return false;
//     }
// 
//     /**
//      * @return {@code false}
//      */
//     public boolean isListResult() {
//         return false;
//     }
// 
//     /**
//      * @return {@code false}
//      */
//     public boolean isIntervalResult() {
//         return false;
//     }
// 
//     /**
//      * @return {@code false}
//      */
//     public boolean isGroupResult() { return false; }
// 
//     /**
//      * @return doubleValue, which is IllegalStateException in abstract class.
//      */
//     public double doubleValue() {
//         throw new IllegalStateException();
//     }
// 
//     /**
//      * @return longValue, which is IllegalStateException in abstract class.
//      */
//     public long longValue() {
//         throw new IllegalStateException();
//     }
// 
//     /**
//      * @return stringValue, which is IllegalStateException in abstract class.
//      */
//     public String stringValue() {
//         throw new IllegalStateException();
//     }
// 
//     /**
//      * @return list results, which is IllegalStateException in abstract class.
//      */
//     public List<QueryResult> getListResults() {
//         throw new IllegalStateException();
//     }
// 
//     /**
//      * @return map of AbsoluteTimeframe to QueryResult's, which is IllegalStateException in
//      * abstract class.
//      */
//     public List<IntervalResultValue> getIntervalResults() { throw new IllegalStateException(); }
// 
//     /**
//      * @return map of Group to QueryResult's, which is IllegalStateException in abstract class.
//      */
//     public Map<Group, QueryResult> getGroupResults() { throw new IllegalStateException(); }
// 
//     @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/SavedQueriesImpl.java
import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import io.keen.client.java.exceptions.ServerException;
import io.keen.client.java.http.HttpMethods;
import io.keen.client.java.result.QueryResult;

    public Map<String, Object> createCachedQuery(String queryName,
                                                 KeenQueryRequest query,
                                                 int refreshRate) throws IOException {
        PersistentAnalysis newCachedQueryRequest =
                new SavedQueryPut(queryName,
                                  null /* displayName */,
                                  query,
                                  refreshRate,
                                  null /* miscProperties */);

        return queryClient.getMapResponse(newCachedQueryRequest);
    }

    @Override
    public Map<String, Object> createCachedQuery(String queryName,
                                                 KeenQueryRequest query,
                                                 String displayName,
                                                 int refreshRate) throws IOException {
        PersistentAnalysis newCachedQueryRequest =
                new SavedQueryPut(queryName,
                                  displayName,
                                  query,
                                  refreshRate,
                                  null /* miscProperties */);

        return queryClient.getMapResponse(newCachedQueryRequest);
    }

    @Override
    public Map<String, Object> getDefinition(String queryName) throws IOException {
        PersistentAnalysis getDefRequest = new SavedQueryRequest(HttpMethods.GET,