UNPKG

amberflo-metering-typescript

Version:
85 lines 3.65 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.UsageReport = exports.AllUsageApiPayload = exports.AllUsageGroupBy = exports.UsageApiPayload = exports.AggregationInterval = exports.AggregationType = exports.Take = exports.TimeRange = void 0; const validation_1 = require("./validation"); class TimeRange { constructor(startTimeInSeconds) { (0, validation_1.maybeShowDeprecationWarning)('TimeRange', startTimeInSeconds); this.startTimeInSeconds = startTimeInSeconds; } validate(prefix) { validation_1.validators.positiveInteger(`${prefix}.startTimeInSeconds`, this.startTimeInSeconds, false); validation_1.validators.positiveInteger(`${prefix}.endTimeInSeconds`, this.endTimeInSeconds); } } exports.TimeRange = TimeRange; class Take { constructor(limit) { (0, validation_1.maybeShowDeprecationWarning)('Take', limit); this.limit = limit; } validate(prefix) { validation_1.validators.positiveInteger(`${prefix}.limit`, this.limit, false); } } exports.Take = Take; var AggregationType; (function (AggregationType) { AggregationType["sum"] = "sum"; AggregationType["min"] = "min"; AggregationType["max"] = "max"; AggregationType["count"] = "count"; })(AggregationType = exports.AggregationType || (exports.AggregationType = {})); var AggregationInterval; (function (AggregationInterval) { AggregationInterval["hour"] = "hour"; AggregationInterval["day"] = "day"; AggregationInterval["week"] = "week"; AggregationInterval["month"] = "month"; })(AggregationInterval = exports.AggregationInterval || (exports.AggregationInterval = {})); class UsageApiPayload { constructor(meterApiName, aggregation, timeGroupingInterval, timeRange) { (0, validation_1.maybeShowDeprecationWarning)('UsageApiPayload', timeRange); this.meterApiName = meterApiName; this.aggregation = aggregation; this.timeGroupingInterval = timeGroupingInterval; this.timeRange = timeRange; } validate() { validation_1.validators.nonEmptyStr('meterApiName', this.meterApiName, false); validation_1.validators.required('aggregation', this.aggregation); validation_1.validators.required('timeGroupingInterval', this.timeGroupingInterval); validation_1.validators.valid('timeRange', this.timeRange, false); validation_1.validators.valid('take', this.take); validation_1.validators.nonEmptyList('groupBy', this.groupBy); validation_1.validators.nonEmptyListMap('filter', this.filter); } } exports.UsageApiPayload = UsageApiPayload; var AllUsageGroupBy; (function (AllUsageGroupBy) { AllUsageGroupBy["customerId"] = "customerId"; })(AllUsageGroupBy = exports.AllUsageGroupBy || (exports.AllUsageGroupBy = {})); class AllUsageApiPayload { constructor(startTimeInSeconds, timeGroupingInterval) { (0, validation_1.maybeShowDeprecationWarning)('AllUsageApiPayload', timeGroupingInterval); this.startTimeInSeconds = startTimeInSeconds; this.timeGroupingInterval = timeGroupingInterval; } validate() { validation_1.validators.required('startTimeInSeconds', this.startTimeInSeconds); validation_1.validators.required('timeGroupingInterval', this.timeGroupingInterval); validation_1.validators.nonEmptyStr('customerId', this.customerId); } } exports.AllUsageApiPayload = AllUsageApiPayload; class AggregationValue { } class AggregationGroup { } class Aggregation { } class UsageReport { } exports.UsageReport = UsageReport; //# sourceMappingURL=usageApiPayload.js.map