import { ServiceNowInstance } from "../ServiceNowInstance.js"; import { AggregateQueryOptions, CountQueryOptions, AggregateResult, GroupedAggregateResult } from './AggregateModels.js'; /** * AggregateQuery provides aggregate operations (COUNT, AVG, MIN, MAX, SUM) * against ServiceNow tables via the Stats API (/api/now/stats/). * Supports GROUP BY for grouped aggregations. */ export declare class AggregateQuery { private static readonly STATS_API_BASE; private _logger; private _req; private _instance; private _headers; constructor(instance: ServiceNowInstance); /** * Count records matching an optional query on a table. * Convenience method that returns a parsed integer. * * @param options Count query options (table required, query optional) * @returns The number of matching records * @throws Error if table name is empty or the API call fails */ count(options: CountQueryOptions): Promise; /** * Run an aggregate query (COUNT, AVG, MIN, MAX, SUM) without grouping. * * @param options Aggregate query options * @returns AggregateResult containing the computed statistics * @throws Error if table name is empty or the API call fails */ aggregate(options: AggregateQueryOptions): Promise; /** * Run a grouped aggregate query with GROUP BY. * * @param options Aggregate query options (groupBy is required) * @returns GroupedAggregateResult with groups and their stats * @throws Error if table name is empty, groupBy is missing/empty, or the API call fails */ groupBy(options: AggregateQueryOptions): Promise; /** * Build query parameters from aggregate options. * @private */ private _buildQueryParams; /** * Execute a GET request against the Stats API. * @private */ private _executeStatsRequest; }