FIRAggregateQuery.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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_SENDABLE
  25. NS_SWIFT_NAME(AggregateQuery)
  26. @interface FIRAggregateQuery : NSObject
  27. /** :nodoc: */
  28. - (instancetype)init __attribute__((unavailable("FIRAggregateQuery cannot be created directly.")));
  29. /** The query whose aggregations will be calculated by this object. */
  30. @property(nonatomic, readonly) FIRQuery *query;
  31. /**
  32. * Executes this query.
  33. *
  34. * @param source The source from which to acquire the aggregate results.
  35. * @param completion a block to execute once the results have been successfully read.
  36. * snapshot will be `nil` only if error is `non-nil`.
  37. */
  38. - (void)aggregationWithSource:(FIRAggregateSource)source
  39. completion:(void (^)(FIRAggregateQuerySnapshot *_Nullable snapshot,
  40. NSError *_Nullable error))completion
  41. NS_SWIFT_NAME(getAggregation(source:completion:));
  42. @end
  43. NS_ASSUME_NONNULL_END