FIRAggregateQuery.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright 2022 Google LLC
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <Foundation/Foundation.h>
  17. #import "FIRAggregateSource.h"
  18. NS_ASSUME_NONNULL_BEGIN
  19. @class FIRQuery;
  20. @class FIRAggregateQuerySnapshot;
  21. /**
  22. * A query that calculates aggregations over an underlying query.
  23. */
  24. NS_SWIFT_NAME(AggregateQuery)
  25. @interface FIRAggregateQuery : NSObject
  26. /** :nodoc: */
  27. - (instancetype)init __attribute__((unavailable("FIRAggregateQuery cannot be created directly.")));
  28. /** The query whose aggregations will be calculated by this object. */
  29. @property(nonatomic, readonly) FIRQuery *query;
  30. /**
  31. * Executes this query.
  32. *
  33. * @param source The source from which to acquire the aggregate results.
  34. * @param completion a block to execute once the results have been successfully read.
  35. * snapshot will be `nil` only if error is `non-nil`.
  36. */
  37. - (void)aggregationWithSource:(FIRAggregateSource)source
  38. completion:(void (^)(FIRAggregateQuerySnapshot *_Nullable snapshot,
  39. NSError *_Nullable error))completion
  40. NS_SWIFT_NAME(getAggregation(source:completion:));
  41. @end
  42. NS_ASSUME_NONNULL_END