import { Query } from './index'; import { RunQueryOptions, RunQueryResponse } from './query'; import { RequestCallback } from './request'; declare const AGGREGATE_QUERY: unique symbol; /** * An AggregateQuery is a class that can be used to obtain results from an * aggregate query request. * * @see {@link https://cloud.google.com/datastore/docs/aggregation-queries| Aggregation queries Reference} * * @class */ declare class AggregateQuery { type: symbol; aggregations: Array; query: Query | undefined; /** * Build an AggregateQuery object. * * @param {Query} query */ constructor(query: Query); /** * Add a `count` aggregate query to the list of aggregations. * * @param {string} alias * @returns {AggregateQuery} */ count(alias?: string): AggregateQuery; /** * Add a `sum` aggregate query to the list of aggregations. * * @param {string} property * @param {string} alias * @returns {AggregateQuery} */ sum(property: string, alias?: string): AggregateQuery; /** * Add a `average` aggregate query to the list of aggregations. * * @param {string} property * @param {string} alias * @returns {AggregateQuery} */ average(property: string, alias?: string): AggregateQuery; /** * Add a custom aggregation to the list of aggregations. * * @param {AggregateField} aggregation * @returns {AggregateQuery} */ addAggregation(aggregation: AggregateField): AggregateQuery; /** * Add a list of custom aggregations to the list of aggregations. * * @param {AggregateField[]} aggregation * @returns {AggregateQuery} */ addAggregations(aggregations: AggregateField[]): AggregateQuery; /** * Run the aggregation query and return the results. * * @param {RunQueryOptions | RequestCallback} [optionsOrCallback] * @param {function} cb The callback function. * @returns {void | Promise} */ run(optionsOrCallback?: RunQueryOptions | RequestCallback, cb?: RequestCallback): void | Promise; /** * Get the proto for the list of aggregations. * */ toProto(): any; } /** * An AggregateField is a class that contains data that defines an aggregation. * */ declare abstract class AggregateField { alias_?: string; /** * Gets a copy of the Count aggregate field. * * @returns {Count} */ static count(): Count; /** * Gets a copy of the Sum aggregate field. * * @returns {Sum} */ static sum(property: string): Sum; /** * Gets a copy of the Average aggregate field. * * @returns {Average} */ static average(property: string): Average; /** * Sets the alias on the aggregate field that should be used. * * @param {string} alias The label used in the results to describe this * aggregate field when a query is run. * @returns {AggregateField} */ alias(alias?: string): AggregateField; /** * Gets the proto for the aggregate field. * */ abstract toProto(): any; } /** * A Count is a class that contains data that defines a Count aggregation. * */ declare class Count extends AggregateField { /** * Gets the proto for the count aggregate field. * */ toProto(): any; } /** * A PropertyAggregateField is a class that contains data that defines any * aggregation that is performed on a property. * */ declare abstract class PropertyAggregateField extends AggregateField { property_: string; abstract operator: string; /** * Build a PropertyAggregateField object. * * @param {string} property */ constructor(property_: string); /** * Gets the proto for the property aggregate field. * */ toProto(): any; } /** * A Sum is a class that contains data that defines a Sum aggregation. * */ declare class Sum extends PropertyAggregateField { operator: string; } /** * An Average is a class that contains data that defines an Average aggregation. * */ declare class Average extends PropertyAggregateField { operator: string; } export { AggregateField, AggregateQuery, AGGREGATE_QUERY };