io.keen.client.java.RelativeTimeframe Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of keen-client-api-query Show documentation
Show all versions of keen-client-api-query Show documentation
Java Query Client API for Keen IO
package io.keen.client.java;
import java.util.HashMap;
import java.util.Map;
/**
* Relative Timeframe, as specified by API docs: https://keen.io/docs/api/#relative-timeframes
*
* Created by claireyoung on 7/6/15.
* @author claireyoung
* @since 1.0.0
*/
class RelativeTimeframe implements Timeframe {
private final String relativeTimeframe;
/**
* Construct an AbsoluteTimeframe with a specified start and end date/time.
* @param relativeTimeframe the relative timeframe string, as specified by the API docs.
* For example, "this_minute", "this_month", "this_year", etc.
*/
public RelativeTimeframe(String relativeTimeframe) {
this.relativeTimeframe = relativeTimeframe;
}
/**
* Get the relative timeframe.
*
* @return the relative timeframe.
*/
public String getTimeframe() {
return relativeTimeframe;
}
/**
* Construct the Timeframe map to send in the query.
*
* @return the Timeframe Json map to send in the query.
*/
@Override
public Map constructTimeframeArgs() {
Map timeframe = new HashMap();
if (relativeTimeframe != null) {
timeframe.put(KeenQueryConstants.TIMEFRAME, relativeTimeframe);
return timeframe;
}
return null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy